www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - What is return?

reply "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
A recent discussion over in digitalmars.D
http://forum.dlang.org/post/rtwbtxigfeupvykpbamh forum.dlang.org

talks about accepting  return... Here is an example from the PR:
https://github.com/D-Programming-Language/dmd/compare/366422338ece...6b86b12f79e8

struct At
{
   property auto info()  safe  nothrow  pure  return const { 
return this; }

   pure  nothrow  return ref int info2(ref int x) { return x; }
}

Which I assume before the change would be:

struct At
{
   property auto info()  safe nothrow pure return const { return 
this; }

  pure nothrow return ref int info2(ref int x) { return x; }
}

I don't know about anyone else, but this doesn't compile in 2.066.
Jan 28 2015
next sibling parent reply ketmar <ketmar ketmar.no-ip.org> writes:
On Thu, 29 Jan 2015 04:54:38 +0000, Jesse Phillips wrote:

 A recent discussion over in digitalmars.D
 http://forum.dlang.org/post/rtwbtxigfeupvykpbamh forum.dlang.org
=20
 talks about accepting  return... Here is an example from the PR:
 https://github.com/D-Programming-Language/dmd/
compare/366422338ece...6b86b12f79e8
=20
 struct At {
    property auto info()  safe  nothrow  pure  return const {
 return this; }
=20
    pure  nothrow  return ref int info2(ref int x) { return x; }
 }
=20
 Which I assume before the change would be:
=20
 struct At {
    property auto info()  safe nothrow pure return const { return
 this; }
=20
   pure nothrow return ref int info2(ref int x) { return x; }
 }
=20
 I don't know about anyone else, but this doesn't compile in 2.066.
http://wiki.dlang.org/DIP25 this is a very recent thing, it wasn't coded when 2.066 was released.=
Jan 28 2015
next sibling parent Jonathan M Davis via Digitalmars-d-learn writes:
On Thursday, January 29, 2015 05:02:58 ketmar via Digitalmars-d-learn wrote:
 http://wiki.dlang.org/DIP25
 this is a very recent thing, it wasn't coded when 2.066 was released.
I don't know if it's even fully coded up in git master, though clearly it's at least partially there, because was put on return as part of the PR that triggered that discussion. Regardless, it's _very_ new (IIRC, it's been less than a month since it was approved). - Jonathan M Davis
Jan 28 2015
prev sibling parent "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
On Thursday, 29 January 2015 at 05:02:58 UTC, ketmar wrote:
 http://wiki.dlang.org/DIP25
 this is a very recent thing, it wasn't coded when 2.066 was 
 released.
Thanks, I like it.
Jan 29 2015
prev sibling parent reply FG <home fgda.pl> writes:
      property auto info()  safe  nothrow  pure  return const { return this; }

It is mesmerizing...   (  _  )
Jan 29 2015
parent "Benjamin Thaut" <code benjamin-thaut.de> writes:
On Thursday, 29 January 2015 at 11:50:29 UTC, FG wrote:
      property auto info()  safe  nothrow  pure  return const { 
 return this; }

 It is mesmerizing...   (  _  )
And soon its gong to look like this: export property auto info() safe nothrow pure return const { return this; }
Jan 29 2015