digitalmars.D - Re: new D2.0 + C++ language
- bearophile <bearophileHUGS lycos.com> Mar 20 2009
- Jarrett Billingsley <jarrett.billingsley gmail.com> Mar 20 2009
- bearophile <bearophileHUGS lycos.com> Mar 20 2009
- Daniel Keep <daniel.keep.lists gmail.com> Mar 21 2009
Yigal Chripun:what you suggest is C++ with better syntax, *NOT* a variant of D. for that look at: http://en.wikipedia.org/wiki/Significantly_Prettier_and_Easier_C%2B%2B_Syntax
Thank you for the link, I did know only "A Modest Proposal: C++ Resyntaxed". In some situations that SPECS syntax is more readable than D syntax: Function having an int argument and returning pointer to float: (int -> ^float) Pointer to function having an int and float argument returning nothing: ^(int, float -> void) Note that SPECS uses ^ := and = as in Pascal. Pointer syntax of Pascal is better, and the := = often avoid the C bugs like if(a = b). But probably D needs to tell apart functions and delegates too, so that syntax isn't enough. And I think now it's not easy to change the meaning of ^ in D :-) So a possibility (keeping the usual * pointer syntax): {int => int} Delegate: {{int => int}} That can also offer a syntax for anonymous functions/delegates: {int x => x*x} {x => x*x} {{x => x*x}} Bye, bearophile
Mar 20 2009
On Fri, Mar 20, 2009 at 10:31 PM, bearophile <bearophileHUGS lycos.com> wro= te:Note that SPECS uses =A0^ =A0:=3D =A0and =A0=3D =A0as in Pascal. Pointer syntax of Pascal is better, and the :=3D =A0=3D often avoid the C=
Which isn't a problem in D ;)That can also offer a syntax for anonymous functions/delegates: {int x =3D> x*x} {x =3D> x*x} {{x =3D> x*x}}
That's actually pretty nice.
Mar 20 2009
Jarrett Billingsley:Pointer syntax of Pascal is better, and the := = often avoid the C bugs like if(a = b).
Which isn't a problem in D ;)
Let's say D has a workaround to patch most of that C-syntax hole :-) And I'll never like C pointer syntax.That's actually pretty nice.
An alternative syntax that avoids the two nested {{}}: Lambda functions: {int x -> x*x} {x -> x*x} {float x, float x*y} Lambda delegates: {int x => x*x} {x => x*x} {float x, float y => x*y} I may even like that :-) Bye, bearophile
Mar 20 2009
bearophile wrote:Jarrett Billingsley:Pointer syntax of Pascal is better, and the := �= often avoid the C bugs like if(a = b).
Let's say D has a workaround to patch most of that C-syntax hole :-) And I'll never like C pointer syntax.That's actually pretty nice.
An alternative syntax that avoids the two nested {{}}: Lambda functions: {int x -> x*x} {x -> x*x} {float x, float x*y} Lambda delegates: {int x => x*x} {x => x*x} {float x, float y => x*y} I may even like that :-) Bye, bearophile
{ int -> int } // function { this int -> int } // delegate Not saying I support this syntax; just proposing an alternative. The way I see it, there's no reason why functions are -> and delegates are =>; the difference is non-obvious. -- Daniel
Mar 21 2009








Daniel Keep <daniel.keep.lists gmail.com>