Google's Go

retard re at tard.com.invalid
Sat Jan 23 11:27:39 PST 2010


Sat, 23 Jan 2010 14:16:47 -0500, bearophile wrote:

> dsimcha:
>> Multiple return values are a horrible substitute for exceptions,
> 
> But I am waiting for multiple return values in D3, because they are
> quite handy if implemented with a nice syntax :-)
> 
> Bye,
> bearophile

You can write a string mixin that converts a string like:

  (a,b) = fun_call(c,d);

into

  fun_call(c,d,a,b);

and another one that converts a string for defining functions:

  (int, int) fun_call(int c, int d) { ... }

into

  void fun_call(int c, int d, out int ret1, out int ret2) { ... }

I've personally used the import expression and string mixins + ctfe 
instead of ordinary D imports to implement rather nice language 
extensions by parsing the language on module level.



More information about the Digitalmars-d mailing list