Re: DIP1000
On Thursday, 30 June 2022 at 19:56:38 UTC, Loara wrote: The deduction can happen even if you don't use `scope` attribute. I don't understand what you mean, it could, but it doesn't. And if it did then you would not need `scope`… When you use `scope` attribute you're saying to compiler "You have to allocate this object on the stack, don't try to use heap allocation". These are function pointer parameters, how could it trigger allocation on the heap? If you want to let compiler to decide what is the best approach then don't use `scope`. But that doesn't work. So `scope int v;` is equal to `int v;` since `v` is not a pointer, whereas `scope int *p` is different from `int *v;` since the latter can't point to stack allocated integers. This is the difference. No, the latter can most certainly point to any integer. It is just that scope/scope ref/return ref is to be checked in @safe. Unfortunately it is way too limiting. Even standard flow typing appears to be as strong or stronger. Since stack allocated objects are destroyed in the reverse order allowing a recursive `scope` attribute is a bit dangerous as you can see in the following example: If there are destructors then you can think of each stack allocated variable as introducing a invisible scope, but the compiler can keep track of this easily. So the compiler knows the ordering. So if my function imposes and order on the lifetimes of the parameters, then the compiler should be able to check that the ordering constraint is satisfied. Again if you want to let the compiler to deduce then don't use `scope`. But then it won't compile at all in @safe!
Re: DIP1000
On Tuesday, 28 June 2022 at 21:58:48 UTC, Ola Fosheim Grøstad wrote: Not when connect returns, but the scope that connect was called from. Still, this can be deduced, you just have to give the scopes an ordering. The deduction can happen even if you don't use `scope` attribute. When you use `scope` attribute you're saying to compiler "You have to allocate this object on the stack, don't try to use heap allocation". If you want to let compiler to decide what is the best approach then don't use `scope`. Well, that is a flaw, if the object is stack allocated then the fields are too. No because: `scope` variable === the variable is a pointer/reference that points to stack allocated data So `scope int v;` is equal to `int v;` since `v` is not a pointer, whereas `scope int *p` is different from `int *v;` since the latter can't point to stack allocated integers. This is the difference. Since stack allocated objects are destroyed in the reverse order allowing a recursive `scope` attribute is a bit dangerous as you can see in the following example: ```d struct A{ int *i; ~this(){ writeln(*i); } } ... { A a; int i = 2; ... scope int *j = &i; scope A *b = &a; (*b).i = j; } // i is destroyed before a ``` The compiler could easily deduce it. It is not difficult to see what the life time constraint must be. Again if you want to let the compiler to deduce then don't use `scope`.
Re: ePub/Mobi/AZW3/PDF of Phobos Runtime Library
On Thursday, 30 June 2022 at 11:00:09 UTC, Sergey wrote: On Tuesday, 28 June 2022 at 18:42:11 UTC, Marcone wrote: [...] Hi there! First of all at page of Language reference is available Mobi version https://dlang.org/spec/spec.html Also please check this thread https://forum.dlang.org/post/qkxtppiaobehdjoro...@forum.dlang.org There are plenty of links and resources: https://d-apt.sourceforge.io/ https://devdocs.io/d/ I believe almost everything is ready, someone just should bring it all together and put the up2date links on official web-site in “Offline documentation” page Have a nice day D-community! Devdocs of Dlang Phobos library to ePub/Mobi/AZW3/PDF will be a dream come true.
vibe.d community/forum/whatever ?
https://forum.dlang.org/post/gbpasireizpjfifmq...@forum.dlang.org On Monday, 30 August 2021 at 12:51:38 UTC, someone wrote: On Monday, 30 August 2021 at 10:37:38 UTC, Steven Schveighoffer wrote: It used to be moderated somewhat, but I think they gave up (99% of the messages were porn or spam). Why don't they shut down the forum instead ? It makes a terrible impression for newcomers -something akin to: naaah, this can't be a serious project. Agreed
Re: ePub/Mobi/AZW3/PDF of Phobos Runtime Library
On Tuesday, 28 June 2022 at 18:42:11 UTC, Marcone wrote: Beloved, I love programming in D. D is my favorite programming language. I'm not a professional programmer, but I love to program. I would like to learn D deeply. Most programming languages have a PDF/CHM/MOBI/ePub version of the standard library. But D still doesn't have such a portable version of the Phobos Runtime Library. I humbly ask you to make available a portable version of the Phobos library, to better disseminate the D programming language. Thank you Hi there! First of all at page of Language reference is available Mobi version https://dlang.org/spec/spec.html Also please check this thread https://forum.dlang.org/post/qkxtppiaobehdjoro...@forum.dlang.org There are plenty of links and resources: https://d-apt.sourceforge.io/ https://devdocs.io/d/ I believe almost everything is ready, someone just should bring it all together and put the up2date links on official web-site in “Offline documentation” page Have a nice day D-community!