This can't be right....
Roel Wuyts
wuyts at iam.unibe.ch
Fri Jun 27 07:32:20 UTC 2003
Hah, a fun example of case sensitivity :-)
In your example you assign the class 'False' to the ok instance
variable, not the instance 'false'. That is why I assume you get the
behaviour you have, So the following should work as expected:
> ok _ false.
> [ok] whileFalse: [.... ok _ <condition>.]
The fun of having classes as first-class objects :-)
On Friday, Jun 27, 2003, at 09:07 Europe/Zurich, Rick McGeer wrote:
> I'd like to write some Smalltalk code equivalent to the Java fragment:
>
> boolean ok = false;
> while (!ok) {
> ...
> ok = <condition>;
> }
>
> So I try:
>
> ok _ False.
> [ok] whileFalse: [.... ok _ <condition>.]
>
> which fails. On the other hand:
>
> ok _ 0.
> [ok > 0] whileFalse: [.... ok _ (<condition>) ifTrue:[1] ifFalse:[0]]
>
> which works just fine. This is perverse; shouldn't the two fragments
> have identical functionality?
>
> I'm using the 3.4 image.
>
>
> --
>
> Personal Signature
>
>
<image.tiff>
>
>
>
>
>
Roel Wuyts Software
Composition Group
roel.wuyts at iam.unibe.ch University of Bern,
Switzerland
http://www.iam.unibe.ch/~wuyts/
Board Member of the European Smalltalk User Group: www.esug.org
More information about the Squeak-dev
mailing list
|