Re: dlist for phobos
Andrei: I'm also undecided on what to do about sealing, and again language improvements (preventing escapes of references) could lead to improved designs. Language improvements need to be understood, desired, designed, and then implemented and debugged, so what kind of syntax and semantics are you thinking about? Bye, bearophile
Re: dlist for phobos
On 1/27/11 3:25 AM, bearophile wrote: Andrei: I'm also undecided on what to do about sealing, and again language improvements (preventing escapes of references) could lead to improved designs. Language improvements need to be understood, desired, designed, and then implemented and debugged, so what kind of syntax and semantics are you thinking about? Bye, bearophile ref returns should be guaranteed to never escape. Andrei
Re: dlist for phobos
Andrei Alexandrescu napisał: ref returns should be guaranteed to never escape. Should meaning they're not guaranteed now? I'm curious in what scenarios they escape. -- Tomek
Re: dlist for phobos
On 1/27/11 4:48 PM, Tomek Sowiński wrote: Andrei Alexandrescu napisał: ref returns should be guaranteed to never escape. Should meaning they're not guaranteed now? I'm curious in what scenarios they escape. Any function can take the address of a reference (either a ref parameter or the result of another function) and squirrel it away. Andrei
Re: dlist for phobos
Andrei Alexandrescu napisał: On 1/27/11 4:48 PM, Tomek Sowiński wrote: Andrei Alexandrescu napisał: ref returns should be guaranteed to never escape. Should meaning they're not guaranteed now? I'm curious in what scenarios they escape. Any function can take the address of a reference (either a ref parameter or the result of another function) and squirrel it away. Jeez.. I must've had some brain-warp that I didn't think of r.front :-) But is just banning taking addresses of ref parameters and return values going to solve the problem? Sounds delusively simple... -- Tomek
Re: dlist for phobos
On 2011-01-27 17:52:27 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org said: On 1/27/11 4:48 PM, Tomek Sowiński wrote: Andrei Alexandrescu napisał: ref returns should be guaranteed to never escape. Should meaning they're not guaranteed now? I'm curious in what scenarios they escape. Any function can take the address of a reference (either a ref parameter or the result of another function) and squirrel it away. Even in @safe mode? Being able to take the address of a ref in non-safe code seems normal to me. That said, you don't need to take the address of anything to escape a ref: ref int test() { int i; return pass(i); } ref int pass(ref int i) { return i; } Now, consider that instead of 'int i' you have a container with deterministic destruction: ref int test() { Container!int a; return a[0]; } Same problem. -- Michel Fortin michel.for...@michelf.com http://michelf.com/
dlist for phobos
Are there plans for including a double linked list in phobos? Maybe one backed by an array like .NET's ListT or Java's ArrayList. If so, when? Thanks
Re: dlist for phobos
On Wednesday, January 26, 2011 15:34:05 %u wrote: Are there plans for including a double linked list in phobos? Maybe one backed by an array like .NET's ListT or Java's ArrayList. If so, when? Array is the equivalent of Java's ArrayList. It's Java's LinkedList which is a doubly-linked list. You don't normally use arrays to implement linked lists. We do have a _singly_-linked list - SList - but not doubly-linked list at the moment. I'd be stunned if Andrei doesn't intend to add one at some point though. However, std.container was slow in coming, and it's been slow in growing. - Jonathan M Davis
Re: dlist for phobos
On 1/26/11 6:20 PM, Jonathan M Davis wrote: On Wednesday, January 26, 2011 15:34:05 %u wrote: Are there plans for including a double linked list in phobos? Maybe one backed by an array like .NET's ListT or Java's ArrayList. If so, when? Array is the equivalent of Java's ArrayList. It's Java's LinkedList which is a doubly-linked list. You don't normally use arrays to implement linked lists. We do have a _singly_-linked list - SList - but not doubly-linked list at the moment. I'd be stunned if Andrei doesn't intend to add one at some point though. However, std.container was slow in coming, and it's been slow in growing. - Jonathan M Davis One big issue with std.container is that the absence of unified function call syntax forces the implementation to add a lot of aliases. I'm sort of stalling in hope that language improvements will prompt terser container implementations. I'm also undecided on what to do about sealing, and again language improvements (preventing escapes of references) could lead to improved designs. That being said, a doubly-linked list is an obvious candidate as the next significant container to put in std.container. Andrei
Re: dlist for phobos
On Wed, 26 Jan 2011 18:34:05 -0500, %u e...@ee.com wrote: Are there plans for including a double linked list in phobos? Maybe one backed by an array like .NET's ListT or Java's ArrayList. If so, when? http://www.dsource.org/projects/dcollections LinkList there is doubly-linked. Sorry, I don't have online docs yet for the d2 version... *kicks self* -Steve