Proposal2: Add literal byte array

Stefan Matthias Aust sma at 3plus4.de
Sun May 28 17:39:39 UTC 2000


PROPOSAL

For better ANSI compatibility, I propose to change the Parser literal 
arrays as follows:

literal = number | symbol | literalArray | literalByteArray | ...
                                            ~~~~~~~~~~~~~~~~
                                           new

literalByteArray = "#" "[" {smallNumber} "]"
smallNumber = number between 0 and 255

The implication is that

    #[] returns (ByteArray new)
    #[12] returns (ByteArray with: 12)
    #[1 2 3] returns (ByteArray withAll: #(1 2 3))

and so on.  Currently, #[] is a syntax error, and #[ is taken as ('[' 
asSymbol).


BACKWARD COMPATIBILITY ISSUES

Currently, #[ isn't used in the image (as determined with Strg+E) and only
	(Symbol classPool at: #SingleCharSymbols)
contains a reference to that symbol.  If you want to refer to it, you have 
to use
        #'['
now.


ADVANTAGES
ANSI conformance as well as conform with VisualWorks, Dolphin ST, VisualAge 
and probabyl also other Smalltalk systems.


IMPLEMENTATION ISSUES

Scanner>>xLitQuote needs to be extended.  It's trivial to scan for a number 
of non-negative integers.  It's trivial to create a ByteArray with all 
numbers.  We need an error signaled if a number is outside of [0..255].


bye
--
Stefan Matthias Aust  //  Bevor wir fallen, fallen wir lieber auf





More information about the Squeak-dev mailing list