digitalmars.D - D Lang'99 & Its future
- Salih Dincer (17/17) Feb 08 2022 Hope, D will go on to the next version,
- H. S. Teoh (6/27) Feb 08 2022 In latest dmd git HEAD, you need to annotate this function with
- user1234 (2/28) Feb 08 2022 destroyer 2000
- Martin Tschierschke (2/4) Feb 09 2022 Sorry, I am to stupid, where do you have to "annotate return"?
- bauss (12/18) Feb 09 2022 I believe it would be like this:
- Martin Tschierschke (24/40) Feb 09 2022 Thank you I tried it, at the https://tour.dlang.org/ rdmd
- bauss (30/72) Feb 09 2022 toString() should return a string, so what should happen is that
- Martin Tschierschke (3/15) Feb 09 2022 👍👍👍, and thanks.
- user1234 (3/8) Feb 09 2022 it's still dead stack data
- Salih Dincer (8/34) Feb 09 2022 Okay, you're right. Now worked it: https://run.dlang.io/is/ja1n6C
- matheus (10/11) Feb 08 2022 It will end-up as a full circle, D started as better replacement
Hope, D will go on to the next version, the compiler will release up to v10! Many happy returns of the (D)ay...🥳 ```d enum Dlang99 = 4026728633831507; union Magic { long data; char[8] bits; string toString() { return bits; } } auto magic = Magic(Dlang99<<10|'D'); magic.writefln!"..::%s::.."; ```
Feb 08 2022
On Tue, Feb 08, 2022 at 06:19:55PM +0000, Salih Dincer via Digitalmars-d wrote:Hope, D will go on to the next version, the compiler will release up to v10! Many happy returns of the (D)ay...🥳 ```d enum Dlang99 = 4026728633831507; union Magic { long data; char[8] bits; string toString()In latest dmd git HEAD, you need to annotate this function with `return`, because it escapes a reference to `this`. :-){ return bits; } } auto magic = Magic(Dlang99<<10|'D'); magic.writefln!"..::%s::.."; ```T -- WINDOWS = Will Install Needless Data On Whole System -- CompuMan
Feb 08 2022
On Tuesday, 8 February 2022 at 18:28:21 UTC, H. S. Teoh wrote:On Tue, Feb 08, 2022 at 06:19:55PM +0000, Salih Dincer via Digitalmars-d wrote:destroyer 2000Hope, D will go on to the next version, the compiler will release up to v10! Many happy returns of the (D)ay...🥳 ```d enum Dlang99 = 4026728633831507; union Magic { long data; char[8] bits; string toString()In latest dmd git HEAD, you need to annotate this function with `return`, because it escapes a reference to `this`. :-){ return bits; } } auto magic = Magic(Dlang99<<10|'D'); magic.writefln!"..::%s::.."; ```T
Feb 08 2022
On Tuesday, 8 February 2022 at 18:28:21 UTC, H. S. Teoh wrote:In latest dmd git HEAD, you need to annotate this function with `return`, because it escapes a reference to `this`. :-)Sorry, I am to stupid, where do you have to "annotate return"?
Feb 09 2022
On Wednesday, 9 February 2022 at 08:38:00 UTC, Martin Tschierschke wrote:On Tuesday, 8 February 2022 at 18:28:21 UTC, H. S. Teoh wrote:I believe it would be like this: ```d ref string toString() return { return bits; } ``` Someone can correct me if I'm wrong, but I believe this is what he's referring to in the spec: https://dlang.org/spec/function.html#return-ref-parametersIn latest dmd git HEAD, you need to annotate this function with `return`, because it escapes a reference to `this`. :-)Sorry, I am to stupid, where do you have to "annotate return"?
Feb 09 2022
On Wednesday, 9 February 2022 at 10:21:33 UTC, bauss wrote:On Wednesday, 9 February 2022 at 08:38:00 UTC, Martin Tschierschke wrote:Thank you I tried it, at the https://tour.dlang.org/ rdmd Playground and got a casting error, so I changed ```string``` to ```char[8]``` and it worked: no return needed: (?) ``` import std.stdio; void main() { enum Dlang99 = 4026728633831507; union Magic { long data; char[8] bits; char[8] toString() { return bits; } } auto magic = Magic(Dlang99<<10|'D'); magic.writefln!"..::%s::.."; } ```On Tuesday, 8 February 2022 at 18:28:21 UTC, H. S. Teoh wrote:I believe it would be like this: ```d ref string toString() return { return bits; } ```In latest dmd git HEAD, you need to annotate this function with `return`, because it escapes a reference to `this`. :-)Sorry, I am to stupid, where do you have to "annotate return"?
Feb 09 2022
On Wednesday, 9 February 2022 at 12:24:32 UTC, Martin Tschierschke wrote:On Wednesday, 9 February 2022 at 10:21:33 UTC, bauss wrote:toString() should return a string, so what should happen is that the value of bits must actually be converted to string. The error is evident if you ex. try to cast bits to string like this: ``` string toString() { return cast(string)bits; } ``` Which will give this error: ``` onlineapp.d(12): Deprecation: returning `cast(string)this.bits` escapes a reference to parameter `this` onlineapp.d(12): perhaps annotate the parameter with `return` ``` So when we do: ``` string toString() return { return cast(string)bits; } ``` There's no error. Probably a terrible example and I'm not sure if casting like that is even considered safe or should even be done like that, but yeah...On Wednesday, 9 February 2022 at 08:38:00 UTC, Martin Tschierschke wrote:Thank you I tried it, at the https://tour.dlang.org/ rdmd Playground and got a casting error, so I changed ```string``` to ```char[8]``` and it worked: no return needed: (?) ``` import std.stdio; void main() { enum Dlang99 = 4026728633831507; union Magic { long data; char[8] bits; char[8] toString() { return bits; } } auto magic = Magic(Dlang99<<10|'D'); magic.writefln!"..::%s::.."; } ```On Tuesday, 8 February 2022 at 18:28:21 UTC, H. S. Teoh wrote:I believe it would be like this: ```d ref string toString() return { return bits; } ```In latest dmd git HEAD, you need to annotate this function with `return`, because it escapes a reference to `this`. :-)Sorry, I am to stupid, where do you have to "annotate return"?
Feb 09 2022
On Wednesday, 9 February 2022 at 12:47:34 UTC, bauss wrote: [...]``` So when we do: ``` string toString() return { return cast(string)bits; } ``` There's no error. Probably a terrible example and I'm not sure if casting like that is even considered safe or should even be done like that, but yeah...👍👍👍, and thanks.
Feb 09 2022
On Wednesday, 9 February 2022 at 12:24:32 UTC, Martin Tschierschke wrote:Thank you I tried it, at the https://tour.dlang.org/ rdmd Playground and got a casting error, so I changed ```string``` to ```char[8]``` and it worked: no return needed: (?)it's still dead stack data
Feb 09 2022
On Tuesday, 8 February 2022 at 18:28:21 UTC, H. S. Teoh wrote:On Tue, Feb 08, 2022 at 06:19:55PM +0000, Salih Dincer via Digitalmars-d wrote:Okay, you're right. Now worked it: https://run.dlang.io/is/ja1n6C ```d auto toString() { return cast(string)bits; } ```Hope, D will go on to the next version, the compiler will release up to v10! Many happy returns of the (D)ay...🥳 ```d enum Dlang99 = 4026728633831507; union Magic { long data; char[8] bits; string toString()In latest dmd git HEAD, you need to annotate this function with `return`, because it escapes a reference to `this`. :-){ return bits; } } auto magic = Magic(Dlang99<<10|'D'); magic.writefln!"..::%s::.."; ```T
Feb 09 2022
On Tuesday, 8 February 2022 at 18:19:55 UTC, Salih Dincer wrote:Hope, D will go on to the next version,It will end-up as a full circle, D started as better replacement for chaotic C++, it was even written in the latter and going neck to neck or even surpassing over the years, until it reached the point of "dog-fooding" and the compiler was rewritten in D, and now its direction is to be like D as a better C, it's incorporating stuffs like importC, and will eventually get rid of the GC, classes, templates... just to become a C's Doppelgänger. :) Matheus.
Feb 08 2022
On Tuesday, 8 February 2022 at 23:30:44 UTC, matheus wrote:On Tuesday, 8 February 2022 at 18:19:55 UTC, Salih Dincer wrote:There appears to be a fundamental law of physics, whereby the natural tendency of things is to approach a chaotic state. C++ already seems well on its way... With D, the real question is, just how long can we delay this decay ;-)Hope, D will go on to the next version,It will end-up as a full circle, D started as better replacement for chaotic C++, it was even written in the latter and going neck to neck or even surpassing over the years, until it reached the point of "dog-fooding" and the compiler was rewritten in D, and now its direction is to be like D as a better C, it's incorporating stuffs like importC, and will eventually get rid of the GC, classes, templates... just to become a C's Doppelgänger. :) Matheus.
Feb 08 2022
On Wednesday, 9 February 2022 at 00:03:23 UTC, forkit wrote:do the maths: -(entropy) = k log (1/D)
Feb 08 2022