Re: Google Code Jam 2022

2022-05-06 Thread zjh via Digitalmars-d-learn
On Friday, 6 May 2022 at 04:26:13 UTC, Siarhei Siamashka wrote: Rust is happily eating D's lunch. Yes, `Rust` has intercepted d's most users. However, a good meal is not afraid of late . `Make up` the language and compete with them.

Re: Using regular expressions when reading a file

2022-05-06 Thread Alexander Zhirov via Digitalmars-d-learn
On Friday, 6 May 2022 at 05:40:52 UTC, forkit wrote: auto myTuple = line.split(" = "); Well, only if as a strict form :)

Re: Why isn't my dynamic array method doesn't work for this type?

2022-05-06 Thread rempas via Digitalmars-d-learn
On Thursday, 5 May 2022 at 21:07:22 UTC, colleen camacho wrote: can i use method of Dynamic array in C using malloc library function. Program example will create an integer array of any length dynamically by asking the array size and array elements from user and display on the screen.how

Re: Google Code Jam 2022

2022-05-06 Thread Tejas via Digitalmars-d-learn
On Friday, 6 May 2022 at 08:25:34 UTC, Siarhei Siamashka wrote: On Friday, 6 May 2022 at 07:05:35 UTC, zjh wrote: For example, I think `d` can also make use of `'winrt'`, which is very important for `GUI` programming . `D` officials should pay attention to `it`. I have downloaded `dwinrt`

Re: Using regular expressions when reading a file

2022-05-06 Thread forkit via Digitalmars-d-learn
On Friday, 6 May 2022 at 07:51:01 UTC, Alexander Zhirov wrote: On Friday, 6 May 2022 at 05:40:52 UTC, forkit wrote: auto myTuple = line.split(" = "); Well, only if as a strict form :) well.. a settings file should be following a strict format. ..otherwise...anything goes... and good luck

Re: Using regular expressions when reading a file

2022-05-06 Thread novice2 via Digitalmars-d-learn
imho, regexp is overkill here. as for me, i usually just split line for first '=', then trim spaces left and right parts.

Re: How to unpack template parameters,Or how to forward parameters?

2022-05-06 Thread zjh via Digitalmars-d-learn
On Friday, 6 May 2022 at 05:44:39 UTC, vit wrote: Try this: Very Good,Thank you very much!

Re: Google Code Jam 2022

2022-05-06 Thread zjh via Digitalmars-d-learn
On Friday, 6 May 2022 at 06:57:40 UTC, zjh wrote: Yes, `Rust` has intercepted d's most users. `C++, Rust and python` all have the `biggest feature`, that is, they pay attention not only to the `language`, but also to the `library`! `D` language should be the `same`! For example, I think

Re: Google Code Jam 2022

2022-05-06 Thread zjh via Digitalmars-d-learn
On Friday, 6 May 2022 at 08:25:34 UTC, Siarhei Siamashka wrote: On Friday, 6 May 2022 at 07:05:35 UTC, zjh wrote: For example, I think `d` can also make use of `'winrt'`, which is very important for `GUI` programming . `D` officials should pay attention to `it`. I have downloaded `dwinrt`

Re: Google Code Jam 2022

2022-05-06 Thread zjh via Digitalmars-d-learn
On Friday, 6 May 2022 at 07:13:06 UTC, zjh wrote: In addition, `D` should not be positioned as `one`'s `second language`, but as `first language`. We should position ourselves in `comfort` and make programmers `feel good`. Only when the "`programmers`" are comfortable, naturally, they will

Re: Google Code Jam 2022

2022-05-06 Thread Siarhei Siamashka via Digitalmars-d-learn
On Friday, 6 May 2022 at 07:05:35 UTC, zjh wrote: For example, I think `d` can also make use of `'winrt'`, which is very important for `GUI` programming . `D` officials should pay attention to `it`. I have downloaded `dwinrt` and has many compilation errors! Regularly introducing

dip1000 return scope dmd v 2.100

2022-05-06 Thread vit via Digitalmars-d-learn
Hello, new dmd (2.100) has return/scope changes. It look like examples at page https://dlang.org/spec/function.html#ref-return-scope-parameters are no longer relevant. What difference are between `return scope`, `scope return` and `return`? Why `void* ptr` in struct change effect of `scope

Re: Including C sources in a DUB project

2022-05-06 Thread Alexander Zhirov via Digitalmars-d-learn
On Thursday, 5 May 2022 at 06:05:55 UTC, Alexander Zhirov wrote: It turns out to compile everything manually, but I would like to do it all through the dub project. Does anyone have examples of such a configuration?

Re: Google Code Jam 2022

2022-05-06 Thread zjh via Digitalmars-d-learn
On Friday, 6 May 2022 at 06:57:40 UTC, zjh wrote: We should even `track` the `main libraries` of `major languages` and have `professionals` write their `ports` to `D`. There should also be `news` about `major language/major libraries`'s `major news or actions`.Instead of just `focusing on`

Re: Google Code Jam 2022

2022-05-06 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 6 May 2022 at 04:26:13 UTC, Siarhei Siamashka wrote: So it may seem that D should be a very good choice for programming competitions, but there's still no success. Programming competitions are a 100% waste of time. I'm too busy doing real work.

Re: Why isn't my dynamic array method doesn't work for this type?

2022-05-06 Thread rempas via Digitalmars-d-learn
On Friday, 6 May 2022 at 13:35:13 UTC, Steven Schveighoffer wrote: You don't need to declare an assign operator, the default for structs is to member-wise copy all the values. However, if you do provide one, it will be used. Note that a simple default can be done like: ```d ref My_File

What am I doing wrong here?

2022-05-06 Thread JG via Digitalmars-d-learn
This isn't code to be used for anything (just understanding). ```d import std; struct Delegate(A,B) { B function(void* ptr, A a) f; void* data; B opCall(A a) { return f(data,a); } } auto toDelegate(A, B,S)(S s) { static B f(void* ptr, A a) { return

Re: What am I doing wrong here?

2022-05-06 Thread JG via Digitalmars-d-learn
On Friday, 6 May 2022 at 18:35:40 UTC, Ali Çehreli wrote: On 5/6/22 11:04, JG wrote: > [...] This is a segmentation fault. Reduced: import std; [...] Hi, thanks. That was quite silly. (I was thinking the variable lives to the end of scope of main but not thinking about that I am passing

Re: dip1000 return scope dmd v 2.100

2022-05-06 Thread Dennis via Digitalmars-d-learn
On Friday, 6 May 2022 at 09:24:06 UTC, vit wrote: It look like examples at page https://dlang.org/spec/function.html#ref-return-scope-parameters are no longer relevant. They were recently updated to match the implementation in 2.100. What difference are between `return scope`, `scope return`

Re: What am I doing wrong here?

2022-05-06 Thread Ali Çehreli via Digitalmars-d-learn
On 5/6/22 11:04, JG wrote: > This isn't code to be used for anything (just understanding). This is a segmentation fault. Reduced: import std; struct Delegate(A,B) { B function(void* ptr, A a) f; void* data; B opCall(A a) { return f(data,a); } } auto toDelegate(A,

Interface wierdness

2022-05-06 Thread Ruby The Roobster via Digitalmars-d-learn
Define an interface that has a function that returns an object of the same type: ```d interface I { I foo(); } ``` Now define a class that inherits that interface: ```d class M : I { this(int i) { this.i = i; } M foo() { return new M(42); } int

Re: Interface wierdness

2022-05-06 Thread Ruby The Roobster via Digitalmars-d-learn
On Saturday, 7 May 2022 at 00:48:20 UTC, Ruby The Roobster wrote: Define an interface that has a function that returns an object of the same type: .. Nevermind. I was being stupid and made a naming error.

Re: Interface wierdness

2022-05-06 Thread Salih Dincer via Digitalmars-d-learn
On Saturday, 7 May 2022 at 00:48:20 UTC, Ruby The Roobster wrote: Why does this happen and how to fix it? What version compiler are you using? I've tried it in two different versions (one is the newest), it works: ```d import std; interface I { I foo(); } class M : I { this(int i)

Re: What am I doing wrong here?

2022-05-06 Thread Salih Dincer via Digitalmars-d-learn
On Friday, 6 May 2022 at 18:04:13 UTC, JG wrote: ```d //... struct Adder { int a; int opCall(int b) { return a+b; } } auto adder(int a) { auto ret = Adder.init; ret.a=a; return ret; } void main() { auto g = adder(5); g(5).writeln; // 10 auto d = toDelegate!(int,

Re: Why isn't my dynamic array method doesn't work for this type?

2022-05-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/5/22 4:27 PM, rempas wrote: On Thursday, 5 May 2022 at 14:20:49 UTC, Steven Schveighoffer wrote: Your assignment operator does nothing. Thanks! That was indeed the problem! In the other data structures, it worked without needing explicitly provide one so I didn't thought about it.