[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: creating objects
From: |
Marcus G. Daniels |
Subject: |
Re: creating objects |
Date: |
27 Jul 2001 15:15:39 -0600 |
User-agent: |
Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.7 |
>>>>> "MA" == Myriam Abramson <address@hidden> writes:
MA> What is the difference between:
MA> EZBinC ezbinCreating = new EZBinCImpl (new EZBinImpl ());
MA> ezbinCreating.createBegin(aZone);
MA> ...
MA> EZBin ezbin = (EZBin) ezbinCreating.createEnd();
MA> and simply
MA> EZBin ezbin = new EZBinImpl(aZone);
Precisely, the difference is the possibility of the open-ended "...".
In most common cases Swarm has the latter, easier, using-phase
constructor for the `normal' usages of the class, but there are still
a fair number of classes where the explicit phase switch is required.
Any time there are a just few configurations for a class based on a
larger set of possibilities it tends to be easier to require the
phase-switch idiom. In other cases, the feature may not have these
`convenience' constructors just because the feature doesn't get used a lot.
For the curious, the variant constructors are automatically created
for any declared +create:whatever: factory methods in the Swarm
interface files. In other words, to get the easy-to-use constructor
on the Java side, it is necessary to implement +create:whatever:
methods on the Objective C side. For example, src/analysis/analysis.h
& src/analysis/EZGraph.m have several such +create:whatever: methods.
==================================
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.