advice needed about default arguments for a method

Ned Konz ned at squeakland.org
Fri Dec 10 02:00:36 UTC 2004


On Thursday 09 December 2004 2:22 am, Stéphane Rollandin wrote:
> now I want my block to get default values in certain circumstances.
> one  precise example: if I drag the above method from a Browser, I get a
> TransformMorph whose passenger is the selector #sineAmp:period:
> I can then drop this morph in a function plotter morph which I wrote
> (and from where I have the possibility to define the two expected
> arguments), but I would like the dropped function to have default
> arguments to start with. Ideally those arguments should be defined
> somehow within the method source itself so that there is no ackward
> separation between the code and its associated default parameters.

But the problem is that the default arguments are dependent on the context in 
which the method is called.

So putting the defaults into the method text itself is probably the wrong 
thing to do.

What I'd do is probably something like what we did for the Event code, which 
allows default argument values for triggered events to be overridden by 
supplied values.

-- 
Ned Konz
http://bike-nomad.com/squeak/



More information about the Squeak-dev mailing list