ReturnThis/@chain

Fawzi Mohamed fawzi at gmx.ch
Sat Jul 24 06:13:01 PDT 2010


I also found chaining more cumbersome than it should be, and made a  
bug report
	http://d.puremagic.com/issues/show_bug.cgi?id=2295
and it turned out I wasn't the first thinking along those lines, as
	http://d.puremagic.com/issues/show_bug.cgi?id=1835
shows.

Maybe it is time to revisit the proposal?

In the meantime for example for i/o in blip I created a templated  
Dumper object that does call chaining (only with opCall, but in D2  
with opDot one could do it for basically all methods...

see
	http://github.com/fawzi/blip/blob/master/blip/io/BasicIO.d#L505
for a D1 example

using the helper function then I simply do

dumper(s)(bla)(bla)(bla);

:)

one has to be a bit careful if the s object is a struct or any non ref  
object, as call chaining would modify the copies, so I have some  
checks for that.

Fawzi



More information about the Digitalmars-d mailing list