[Newbies] Returned values

Bert Freudenberg bert at freudenbergs.de
Mon Feb 28 20:58:23 UTC 2011

On 28.02.2011, at 12:06, Gary Dunn wrote:

> While studying DBus code I came across a method that appears to set a class variable and return the value. In DBusConnection>> sessionBus
>   ^SessionBus := self getBus: 0 from: SessionBus
> and SessionBus is a class variable. Why return the value? Why not have the sender examine the value of SessionBus? Is it only a matter of style or is this more efficient?

#sessionBus is an accessor. This is a lazy initialization.

Besides, from outside the DBusConnection class hierarchy you could not even access the SessionBus class variable.

- Bert -

More information about the Beginners mailing list