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,
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)
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.
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
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
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,
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
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`
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
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.
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?
imho, regexp is overkill here.
as for me, i usually just split line for first '=', then trim
spaces left and right parts.
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
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`
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.
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
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
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`
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
On Friday, 6 May 2022 at 05:40:52 UTC, forkit wrote:
auto myTuple = line.split(" = ");
Well, only if as a strict form :)
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
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`
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
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.
On Friday, 6 May 2022 at 05:44:39 UTC, vit wrote:
Try this:
Very Good,Thank you very much!
25 matches
Mail list logo