Dart and D: features that could be used in D, D->dart for web programming

bearophile bearophileHUGS at lycos.com
Thu Feb 27 02:53:48 PST 2014


Timothee Cour:

> * better way to define default constructors:
> class Point {
>   num x;
>   num y;
>   num z;
>   // Syntactic sugar for setting z and x before the constructor 
> body runs.
>   Point(this.z, this.x){...}
> }
> This is more explicit and flexible than D's way for default 
> struct
> constructors, which can only allow to set all fields in order, 
> without
> skipping some, and doesn't allow to do anything else in the 
> ctor.

A variant of this idea was discussed, and I think it's a good 
idea.


> * distinguish integer divide (~/) vs divide (/), so that 5/2=2, 
> 5~/2=2
>
> * shorthand function declaration with => (used not just for 
> lambdas)

Both good. But for the first you need a different syntax in D.


> * optional named parameters arguments (with simplest possible 
> syntax)
>
> * import all except specified symbols:
> import 'package:lib2/lib2.dart' hide foo; // Import all names 
> EXCEPT foo.

Probably both good, if well designed.

Bye,
bearophile


More information about the Digitalmars-d mailing list