advice needed about default arguments for a method
iho at gmx.de
Fri Dec 10 05:18:02 UTC 2004
Stéphane Rollandin wrote:
> 1) the problem: I would like to store default arguments for some methods
> for example, suppose I have Function class>>sineAmp:period: return a
> block defining a sine function with amplitude and period depending on
> its parameters. something like (never mind that period is not exactly
> the period):
> Function class>>sineAmp: amp period: period
> ^ [[:x | (x / period) sin * amp ]] value: amp value: period
> now I want my block to get default values in certain circumstances.
What I've seen used in the image, is just having an easier method call
the workhorse with its defaults, e.g.
^ self sineAmp: 1 period: 1
I'm not sure whether its applicable to your problem, though.
More information about the Squeak-dev