www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Invariant -- question #2

reply "Bill Baxter" <wbaxter gmail.com> writes:
Does using immutable for things that won't change mean that the
compiler will eventually revert back to accepting the D1 function-like
syntax for class invariants?

I.e.
  invariant() {  some stuff  }
Instead of
  invariant { some stuff }

Not a huge deal for me.  I was just curious.  I seem to remember
people saying this was one thing that made it hard to write code that
is portable between D1 and D2.

--bb
Oct 20 2008
next sibling parent reply KennyTM~ <kennytm gmail.com> writes:
Bill Baxter wrote:
 Does using immutable for things that won't change mean that the
 compiler will eventually revert back to accepting the D1 function-like
 syntax for class invariants?
 
 I.e.
   invariant() {  some stuff  }
 Instead of
   invariant { some stuff }
 
 Not a huge deal for me.  I was just curious.  I seem to remember
 people saying this was one thing that made it hard to write code that
 is portable between D1 and D2.
 
 --bb

but invariant() { ... } is valid in D1 when D2 was released, isn't it?
Oct 21 2008
parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
Jarrett Billingsley wrote:

 On Tue, Oct 21, 2008 at 9:25 AM, KennyTM~ <kennytm gmail.com> wrote:
 Bill Baxter wrote:
 Does using immutable for things that won't change mean that the
 compiler will eventually revert back to accepting the D1 function-like
 syntax for class invariants?

 I.e.
  invariant() {  some stuff  }
 Instead of
  invariant { some stuff }

 Not a huge deal for me.  I was just curious.  I seem to remember
 people saying this was one thing that made it hard to write code that
 is portable between D1 and D2.

 --bb

but invariant() { ... } is valid in D1 when D2 was released, isn't it?

Erm... I was going to say "no" but it does indeed compile. In fact the D1 spec even shows it. Walter, why was this never mentioned or announced?

It was changed when invariant was introduced to D2 as to make a transition path ... I think it was announced too. -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango
Oct 21 2008
next sibling parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
Jarrett Billingsley wrote:
 On Tue, Oct 21, 2008 at 11:14 AM, Lars Ivar Igesund
 <larsivar igesund.net> wrote:
 It was changed when invariant was introduced to D2 as to make a transition
 path ... I think it was announced too.

I can't find anything about it in the changelog, but maybe it was buried in the newsgroups somewhere. W has a habit of not announcing important changes until three months later when he mentions it in passing in a reply as if everyone knew about it.

Does anyone know about =this() { } ?
Oct 21 2008
next sibling parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
Denis Koroskin wrote:
 On Tue, 21 Oct 2008 21:18:22 +0400, Ary Borenszweig 
 <ary esperanto.org.ar> wrote:
 
 Jarrett Billingsley wrote:
 On Tue, Oct 21, 2008 at 11:14 AM, Lars Ivar Igesund
 <larsivar igesund.net> wrote:
 It was changed when invariant was introduced to D2 as to make a 
 transition
 path ... I think it was announced too.

buried in the newsgroups somewhere. W has a habit of not announcing important changes until three months later when he mentions it in passing in a reply as if everyone knew about it.

Does anyone know about =this() { } ?

Looks like a new/alternative syntax for struct postblitting (works in DMD2.019, too).

Yes, it's exactly that, but I didn't see it announced anywhere.
Oct 21 2008
parent reply Max Samukha <samukha voliacable.com.removethis> writes:
On Tue, 21 Oct 2008 15:46:47 -0200, Ary Borenszweig
<ary esperanto.org.ar> wrote:

Denis Koroskin wrote:
 On Tue, 21 Oct 2008 21:18:22 +0400, Ary Borenszweig 
 <ary esperanto.org.ar> wrote:
 
 Jarrett Billingsley wrote:
 On Tue, Oct 21, 2008 at 11:14 AM, Lars Ivar Igesund
 <larsivar igesund.net> wrote:
 It was changed when invariant was introduced to D2 as to make a 
 transition
 path ... I think it was announced too.

buried in the newsgroups somewhere. W has a habit of not announcing important changes until three months later when he mentions it in passing in a reply as if everyone knew about it.

Does anyone know about =this() { } ?

Looks like a new/alternative syntax for struct postblitting (works in DMD2.019, too).

Yes, it's exactly that, but I didn't see it announced anywhere.

Isn't it aesthetically repulsive? :)
Oct 21 2008
parent Ary Borenszweig <ary esperanto.org.ar> writes:
Max Samukha wrote:
 On Tue, 21 Oct 2008 15:46:47 -0200, Ary Borenszweig
 <ary esperanto.org.ar> wrote:
 
 Denis Koroskin wrote:
 On Tue, 21 Oct 2008 21:18:22 +0400, Ary Borenszweig 
 <ary esperanto.org.ar> wrote:

 Jarrett Billingsley wrote:
 On Tue, Oct 21, 2008 at 11:14 AM, Lars Ivar Igesund
 <larsivar igesund.net> wrote:
 It was changed when invariant was introduced to D2 as to make a 
 transition
 path ... I think it was announced too.

buried in the newsgroups somewhere. W has a habit of not announcing important changes until three months later when he mentions it in passing in a reply as if everyone knew about it.

=this() { } ?

DMD2.019, too).


Isn't it aesthetically repulsive? :)

Well, since struct postblitting is performed when you do: foo = bar; =this() makes much more sense than this(this)...
Oct 21 2008
prev sibling next sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Denis Koroskin wrote:
 On Tue, 21 Oct 2008 21:18:22 +0400, Ary Borenszweig 
 <ary esperanto.org.ar> wrote:
 
 Jarrett Billingsley wrote:
 On Tue, Oct 21, 2008 at 11:14 AM, Lars Ivar Igesund
 <larsivar igesund.net> wrote:
 It was changed when invariant was introduced to D2 as to make a 
 transition
 path ... I think it was announced too.

buried in the newsgroups somewhere. W has a habit of not announcing important changes until three months later when he mentions it in passing in a reply as if everyone knew about it.

Does anyone know about =this() { } ?

Looks like a new/alternative syntax for struct postblitting (works in DMD2.019, too).

You may want to hold off on that one, we're revamping copy construction. Andrei
Oct 21 2008
prev sibling parent reply Bruno Medeiros <brunodomedeiros+spam com.gmail> writes:
Ary Borenszweig wrote:
 Jarrett Billingsley wrote:
 On Tue, Oct 21, 2008 at 11:14 AM, Lars Ivar Igesund
 <larsivar igesund.net> wrote:
 It was changed when invariant was introduced to D2 as to make a 
 transition
 path ... I think it was announced too.

I can't find anything about it in the changelog, but maybe it was buried in the newsgroups somewhere. W has a habit of not announcing important changes until three months later when he mentions it in passing in a reply as if everyone knew about it.

Does anyone know about =this() { } ?

I read diffs of the DDoc with each new D2 release, and it wasn't mentioned there, so it was probably unreleased, yeah. I wouldn't be surprised if there was more stuff like that. :P -- Bruno Medeiros - Software Developer, MSc. in CS/E graduate http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
Oct 22 2008
next sibling parent KennyTM~ <kennytm gmail.com> writes:
Bill Baxter wrote:
 On Wed, Oct 22, 2008 at 9:44 PM, Bruno Medeiros
 <brunodomedeiros+spam com.gmail> wrote:
 Ary Borenszweig wrote:
 Jarrett Billingsley wrote:
 On Tue, Oct 21, 2008 at 11:14 AM, Lars Ivar Igesund
 <larsivar igesund.net> wrote:
 It was changed when invariant was introduced to D2 as to make a
 transition
 path ... I think it was announced too.

buried in the newsgroups somewhere. W has a habit of not announcing important changes until three months later when he mentions it in passing in a reply as if everyone knew about it.

=this() { } ?

there, so it was probably unreleased, yeah. I wouldn't be surprised if there was more stuff like that. :P

That reminds me ... the foo.(bar) template instantation syntax was supposedly already implemented. I wonder if that's snuck into this release too? --bb

Oct 22 2008
prev sibling parent Bruno Medeiros <brunodomedeiros+spam com.gmail> writes:
Bill Baxter wrote:
 On Wed, Oct 22, 2008 at 9:44 PM, Bruno Medeiros
 <brunodomedeiros+spam com.gmail> wrote:
 Ary Borenszweig wrote:
 Jarrett Billingsley wrote:
 On Tue, Oct 21, 2008 at 11:14 AM, Lars Ivar Igesund
 <larsivar igesund.net> wrote:
 It was changed when invariant was introduced to D2 as to make a
 transition
 path ... I think it was announced too.

buried in the newsgroups somewhere. W has a habit of not announcing important changes until three months later when he mentions it in passing in a reply as if everyone knew about it.

=this() { } ?

there, so it was probably unreleased, yeah. I wouldn't be surprised if there was more stuff like that. :P

That reminds me ... the foo.(bar) template instantation syntax was supposedly already implemented. I wonder if that's snuck into this release too? --bb

It may have been implemented in some experimental internal release, but I got the impression that the whole idea about changing the template instantiation syntax was dropped altogether, so I don't think that's coming out. -- Bruno Medeiros - Software Developer, MSc. in CS/E graduate http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
Oct 22 2008
prev sibling parent ore-sama <spam here.lot> writes:
Jarrett Billingsley Wrote:

 I can't find anything about it in the changelog

http://www.digitalmars.com/d/2.0/features2.html
Oct 21 2008
prev sibling next sibling parent "Bill Baxter" <wbaxter gmail.com> writes:
On Tue, Oct 21, 2008 at 10:25 PM, KennyTM~ <kennytm gmail.com> wrote:
 Bill Baxter wrote:
 Does using immutable for things that won't change mean that the
 compiler will eventually revert back to accepting the D1 function-like
 syntax for class invariants?

 I.e.
  invariant() {  some stuff  }
 Instead of
  invariant { some stuff }

 Not a huge deal for me.  I was just curious.  I seem to remember
 people saying this was one thing that made it hard to write code that
 is portable between D1 and D2.

 --bb

but invariant() { ... } is valid in D1 when D2 was released, isn't it?

I'm not really sure what the deal is right now. Partly why I was asking. It's not a feature I use much, so I'm curious if the DbC fans think it should change back to the original syntax once it can. --bb
Oct 21 2008
prev sibling next sibling parent "Jarrett Billingsley" <jarrett.billingsley gmail.com> writes:
On Tue, Oct 21, 2008 at 9:25 AM, KennyTM~ <kennytm gmail.com> wrote:
 Bill Baxter wrote:
 Does using immutable for things that won't change mean that the
 compiler will eventually revert back to accepting the D1 function-like
 syntax for class invariants?

 I.e.
  invariant() {  some stuff  }
 Instead of
  invariant { some stuff }

 Not a huge deal for me.  I was just curious.  I seem to remember
 people saying this was one thing that made it hard to write code that
 is portable between D1 and D2.

 --bb

but invariant() { ... } is valid in D1 when D2 was released, isn't it?

Erm... I was going to say "no" but it does indeed compile. In fact the D1 spec even shows it. Walter, why was this never mentioned or announced?
Oct 21 2008
prev sibling next sibling parent "Jarrett Billingsley" <jarrett.billingsley gmail.com> writes:
On Tue, Oct 21, 2008 at 11:14 AM, Lars Ivar Igesund
<larsivar igesund.net> wrote:
 It was changed when invariant was introduced to D2 as to make a transition
 path ... I think it was announced too.

I can't find anything about it in the changelog, but maybe it was buried in the newsgroups somewhere. W has a habit of not announcing important changes until three months later when he mentions it in passing in a reply as if everyone knew about it.
Oct 21 2008
prev sibling next sibling parent "Denis Koroskin" <2korden gmail.com> writes:
On Tue, 21 Oct 2008 21:18:22 +0400, Ary Borenszweig <ary esperanto.org.ar>  
wrote:

 Jarrett Billingsley wrote:
 On Tue, Oct 21, 2008 at 11:14 AM, Lars Ivar Igesund
 <larsivar igesund.net> wrote:
 It was changed when invariant was introduced to D2 as to make a  
 transition
 path ... I think it was announced too.

buried in the newsgroups somewhere. W has a habit of not announcing important changes until three months later when he mentions it in passing in a reply as if everyone knew about it.

Does anyone know about =this() { } ?

Looks like a new/alternative syntax for struct postblitting (works in DMD2.019, too).
Oct 21 2008
prev sibling next sibling parent "Jarrett Billingsley" <jarrett.billingsley gmail.com> writes:
On Tue, Oct 21, 2008 at 1:48 PM, ore-sama <spam here.lot> wrote:
 Jarrett Billingsley Wrote:

 I can't find anything about it in the changelog

http://www.digitalmars.com/d/2.0/features2.html

No, in D1, not in D2. The syntax in D1 used to be invariant {}, without the parens. The D1 compiler now accepts either the old syntax or the new syntax, and the spec only shows the new syntax, but I don't remember it ever being mentioned.
Oct 21 2008
prev sibling parent "Bill Baxter" <wbaxter gmail.com> writes:
On Wed, Oct 22, 2008 at 9:44 PM, Bruno Medeiros
<brunodomedeiros+spam com.gmail> wrote:
 Ary Borenszweig wrote:
 Jarrett Billingsley wrote:
 On Tue, Oct 21, 2008 at 11:14 AM, Lars Ivar Igesund
 <larsivar igesund.net> wrote:
 It was changed when invariant was introduced to D2 as to make a
 transition
 path ... I think it was announced too.

I can't find anything about it in the changelog, but maybe it was buried in the newsgroups somewhere. W has a habit of not announcing important changes until three months later when he mentions it in passing in a reply as if everyone knew about it.

Does anyone know about =this() { } ?

I read diffs of the DDoc with each new D2 release, and it wasn't mentioned there, so it was probably unreleased, yeah. I wouldn't be surprised if there was more stuff like that. :P

That reminds me ... the foo.(bar) template instantation syntax was supposedly already implemented. I wonder if that's snuck into this release too? --bb
Oct 22 2008