On Tue, 25 Aug 1998 23:35:08 -0500 m3rabb@stono.com (Maurice Rabb) wrote:
In my mind this should also work: #((65+2) $A (65 asCharacter) ('aString' size) (nil isNil)) ==> #(67 $A $A 7 true)
because everything there is knowable at compile time. More radically:
#((Dictionary) (Set new: 20) (Integer class)) ==> #(Dictionary aSet Integer-class)
While I sympathize with the desire to be able to include true, false and nil (the objects, not the symbols) in a literal array and while I do not object to putting #'s before things I want as symbols, the above examples go too far. Who is to say that "Set new: 20" is knowable at compile time? Are we to be prevented from changing the implementation of Set class>>new:? Will this literal array tucked away in some CompiledMethod's literal frame now contain mutable objects? To those examples you thought safer, you did pick some rather fundamental messages to send - will there be somewhere a list of such "knowable" methods whose implementation will never change? At some point, I think it time to leave #() as it is and move to {} (which I happen to like) or direct construction via message sends.
Cheers, Bob