Jump to page: 1 2 3
Thread overview
Added copy constructors to "Programming in D"
Jan 08, 2022
Ali Çehreli
Jan 08, 2022
Tejas
Jan 08, 2022
Imperatorn
Jan 13, 2022
Andrea Fontana
Jan 27, 2022
Ali Çehreli
Jan 27, 2022
Imperatorn
Jan 08, 2022
Stanislav Blinov
Jan 08, 2022
Ali Çehreli
Jan 08, 2022
Stanislav Blinov
Jan 08, 2022
vit
Jan 08, 2022
Ferhat Kurtulmuş
Feb 09, 2022
Anonymouse
Feb 09, 2022
Ali Çehreli
Feb 09, 2022
H. S. Teoh
Feb 10, 2022
Meta
Feb 10, 2022
Ali Çehreli
Feb 10, 2022
Mathias LANG
Feb 10, 2022
Walter Bright
Feb 10, 2022
Walter Bright
Feb 10, 2022
Meta
Feb 11, 2022
bauss
Feb 11, 2022
Abdulhaq
Feb 10, 2022
Elronnd
January 07, 2022
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: Now I recommend 'const' over 'immutable' for variables. And I favor 'in' for parameters over 'const'. (Unfortunately, not all code in the book follow those guidelines.)

And I recommend the -preview=in command line switch:


http://ddili.org/ders/d.en/function_parameters.html#ix_function_parameters.in,%20parameter

3) I've updated all electronic formats: PDF, EPUB, AZW3, and MOBI:

  http://ddili.org/ders/d.en/

I had some trouble with ebooks in the past: The fonts would not work and table of contents would not be generated. Please let me know if you see something wrong.

WARNING: The paper book publishers are not updated yet. If you order a paper book now, you will get the old book. (I think from December 2020.)

Ali
January 08, 2022

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 resource for newcomers to D and programming in general :D

January 08, 2022
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!
January 08, 2022
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. Copy ctors aren't even fully supported by the runtime yet.


January 08, 2022
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.
January 08, 2022
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 still limitations of copy constructors as of this writing." Or there are just bugs?

Ali

January 08, 2022
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 well. What's the best of saying it then? Something like "There are still limitations of copy constructors as of this writing." Or there are just bugs?
>
> Ali

They are all, most certainly, bugs. But they're there ever since copy ctors have been introduced, and with no clear perspective on when they're going to be fixed. Some are pretty nasty - https://issues.dlang.org/show_bug.cgi?id=22614 . Spec recommending to switch to copy ctors is... dubious - what's the point if you can't even dup an array correctly?..

Maybe something like "Support for copy constructors hasn't been fully integrated into the D runtime library yet"?
January 08, 2022

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 well. What's the best of saying it then? Something like "There are still limitations of copy constructors as of this writing." Or there are just bugs?

Ali

Bugs, for example:

When appending to dynamic array reallocate memory, then copy ctors are ignored.

Assignment of static arrays doesn't call copy constructor for elements.

dup/idup doesn't call copy constructors...

This is necessary to fix it:
[SAoC 2021] Replace druntime Hooks with Templates https://forum.dlang.org/thread/flwjoxilxfpvdjheehdg@forum.dlang.org

January 13, 2022
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
>>
>> [...]
>
> Splendid!
>
> Will the physical book also be updated?
>
> Thanks!

I don't think it is possible. You have to buy a new copy when published. /s
January 14, 2022
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 be updated?
>>
>> Thanks!
>
> I don't think it is possible. You have to buy a new copy when published. /s

🤣🤣🤣
« First   ‹ Prev
1 2 3