Workspace bug?

Stephan B. Wessels stephan.wessels at sdrc.com
Wed Jan 6 20:30:20 UTC 1999


Actually, the behavior looks right to me.

The first change I would make is to use a lower case character for the
temporary variable (f) instead of F.
But that's not why you are seeing a "failure".  The instance variable <n>
should not be visible within the scope of the workspace.  After all, that's
why it's encapsulated in the first place.  I recommend you either consider
writing an instance method in FFT that does what you need, or write an
instance accessor method that returns the instance variable if you really need
to be able to "expose" if to the outside world like it's being used in the
workspace example given.

Does that help?

  - Steve

Richard L. Peskin wrote:

> The following code (from FFT test) runs fine in the browser:
> (FFT new nu: 8)  realData: ((1 to: n) collect: [:i | (Float pi * (i-1) /
> (n/8)) cos]).
>
> If I try to run this in a Workspace, say as:
> | F |
> F _ (FFT new) nu: 8.
> F realData: ((1 to: n) collect: [:i | (Float pi * (i-1) / (n/8)) cos]).
>
> the code fails. It appears that the instance variable, n, is not available
> to the collect. What is happening here?
> --dick peskin
>
> =================================
> R. L. Peskin,  Rutgers Univ. ; <peskin at caip.rutgers.edu>;
> <http://www.caip.rutgers.edu/~peskin>
> VT Phone (802) 824-4558  NJ Phone (732) 445-4208
> "The corporate culture is concerned less with Occam's razor than his
> aftershave lotion."





More information about the Squeak-dev mailing list