digitalmars.D - Bug 0.86
- one_mad_alien hotmail.com (13/13) May 03 2004 the following does not see obj2 as a valid identifier until after this l...
- Walter (5/18) May 03 2004 That's correct, a variable is not recognized until after it is
- Unknown W. Brackets (6/10) May 03 2004 It would be nice to be able to do that... (so as not to have to
- J Anderson (5/16) May 03 2004 It would be even better if you could write short hand something like:
- Unknown W. Brackets (11/14) May 03 2004 Hmm, I would suggest that this would be a bit more logical reading it:
the following does not see obj2 as a valid identifier until after this line where it is declared. --------------- bugtest2.d ----------------------- class MyObj {} int main( char[][] args ) { MyObj obj; obj = new typeof(obj); MyObj obj2 = new typeof(obj2); return 0; } // // bugtest2.d(7): undefined identifier obj2 //
May 03 2004
That's correct, a variable is not recognized until after it is initialized. -Walter <one_mad_alien hotmail.com> wrote in message news:c76jg8$o3q$1 digitaldaemon.com...the following does not see obj2 as a valid identifier until after thislinewhere it is declared. --------------- bugtest2.d ----------------------- class MyObj {} int main( char[][] args ) { MyObj obj; obj = new typeof(obj); MyObj obj2 = new typeof(obj2); return 0; } // // bugtest2.d(7): undefined identifier obj2 //
May 03 2004
Walter wrote:That's correct, a variable is not recognized until after it is initialized. -WalterIt would be nice to be able to do that... (so as not to have to duplicate the name, makes renaming classes or changing classes much easier...) but far from necccessary. And it would probably only serve to complicate the compiler if it were done... -[Unknown]MyObj obj2 = new typeof(obj2);
May 03 2004
Unknown W. Brackets wrote:Walter wrote:It would be even better if you could write short hand something like: MyObj new obj2; -- -Anderson: http://badmama.com.au/~anderson/That's correct, a variable is not recognized until after it is initialized. -WalterIt would be nice to be able to do that... (so as not to have to duplicate the name, makes renaming classes or changing classes much easier...) but far from necccessary. And it would probably only serve to complicate the compiler if it were done... -[Unknown]MyObj obj2 = new typeof(obj2);
May 03 2004
J Anderson wrote:It would be even better if you could write short hand something like: MyObj new obj2;Hmm, I would suggest that this would be a bit more logical reading it: new MyObj obj2; But, then, it might get confusing when compared to: new MyObj(); Although, that does beg the question of whether you want this... MyObj new obj2(2, 3), obj3(4, 5); But, really, this is all laziness, because the following isn't all that hard to type: MyObj obj2 = new MyObj(2, 3), obj3 = new MyObj(4, 5); -[Unknown]
May 03 2004