swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: self or void?


From: Marcus G. Daniels
Subject: Re: self or void?
Date: 13 Apr 2000 08:04:51 -0700
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4

>>>>> "F" == famasce  <address@hidden> writes:

F> When a method doesn't return any value and simply changes the
F> internal state of an object, 'return self' is often used instead of
F> 'return void' (and the return type is changed accordingly). I've
F> never reflected much on this, also because it's a common practise
F> in Swarm programs, but now I feel the need to know: what's the
F> advantage (if there's one) of returning self instead of void?

In a setter method, it's handy so that expressions like this are possible:

   [[[FooBar createBegin: aZone] setFoo: foo] createEnd]

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]