From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2000-01-02 18:49:54
John Potter (<jpotter_at_[hidden]>) wrote:
> I see no reason to do anything else. Chaining is also quite common.
> You're just used to a different form.
> int x = 0;
> (x += 3)++;
I also think that there are situations where chaining may be very handy.
Turning back to my version of 'rectangle' class, with a function calls
chaining you may write something like
r.left( 10 ).right( 20 ).top( 5 ).bottom( 10 );
r.assign( 10, 5, 20, 10 );
I know that this looks like a Smalltalk code =), but I think it's very
convenient to write something like that - first, because you don't have to
remember the order of arguments in 'assign' method and, second, because it's
more flexible - you can assign values to any of fourth properties and these
assignments look as an atomic operation (with a semantic point of view). The
latter seems to be important quite often. Do you agree?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk