Re: DIP1000

2022-06-28 Thread bauss via Digitalmars-d-learn
On Tuesday, 28 June 2022 at 21:58:48 UTC, Ola Fosheim Grøstad 
wrote:


not-scoped variable (`a.next` is not `scope` since this 
attribute is not transitive)


Well, that is a flaw, if the object is stack allocated then the 
fields are too.




Not necessarily, especially if the fields aren't value types. You 
can have stack allocated "objects" with pointers to heap 
allocated memory (heap allocated "objects".)


You can't, or rather you shouldn't have stack allocated fields 
within heap allocated "objects" however; as that will almost be 
guaranteed to lead to problems. I believe it's possible, but one 
should always refrain from it, but the same isn't true the for 
stack allocated "objects" with heap allocated fields.


Ex. from your example then even if the "node struct" you pass was 
allocated on the stack, then the memory the "next" pointer points 
to might not be allocated same place.


Unless I'm misunderstanding what you're trying to say.


Re: DIP1000

2022-06-28 Thread Ola Fosheim Grøstad via Digitalmars-d-learn

On Tuesday, 28 June 2022 at 21:40:44 UTC, Loara wrote:
When `connect()` returns may happen that `b` is destroyed but 
`a` not, so `a.next` contains a dangling pointer that


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.



not-scoped variable (`a.next` is not `scope` since this 
attribute is not transitive)


Well, that is a flaw, if the object is stack allocated then the 
fields are too.


is clearly dangerous since `connect` doesn't know which between 
`a` and `b` terminates first.


The compiler could easily deduce it. It is not difficult to see 
what the life time constraint must be.




Re: DIP1000

2022-06-28 Thread Loara via Digitalmars-d-learn
On Friday, 24 June 2022 at 18:31:14 UTC, Ola Fosheim Grøstad 
wrote:
The objects are in the calling function, not in the connect() 
function. So they are not destroyed when the connect() function 
returns.


When `connect()` returns may happen that `b` is destroyed but `a` 
not, so `a.next` contains a dangling pointer that will bring 
potential segmentation faults that could be detected only with 
tools like Valgrind, just consider


```d
node * calling(return scope node * a) @safe{
  scope node *b = new node(); //b is stack allocated
  connect(a, b);
  return a;
  //b destroyed but a not
}
```

The `scope` attribute tries to avoid these events preventing you 
from doing something potentially dangerous with stack allocated 
objects, and assigning a `scope` pointer to a not-scoped variable 
(`a.next` is not `scope` since this attribute is not transitive) 
is clearly dangerous since `connect` doesn't know which between 
`a` and `b` terminates first.





Re: ePub/Mobi/AZW3/PDF of Phobos Runtime Library

2022-06-28 Thread forkit via Digitalmars-d-learn

On Tuesday, 28 June 2022 at 21:14:42 UTC, Marcone wrote:
Is there any way to do this automatically like Python? 
https://docs.python.org/3/download.html


Of course there is. But someone has to volunteer their time and 
effort to do it ;-)


Re: ePub/Mobi/AZW3/PDF of Phobos Runtime Library

2022-06-28 Thread Marcone via Digitalmars-d-learn
Is there any way to do this automatically like Python? 
https://docs.python.org/3/download.html


Re: ePub/Mobi/AZW3/PDF of Phobos Runtime Library

2022-06-28 Thread Marcone via Digitalmars-d-learn

On Tuesday, 28 June 2022 at 20:38:10 UTC, forkit wrote:

On Tuesday, 28 June 2022 at 18:42:11 UTC, Marcone wrote:

[...]


So assuming i understand what you're asking for here, it 
already exists.


When you download D, you get a directory named 'html'.

In that directory is a file named 'index.html'.

Is that what you want? (see the Documentation menu at the top 
of the index.html)


The only problem with that, is that it downloads fonts, so you 
need access to the internet. It will still work fine without 
access, but it will default to a font that isn't particulary 
nice on the eyes.


I wish I could read D's entire Phobos library on my Kindle ebook 
reader.


Re: ePub/Mobi/AZW3/PDF of Phobos Runtime Library

2022-06-28 Thread Marcone via Digitalmars-d-learn
On Tuesday, 28 June 2022 at 19:06:48 UTC, Steven Schveighoffer 
wrote:

On 6/28/22 2:42 PM, Marcone wrote:

[...]


We used to have this, it wasn't used, and keeping it building 
was a drain on resources. What is wrong with the online docs? 
What dissemination do you think could happen if we had it in 
these formats that's going to reach people more than the HTML 
version?


Note that the zipfile has a complete copy of the documentation 
in html format.


-Steve


I wish I could read all the documentation for D on my Kindle 
ebook reader.


Re: ePub/Mobi/AZW3/PDF of Phobos Runtime Library

2022-06-28 Thread forkit via Digitalmars-d-learn

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


So assuming i understand what you're asking for here, it already 
exists.


When you download D, you get a directory named 'html'.

In that directory is a file named 'index.html'.

Is that what you want? (see the Documentation menu at the top of 
the index.html)


The only problem with that, is that it downloads fonts, so you 
need access to the internet. It will still work fine without 
access, but it will default to a font that isn't particulary nice 
on the eyes.




Re: ePub/Mobi/AZW3/PDF of Phobos Runtime Library

2022-06-28 Thread Steven Schveighoffer via Digitalmars-d-learn

On 6/28/22 2:42 PM, Marcone wrote:
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.


We used to have this, it wasn't used, and keeping it building was a 
drain on resources. What is wrong with the online docs? What 
dissemination do you think could happen if we had it in these formats 
that's going to reach people more than the HTML version?


Note that the zipfile has a complete copy of the documentation in html 
format.


-Steve


ePub/Mobi/AZW3/PDF of Phobos Runtime Library

2022-06-28 Thread Marcone via Digitalmars-d-learn

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


Re: Fetching licensing info for all dependencies of a DUB project

2022-06-28 Thread Guillaume Piolat via Digitalmars-d-learn

On Monday, 27 June 2022 at 21:36:31 UTC, Christian Köstlin wrote:


I played around with the idea and came up with a small dub 
package, that is not (yet) uploaded to the dub registry.
Source is available at 
https://github.com/gizmomogwai/packageinfo, feedback very 
welcome.



I've done something similar not for licences but for code amount, 
to extract from a DUB project:

 - DUB packages used by project
 - source files used by project
 - and their LOC count

This is a D forums exclusive:
https://pastebin.com/RFbFCgR2

Keep your debt in check!