Proposal1: Change array litaral to ANSI conformance
Stefan Matthias Aust
sma at 3plus4.de
Sun May 28 17:39:30 UTC 2000
PROPOSAL
For better ANSI compatibility, I propose to change the Parser literal
arrays as follows:
literal = number | symbol | literalArray | ...
literalArray = "#" arrayConst
arrayConst = "(" {literal | identifier | arrayConst} ")"
~~~~~~~
^ new
The implication is that
#(true) first returns true, not #true
#(false) first returns false, not #false
#(nil) first returns nil, not #nil
and that
#( #true #false #nil)
#( #() )
are valid constructs now. Actually, I just noticed, that constructs are
already supported by the current scanner! (Although the pretty printer
needs a tweak)
BACKWARD COMPATIBILITY ISSUES
AFAIK, no part of the system depends on the fact, that #(true false nil)
returns symbols. The workaround is obvious, simply add an "#". This is
not a complete test, but close enough and answers 19 problematic methods.
| o |
o _ OrderedCollection new.
ProtoObject withAllSubclassesDo: [:c |
c selectors do: [:s |
(c compiledMethodAt: s) literals do: [:l |
((l isKindOf: Array) and:
[#(nil true false) anySatisfy: [:e | l includes: e]])
ifTrue: [o add: c -> s]]]].
o
ADVANTAGES
ANSI conformance as well as conform with VisualWorks, Dolphin ST, VisualAge
and probabyl also other Smalltalk systems.
IMPLEMENTATION ISSUES
Scanner>>xLitQuote is the only place to change. The change itself is trivial.
bye
--
Stefan Matthias Aust // Bevor wir fallen, fallen wir lieber auf
More information about the Squeak-dev
mailing list
|