digitalmars.D - pseudo array properties
- Derek Parnell (15/15) Jul 05 2007 In V2, were we meant to lose the (undocumented) facility to have pseudo
- Charlie (3/17) Jul 05 2007 That will be a serious loss. This 'feature' was an awesome one, and a
- Jason House (2/20) Jul 05 2007
- Charlie (3/28) Jul 05 2007 Yes me too. I guess we now have to convice Andrei , who will in turn
- Jari-Matti =?ISO-8859-1?Q?M=E4kel=E4?= (3/8) Jul 08 2007 FWIW, this has been proposed before and nothing happened. For example Sc...
- Robert Fraser (19/22) Jul 05 2007 On the contrary, it's in the specs for both 1.0 and 2.0:
- Derek Parnell (8/20) Jul 05 2007 Ok, maybe I got this wrong 'cos I can't get it to run in V1 either. Didn...
- Oskar Linde (6/23) Jul 05 2007 The limitation (that has always been there) is that for "pseudo
- Sean Kelly (3/5) Jul 06 2007 I think this was actually added to the spec for v1.0.
In V2, were we meant to lose the (undocumented) facility to have pseudo properties for arrays? In other words, the code below compiled and ran for V1 but it doesn't for V2. char[] foo(char[] a) { return a; } void main() { char[] q; q = q.foo; // Invoke 'foo' as if it were a property. } -- Derek (skype: derek.j.parnell) Melbourne, Australia 6/07/2007 11:50:31 AM
Jul 05 2007
That will be a serious loss. This 'feature' was an awesome one, and a shame it never made it into the specs. Derek Parnell wrote:In V2, were we meant to lose the (undocumented) facility to have pseudo properties for arrays? In other words, the code below compiled and ran for V1 but it doesn't for V2. char[] foo(char[] a) { return a; } void main() { char[] q; q = q.foo; // Invoke 'foo' as if it were a property. }
Jul 05 2007
Charlie wrote:That will be a serious loss. This 'feature' was an awesome one, and a shame it never made it into the specs.Personally, I'd like to see it generalized to more than just arrays...Derek Parnell wrote:In V2, were we meant to lose the (undocumented) facility to have pseudo properties for arrays? In other words, the code below compiled and ran for V1 but it doesn't for V2. char[] foo(char[] a) { return a; } void main() { char[] q; q = q.foo; // Invoke 'foo' as if it were a property. }
Jul 05 2007
Personally, I'd like to see it generalized to more than just arrays...Yes me too. I guess we now have to convice Andrei , who will in turn convince Walter, since Walter has been ignoring our pleads lately. Jason House wrote:Charlie wrote:That will be a serious loss. This 'feature' was an awesome one, and a shame it never made it into the specs.Personally, I'd like to see it generalized to more than just arrays...Derek Parnell wrote:In V2, were we meant to lose the (undocumented) facility to have pseudo properties for arrays? In other words, the code below compiled and ran for V1 but it doesn't for V2. char[] foo(char[] a) { return a; } void main() { char[] q; q = q.foo; // Invoke 'foo' as if it were a property. }
Jul 05 2007
Charlie wrote:> Personally, I'd like to see it generalized to more than just arrays... Yes me too. I guess we now have to convice Andrei , who will in turn convince Walter, since Walter has been ignoring our pleads lately.FWIW, this has been proposed before and nothing happened. For example Scala language generalizes it in a nice way.
Jul 08 2007
That will be a serious loss. This 'feature' was an awesome one, and a shame it never made it into the specs.On the contrary, it's in the specs for both 1.0 and 2.0: http://www.digitalmars.com/d/arrays.html See under "Functions as Array Properties" Yes, I agree, it should be generalized to non-arrays. As I mentioned before, I love the natural feel of the Ruby-esque: --- import tango.io.Stdout; void times(int n, void delegate() action) { for(int i = 0; i < n; i++) action(); } void main { 3.times( { Stdout("Hello!").newline; }); } ---
Jul 05 2007
On Fri, 6 Jul 2007 11:52:38 +1000, Derek Parnell wrote:In V2, were we meant to lose the (undocumented) facility to have pseudo properties for arrays? In other words, the code below compiled and ran for V1 but it doesn't for V2. char[] foo(char[] a) { return a; } void main() { char[] q; q = q.foo; // Invoke 'foo' as if it were a property. }Ok, maybe I got this wrong 'cos I can't get it to run in V1 either. Didn't we used to be able to do this? -- Derek (skype: derek.j.parnell) Melbourne, Australia 6/07/2007 12:17:14 PM
Jul 05 2007
Derek Parnell skrev:On Fri, 6 Jul 2007 11:52:38 +1000, Derek Parnell wrote:The limitation (that has always been there) is that for "pseudo properties", you need to call them with the trailing parentheses: q = q.foo(); // should work -- OskarIn V2, were we meant to lose the (undocumented) facility to have pseudo properties for arrays? In other words, the code below compiled and ran for V1 but it doesn't for V2. char[] foo(char[] a) { return a; } void main() { char[] q; q = q.foo; // Invoke 'foo' as if it were a property. }Ok, maybe I got this wrong 'cos I can't get it to run in V1 either. Didn't we used to be able to do this?
Jul 05 2007
Derek Parnell wrote:In V2, were we meant to lose the (undocumented) facility to have pseudo properties for arrays?I think this was actually added to the spec for v1.0. Sean
Jul 06 2007