Re: Can non-nullable references be implemented as a library?

2010-11-08 Thread Andrei Alexandrescu
On 11/7/10 11:34 PM, spir wrote: On Sun, 07 Nov 2010 19:12:02 -0600 Andrei Alexandrescu wrote: On 11/7/10 1:54 PM, retard wrote: Sun, 07 Nov 2010 19:39:09 +0200, so wrote: Andrei's stance is, either a library addon or ship D without that feature. D's library already contains both tuples and

Re: Can non-nullable references be implemented as a library?

2010-11-08 Thread Adam Burton
Kagamin wrote: > Adam Burton Wrote: > >> The above seems correct to me. You are assigning a nullable to a non- >> nullable so you force the user to assess that is correct and provide an >> override. Based on that I've had a crack at this myself. > > This becomes not just an annotation, but anoth

Re: Can non-nullable references be implemented as a library?

2010-11-08 Thread Jonathan M Davis
On Sunday, November 07, 2010 18:42:08 Adam Burton wrote: > 1. Default struct constructor. > This means the NN can be created without assigning a value. I have tried to > get around this issue somewhat by adding a null check in the invariant but > it seems the invariant is not called when using the

Re: Can non-nullable references be implemented as a library?

2010-11-08 Thread Kagamin
so Wrote: > > This way or another, you need a null check. Why extra syntax? > > This is also how it is done in those languages no? > They also have null checks at every assignment, but since compiler puts > those lines, you don't know anything. > > Maybe this is not what you mean? Do you care

Re: Can non-nullable references be implemented as a library?

2010-11-08 Thread so
This way or another, you need a null check. Why extra syntax? This is also how it is done in those languages no? They also have null checks at every assignment, but since compiler puts those lines, you don't know anything. Maybe this is not what you mean? -- Using Opera's revolutionary emai

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread spir
On Sun, 07 Nov 2010 18:12:50 -0500 bearophile wrote: > retard: > > > I bet even the basic class/interface/exception system of D is too complex > > to explain for some members of the audience. You can't assume that the > > same people who *use* the language can/want to understand the > > imple

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread Kagamin
Adam Burton Wrote: > The above seems correct to me. You are assigning a nullable to a non- > nullable so you force the user to assess that is correct and provide an > override. Based on that I've had a crack at this myself. This becomes not just an annotation, but another type. When you pass arg

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread spir
On Sun, 07 Nov 2010 19:12:02 -0600 Andrei Alexandrescu wrote: > On 11/7/10 1:54 PM, retard wrote: > > Sun, 07 Nov 2010 19:39:09 +0200, so wrote: > > > >>> Andrei's stance is, either a library addon or ship D without that > >>> feature. D's library already contains both tuples and algebraic data >

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread Walter Bright
Adam Burton wrote: Thoughts up to now? Am I barking up completely the wrong tree? I think it's a good start on figuring this out.

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread Adam Burton
Kagamin wrote: > Simen kjaeraas Wrote: > >> Worth adding: >> Even if non-null references/pointers cannot be perfectly implemented in a >> library, they may still be a worthwhile addition to Phobos, to mark >> function arguments and the like. > > Hmm... this doesn't work: > > struct NonNull(T) >

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread bearophile
Andrei: > This thread does have a good outcome: Walter will at least consider > improving flow analysis in constructors to support @disable'd default > constructors. That is the key improvement that allows NonNull as a library. Good :-) Bye, bearophile

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread Andrei Alexandrescu
On 11/7/10 1:54 PM, retard wrote: Sun, 07 Nov 2010 19:39:09 +0200, so wrote: Andrei's stance is, either a library addon or ship D without that feature. D's library already contains both tuples and algebraic data types. They're simple to use, almost like in Python. The reason for library addons

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread bearophile
retard: > I bet even the basic class/interface/exception system of D is too complex > to explain for some members of the audience. You can't assume that the > same people who *use* the language can/want to understand the > implementation of the features. You are right. The people that use the

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread retard
Sun, 07 Nov 2010 17:06:12 -0500, bearophile wrote: > retard: > >> There are these DIPs in wiki4d. Were they useful? At least it seems >> that this thread is leading nowhere. Half of the people don't know what >> non- nullable means. It's hard to trust this process when it seems to >> go nowhere.

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread bearophile
retard: > There are these DIPs in wiki4d. Were they useful? At least it seems that > this thread is leading nowhere. Half of the people don't know what non- > nullable means. It's hard to trust this process when it seems to go > nowhere. No one wants to validate the design decisions. If a langu

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread Andrei Alexandrescu
On 11/7/10 11:13 AM, Denis Koroskin wrote: Since many people think that non-nullable references can be implemented as a library and thus don't belong to core language, I've decided to show that it is in fact impossible to do so. Changes are necessary to constructors. Andrei

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread retard
Sun, 07 Nov 2010 19:39:09 +0200, so wrote: >> Andrei's stance is, either a library addon or ship D without that >> feature. D's library already contains both tuples and algebraic data >> types. They're simple to use, almost like in Python. The reason for >> library addons isn't that builtin featur

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread Kagamin
Simen kjaeraas Wrote: > Worth adding: > Even if non-null references/pointers cannot be perfectly implemented in a > library, they may still be a worthwhile addition to Phobos, to mark > function arguments and the like. Hmm... this doesn't work: struct NonNull(T) { T value; this(T

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread bearophile
so: > Also It is not only Andrei, every single people here agreed on stopping > "lets add this new feature to D today". What's stopped is adding features to D2, but I have meant nonull types for D3. I don't think D evolution is finished right now. On the other hand new features add complexity

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread so
Andrei's stance is, either a library addon or ship D without that feature. D's library already contains both tuples and algebraic data types. They're simple to use, almost like in Python. The reason for library addons isn't that builtin features make less sense, the reason is that TDPL is a

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread Denis Koroskin
On Sun, 07 Nov 2010 20:21:49 +0300, steveh wrote: Andrei's stance is, either a library addon or ship D without that feature. D's library already contains both tuples and algebraic data types. They're simple to use, almost like in Python. The reason for library addons isn't that builtin fea

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread Simen kjaeraas
Simen kjaeraas wrote: Denis Koroskin <2kor...@gmail.com> wrote: Since many people think that non-nullable references can be implemented as a library and thus don't belong to core language, I've decided to show that it is in fact impossible to do so. How do you enforce the following behav

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread steveh
Denis Koroskin Wrote: > Since many people think that non-nullable references can be implemented as > a library and thus don't belong to core language, I've decided to show > that it is in fact impossible to do so. > > How do you enforce the following behavior: > > class Foo > { > this()

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread Simen kjaeraas
Denis Koroskin <2kor...@gmail.com> wrote: Since many people think that non-nullable references can be implemented as a library and thus don't belong to core language, I've decided to show that it is in fact impossible to do so. How do you enforce the following behavior: [snip] Without su

Can non-nullable references be implemented as a library?

2010-11-07 Thread Denis Koroskin
Since many people think that non-nullable references can be implemented as a library and thus don't belong to core language, I've decided to show that it is in fact impossible to do so. How do you enforce the following behavior: class Foo { this() { // error: variable nonNull