Re: Added copy constructors to "Programming in D"

2022-02-11 Thread Abdulhaq via Digitalmars-d-announce
On Friday, 11 February 2022 at 10:06:32 UTC, bauss wrote: Didn't Scott Meyers cover exactly this in his "the last thing D needs" talk? It seems like a really bad idea. Well D has already taken the piss on that talk a long time ago. No offense to D overall, and I still love it. Rumours that

Re: Added copy constructors to "Programming in D"

2022-02-11 Thread bauss via Digitalmars-d-announce
On Thursday, 10 February 2022 at 23:21:50 UTC, Meta wrote: On Thursday, 10 February 2022 at 20:34:29 UTC, Walter Bright wrote: On 2/10/2022 12:06 AM, Mathias LANG wrote: I think an *immediate* improvement we could make to ease people's life is to make `auto` peel the outermost qualifier level

Re: Added copy constructors to "Programming in D"

2022-02-10 Thread Meta via Digitalmars-d-announce
On Thursday, 10 February 2022 at 20:34:29 UTC, Walter Bright wrote: On 2/10/2022 12:06 AM, Mathias LANG wrote: I think an *immediate* improvement we could make to ease people's life is to make `auto` peel the outermost qualifier level inside functions. So that: ```D const int* ptr; auto p2 =

Re: Added copy constructors to "Programming in D"

2022-02-10 Thread Elronnd via Digitalmars-d-announce
On Thursday, 10 February 2022 at 08:06:23 UTC, Mathias LANG wrote: make `auto` peel the outermost qualifier level inside functions. Shouldn't do that for class references. Otherwise seems fine.

Re: Added copy constructors to "Programming in D"

2022-02-10 Thread Walter Bright via Digitalmars-d-announce
On 2/10/2022 12:34 PM, Walter Bright wrote: On 2/10/2022 12:06 AM, Mathias LANG wrote: I think an *immediate* improvement we could make to ease people's life is to make `auto` peel the outermost qualifier level inside functions. So that: ```D const int* ptr; auto p2 = ptr; static

Re: Added copy constructors to "Programming in D"

2022-02-10 Thread Walter Bright via Digitalmars-d-announce
On 2/10/2022 12:06 AM, Mathias LANG wrote: I think an *immediate* improvement we could make to ease people's life is to make `auto` peel the outermost qualifier level inside functions. So that: ```D const int* ptr; auto p2 = ptr; static assert(is(typeof(p2) == const(int)*)); ``` I really

Re: Added copy constructors to "Programming in D"

2022-02-10 Thread Mathias LANG via Digitalmars-d-announce
On Thursday, 10 February 2022 at 02:39:11 UTC, Ali Çehreli wrote: Yeah, that issue bugs me a little. Ali I think an *immediate* improvement we could make to ease people's life is to make `auto` peel the outermost qualifier level inside functions. So that: ```D const int* ptr; auto p2 =

Re: Added copy constructors to "Programming in D"

2022-02-09 Thread Ali Çehreli via Digitalmars-d-announce
On 2/9/22 18:11, Meta wrote: > Why do we even bother with `in` when we can do: > > alias In(T) = const scope T; > > void test(In!int n) { > pragma(msg, typeof(n)); > } > > ? > > onlineapp.d(3): Deprecation: storage class `scope` has no effect in type > aliases > const(int) > > ...oh I

Re: Added copy constructors to "Programming in D"

2022-02-09 Thread Meta via Digitalmars-d-announce
Why do we even bother with `in` when we can do: alias In(T) = const scope T; void test(In!int n) { pragma(msg, typeof(n)); } ? onlineapp.d(3): Deprecation: storage class `scope` has no effect in type aliases const(int) ...oh

Re: Added copy constructors to "Programming in D"

2022-02-09 Thread H. S. Teoh via Digitalmars-d-announce
On Wed, Feb 09, 2022 at 10:28:15AM -0800, Ali Çehreli via Digitalmars-d-announce wrote: [...] > - const is a promise > > - immutable is a requirement [...] Strictly speaking, that's not really an accurate description. :-P A more accurate description would be: - const: I cannot modify the data

Re: Added copy constructors to "Programming in D"

2022-02-09 Thread Ali Çehreli via Digitalmars-d-announce
On 2/9/22 02:15, Anonymouse wrote: On Saturday, 8 January 2022 at 02:07:10 UTC, Ali Çehreli wrote: 2) The other noteworthy change in the book is my now-different stance on variables: Now I recommend 'const' over 'immutable' for variables. I'm curious, could you elaborate a bit on this? I

Re: Added copy constructors to "Programming in D"

2022-02-09 Thread Anonymouse via Digitalmars-d-announce
On Saturday, 8 January 2022 at 02:07:10 UTC, Ali Çehreli wrote: 2) The other noteworthy change in the book is my now-different stance on variables: Now I recommend 'const' over 'immutable' for variables. I'm curious, could you elaborate a bit on this? I skimmed through the page on

Re: Added copy constructors to "Programming in D"

2022-01-27 Thread Imperatorn via Digitalmars-d-announce
On Thursday, 27 January 2022 at 15:30:02 UTC, Ali Çehreli wrote: On 1/8/22 05:23, Imperatorn wrote: > [...] wrote: >> [...] constructors: >> [...] http://ddili.org/ders/d.en/special_functions.html#ix_special_functions.copy%20constructor [...] Wonderful, thanks for your highly valuable

Re: Added copy constructors to "Programming in D"

2022-01-27 Thread Ali Çehreli via Digitalmars-d-announce
On 1/8/22 05:23, Imperatorn wrote: > On Saturday, 8 January 2022 at 02:07:10 UTC, Ali Çehreli wrote: >> 1) After about three years, I finally added copy constructors: >> >> http://ddili.org/ders/d.en/special_functions.html#ix_special_functions.copy%20constructor > Will the physical book also

Re: Added copy constructors to "Programming in D"

2022-01-14 Thread Martin Tschierschke via Digitalmars-d-announce
On Thursday, 13 January 2022 at 09:21:46 UTC, Andrea Fontana wrote: On Saturday, 8 January 2022 at 13:23:52 UTC, Imperatorn wrote: On Saturday, 8 January 2022 at 02:07:10 UTC, Ali Çehreli wrote: 1) After about three years, I finally added copy constructors: [...] Will the physical book also

Re: Added copy constructors to "Programming in D"

2022-01-13 Thread Andrea Fontana via Digitalmars-d-announce
On Saturday, 8 January 2022 at 13:23:52 UTC, Imperatorn wrote: On Saturday, 8 January 2022 at 02:07:10 UTC, Ali Çehreli wrote: 1) After about three years, I finally added copy constructors: http://ddili.org/ders/d.en/special_functions.html#ix_special_functions.copy%20constructor [...]

Re: Added copy constructors to "Programming in D"

2022-01-08 Thread vit via Digitalmars-d-announce
On Saturday, 8 January 2022 at 16:24:03 UTC, Ali Çehreli wrote: On 1/8/22 5:49 AM, Stanislav Blinov wrote: >> Of course, now I stress that postblit is discouraged. > > Bit early, methinks. Copy ctors aren't even fully supported by the > runtime yet. Thanks. The spec discourages postblit as

Re: Added copy constructors to "Programming in D"

2022-01-08 Thread Stanislav Blinov via Digitalmars-d-announce
On Saturday, 8 January 2022 at 16:24:03 UTC, Ali Çehreli wrote: On 1/8/22 5:49 AM, Stanislav Blinov wrote: >> Of course, now I stress that postblit is discouraged. > > Bit early, methinks. Copy ctors aren't even fully supported by the > runtime yet. Thanks. The spec discourages postblit as

Re: Added copy constructors to "Programming in D"

2022-01-08 Thread Ali Çehreli via Digitalmars-d-announce
On 1/8/22 5:49 AM, Stanislav Blinov wrote: >> Of course, now I stress that postblit is discouraged. > > Bit early, methinks. Copy ctors aren't even fully supported by the > runtime yet. Thanks. The spec discourages postblit as well. What's the best of saying it then? Something like "There are

Re: Added copy constructors to "Programming in D"

2022-01-08 Thread Ferhat Kurtulmuş via Digitalmars-d-announce
On Saturday, 8 January 2022 at 02:07:10 UTC, Ali Çehreli wrote: 1) After about three years, I finally added copy constructors: http://ddili.org/ders/d.en/special_functions.html#ix_special_functions.copy%20constructor [...] Good to see you keep it up to date.

Re: Added copy constructors to "Programming in D"

2022-01-08 Thread Stanislav Blinov via Digitalmars-d-announce
On Saturday, 8 January 2022 at 02:07:10 UTC, Ali Çehreli wrote: 1) After about three years, I finally added copy constructors: http://ddili.org/ders/d.en/special_functions.html#ix_special_functions.copy%20constructor Of course, now I stress that postblit is discouraged. Bit early, methinks.

Re: Added copy constructors to "Programming in D"

2022-01-08 Thread Imperatorn via Digitalmars-d-announce
On Saturday, 8 January 2022 at 02:07:10 UTC, Ali Çehreli wrote: 1) After about three years, I finally added copy constructors: http://ddili.org/ders/d.en/special_functions.html#ix_special_functions.copy%20constructor [...] Splendid! Will the physical book also be updated? Thanks!

Re: Added copy constructors to "Programming in D"

2022-01-07 Thread Tejas via Digitalmars-d-announce
On Saturday, 8 January 2022 at 02:07:10 UTC, Ali Çehreli wrote: 1) After about three years, I finally added copy constructors: http://ddili.org/ders/d.en/special_functions.html#ix_special_functions.copy%20constructor [...] Thank you very much for creating and maintaining such an amazing

Added copy constructors to "Programming in D"

2022-01-07 Thread Ali Çehreli via Digitalmars-d-announce
1) After about three years, I finally added copy constructors: http://ddili.org/ders/d.en/special_functions.html#ix_special_functions.copy%20constructor Of course, now I stress that postblit is discouraged. 2) The other noteworthy change in the book is my now-different stance on variables: