Should the comma operator be removed in D2?

yigal chripun yigal100 at gmail.com
Wed Nov 18 04:53:15 PST 2009


You're remark of function chaining reminded me of a nice feture that a few OOP languages provide:

// pseudo syntax
auto obj = new Object();
obj foo() ; bar() ; goo() 

foo, bar and goo above are three mesages (methods) that are sent to the same object. i.e. it's the same as doing:
obj.foo();
obj.bar();
obj.goo();

this means the functions can return void instead of returning this like you'd do in C++/D. I think it provides a cleaner conceptual separation between multiple messages sent to one object and real chaining when foo returns obj2 which then receives message bar and so on.



More information about the Digitalmars-d mailing list