Mantis - Squeak Packages
Viewing Issue Advanced Details
1691 VBRegex minor always 08-16-05 18:58 08-16-05 19:01
0001691: [FIX] nil and #nil and a fix for RxParser
"Andrew P. Black" <>:

"Did the meaning of

    array := #(12 nil foo)

change at some point? array last is of course #foo. array first is
1. array third is now nil. Was array third #nil at some point in the

I'm asking because RxParser class >>
test:with:expect:withSubexpressions: is driven off a table of array
literals. It has a test "subxpr ~= #nil" that now has to be modified
to read "subxpr ~= nil" to get the tests to run.

I'm sure that Vassilli would have had this right at some time in the
past, maybe in "Some Other Smalltalk". Is this an incompatibility
with VisualWorks?"
 RxParserTestFix.1.cs.gz [^] (524 bytes) 08-16-05 18:58

08-16-05 18:59   
Avi Bryant <>:

"I could be misremembering, but I think what happened is this:

1. In VisualWorks, (#(12 nil foo) at: 2) == nil.
2. That's the way the tests were written for Vassili's version.
3. In Squeak, (#(12 nil foo) at: 2) == #nil.
4. When I ported the RxParser to Squeak, I changed those tests to make
them pass.
5. Having had to do this for several packages ported back and forth, I
posted to the list about the issue and included a changeset that
modified Squeak's behavior.
6. Surprisingly (and without proper review, unfortunately, see recent
comments from Andreas), this change got included into the base.
7. The regex package hasn't been updated since.

As was mentioned in the discussion at the time, ANSI dictates the
current behavior (nil, not #nil), and I'm pretty sure Squeak was the
only Smalltalk that did it the other way."
08-16-05 19:01   
"Boris Gaertner" <>:

"> Did the meaning of
> array := #(12 nil foo)
> change at some point?
Yes, it did.

In all the old Smalltalks (early Smalltalk-80, Digitalk Smalltalk/V)
we had:

# (12 nil true false) collect: [:item | item class]
#(SmallInteger Symbol Symbol Symbol)

ANSI requires:

# (12 nil true false) collect: [:item | item class]
#(SmallInteger UndefinedObject True False)

The change to ANSI came with change set 5736 (by Avi Bryant)
Squeak 3.6 final has still the old interpretation, Squeak 3.7 final
has the new one."