digitalmars.D - Alternative typeof syntax
- bearophile (14/14) May 17 2010 What do you think about the the syntax x.typeof instead of typeof(x) ...
- Nick Sabalausky (11/25) May 17 2010 vote++
- Clemens (2/8) May 18 2010 You mean like Smalltalk?
- Nick Sabalausky (5/15) May 18 2010 Not really sure. All I remember from when I looked into Smalltalk was th...
- Ary Borenszweig (2/12) May 18 2010 You mean like Ruby? :-)
- Clemens (4/17) May 19 2010 Heh, yes ;)
- bearophile (2/2) Jun 04 2010 I have added it as request:
What do you think about the the syntax x.typeof instead of typeof(x) ? There are situations where you will need to parenthesize anyway, for example: import std.stdio; void main() { int x = 1; float y = 1.5; writeln(typeid(typeof(x + y))); } You have to write: (x + y).typeof But in many situations you don't need the (). And it gets more similar/uniform to the x.sizeof syntax too (that is sizeof(x) in C). Bye, bearophile
May 17 2010
"bearophile" <bearophileHUGS lycos.com> wrote in message news:hss6b6$aep$1 digitalmars.com...What do you think about the the syntax x.typeof instead of typeof(x) ? There are situations where you will need to parenthesize anyway, for example: import std.stdio; void main() { int x = 1; float y = 1.5; writeln(typeid(typeof(x + y))); } You have to write: (x + y).typeof But in many situations you don't need the (). And it gets more similar/uniform to the x.sizeof syntax too (that is sizeof(x) in C).vote++ Anything that reduces parenthesis-hell without inviting ambiguities in either the compiler or the "human-eye parser" is good by me :) Besides, I love member access syntax in general. In addition to (safely) reducing parenthesis, it also sidesteps the oddity that nested function calls are written/read *backwards* from the order of execution (ie, "A(B(C()))" means "call C, then B, then A"). I've even been toying with the idea of a language design that places primary emphasis on member-call syntax and consistent left-to-right ordering.
May 17 2010
Nick Sabalausky Wrote:Besides, I love member access syntax in general. In addition to (safely) reducing parenthesis, it also sidesteps the oddity that nested function calls are written/read *backwards* from the order of execution (ie, "A(B(C()))" means "call C, then B, then A"). I've even been toying with the idea of a language design that places primary emphasis on member-call syntax and consistent left-to-right ordering.You mean like Smalltalk?
May 18 2010
"Clemens" <eriatarka84 gmail.com> wrote in message news:hstgm2$2pr6$1 digitalmars.com...Nick Sabalausky Wrote:Not really sure. All I remember from when I looked into Smalltalk was that even the most basic logic constructs were forced into being objects/classes, which make their use needlessly awkward.Besides, I love member access syntax in general. In addition to (safely) reducing parenthesis, it also sidesteps the oddity that nested function calls are written/read *backwards* from the order of execution (ie, "A(B(C()))" means "call C, then B, then A"). I've even been toying with the idea of a language design that places primary emphasis on member-call syntax and consistent left-to-right ordering.You mean like Smalltalk?
May 18 2010
Clemens wrote:Nick Sabalausky Wrote:You mean like Ruby? :-)Besides, I love member access syntax in general. In addition to (safely) reducing parenthesis, it also sidesteps the oddity that nested function calls are written/read *backwards* from the order of execution (ie, "A(B(C()))" means "call C, then B, then A"). I've even been toying with the idea of a language design that places primary emphasis on member-call syntax and consistent left-to-right ordering.You mean like Smalltalk?
May 18 2010
Ary Borenszweig Wrote:Clemens wrote:Heh, yes ;) Of course Smalltalk was there first, prior art and all that. I had some fun with it again over the weekend... it's a really neat language, a shame that it never really caught on in a big way. Perhaps the whole image-based development thing was just too different from how everyone was/is working. By the way, another interesting (though less widely known) language that also builds upon that legacy is Io: http://www.iolanguage.com/Nick Sabalausky Wrote:You mean like Ruby? :-)Besides, I love member access syntax in general. In addition to (safely) reducing parenthesis, it also sidesteps the oddity that nested function calls are written/read *backwards* from the order of execution (ie, "A(B(C()))" means "call C, then B, then A"). I've even been toying with the idea of a language design that places primary emphasis on member-call syntax and consistent left-to-right ordering.You mean like Smalltalk?
May 19 2010
I have added it as request: http://d.puremagic.com/issues/show_bug.cgi?id=4272
Jun 04 2010