November 10, 2012 Re: Compilable Recursive Data Structure ( was: Recursive data structure using template won't compile) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | Nick Sabalausky wrote:
> But the OP was never trying to do anything like that.
See digitalmars.D.learn:40991
-manfred
|
November 10, 2012 Re: Compilable Recursive Data Structure ( was: Recursive data structure using template won't compile) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | On Sat, 10 Nov 2012 10:33:39 +0000 (UTC) Manfred Nowak <svv1999@hotmail.com> wrote: > Nick Sabalausky wrote: > > > I really don't see the relevance > > Please look at the definition of R: > struct R > { > int value; > d_list!R Rlist; > } > > If no recursion was wanted the OP should have written: > d_list!(R*) Rlist; > Ok, I see what you're saying, but you're mistaken: That line "d_list!R Rlist;" is not a problematic recursion. Imagine if d_list had been defined like this: struct d_list(T) { int i; } Then would this still be problematic recursion?: struct R { d_list!R Rlist; } No, because R is never actually used anywhere in that d_list (only int is used). In this case, R is nothing more that part of the *name* of a particular instantiation of the d_list template. And indeed, just like the above example, the OP's definition of d_list also does *not* use R: struct d_list( T ) { node* head; node* tail; } Now, yes, that "node" type does use R (instead of R*), *but* "head" and "tail" are merely pointers to "node", so it's ok. > In digitalmars.D.learn:40990 I already asked for an explanation. > Actually, my newsreader is kinda shitty, and (AFAIK) doesn't give me any way to lookup a message by ID, so I'm not really sure which message you're referring to :/ |
November 10, 2012 Re: Compilable Recursive Data Structure ( was: Recursive data structure using template won't compile) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | On 11/10/2012 10:12 AM, Manfred Nowak wrote:
> Timon Gehr wrote:
>
>> In theory yes, but
> [...]
>
> What a pity. Because in the code given only the types Elem!0 and Elem!1
> must be indeed initialized.
> ...
In this specific case, yes. But as this is an undecidable property in general, detecting and exploiting it would merely be an optimization that cannot generally be relied upon. Depending on how powerful it is, it would slow down analysis most of the time. Furthermore, I do not see use cases. I'll look into it when the front end is finished though.
|
November 10, 2012 Re: Compilable Recursive Data Structure ( was: Recursive data structure using template won't compile) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | Timon Gehr wrote:
> But as this is an undecidable property in general
I do not see, that the compiler has to solve the general case--- at least when compiling monolithic code and the executable is only allowed to use types which are initialized at compile time.
Upon using several modules the modules might follow some restrictions and I am currently not able to specify that restrictions.
-manfred
|
November 10, 2012 Re: Compilable Recursive Data Structure ( was: Recursive data structure using template won't compile) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | On 11/09/12 23:45, Timon Gehr wrote:
> On 11/09/2012 10:24 PM, Philippe Sigaud wrote:
>>
>> Timon:
>>
>> The D front end I am developing can already handle it.
>>
>>
>> Developed in D, I suppose?
>>
>
> Yes.
Public? License? URL?
artur
|
November 11, 2012 Re: Compilable Recursive Data Structure ( was: Recursive data structure using template won't compile) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | Nick Sabalausky wrote:
> *but* "head" and "tail" are merely pointers to "node"
Thank you. I do recognize now, that my flow of thought stopped at the same point at which the flow of control of the compiler stopped.
-manfred
|
November 12, 2012 Re: Compilable Recursive Data Structure ( was: Recursive data structure using template won't compile) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rob T | On 10/11/12 08:53, Rob T wrote:
> On Saturday, 10 November 2012 at 06:09:41 UTC, Nick Sabalausky wrote:
>> I've gone ahead and filed a minimized test case, and also included your
>> workaround:
>> http://d.puremagic.com/issues/show_bug.cgi?id=8990
>>
>> I didn't make that one struct nested since that's not needed to
>> reproduce the error.
>
> Thanks for filing it.
>
> Looking at the bug reports, there's 2000+ unresolved? Yikes.
>
> --rt
Yeah. Though note that 1000 bug reports are from bearophile.
|
November 12, 2012 Re: Compilable Recursive Data Structure ( was: Recursive data structure using template won't compile) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston | > > Yeah. Though note that 1000 bug reports are from bearophile. Well, at least he's persistent. -- Using Opera's revolutionary email client: http://www.opera.com/mail/ |
November 12, 2012 Re: Compilable Recursive Data Structure ( was: Recursive data structure using template won't compile) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston | On 11/12/12, Don Clugston <dac@nospam.com> wrote: > Yeah. Though note that 1000 bug reports are from bearophile. Actually only around 300 remain open: http://d.puremagic.com/issues/buglist.cgi?query_format=advanced&emailreporter2=1&emailtype2=substring&order=Importance&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=VERIFIED&email2=bearophile&component=DMD&product=D |
November 12, 2012 Re: Compilable Recursive Data Structure ( was: Recursive data structure using template won't compile) | ||||
---|---|---|---|---|
| ||||
On 11/12/12, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote: > On 11/12/12, Don Clugston <dac@nospam.com> wrote: >> Yeah. Though note that 1000 bug reports are from bearophile. > > Actually only around 300 remain open: http://d.puremagic.com/issues/buglist.cgi?query_format=advanced&emailreporter2=1&emailtype2=substring&order=Importance&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=VERIFIED&email2=bearophile > Oh wait, that's only for DMD. It's 559 in total: http://d.puremagic.com/issues/buglist.cgi?query_format=advanced&emailreporter2=1&emailtype2=substring&order=Importance&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=VERIFIED&email2=bearophile |
Copyright © 1999-2021 by the D Language Foundation