On 27/04/2018 15:35, Richard Sargent wrote: > On Fri, Apr 27, 2018 at 2:08 PM, Esteban A. Maringolo > <emaring...@gmail.com <mailto:emaring...@gmail.com>> wrote:
> As far as I knew the only way to have new literals was to modify the > compiler. > > > Yes. > > VA Smalltalk has an interesting syntax extension which allows an > arbitrary expression to be a compile-time literal. > Going by memory, something like ##(Dictionary new at: #a put: self > something; at: #b put: self somethingElse; yourself). Dolphin Smalltalk provides that ##() literal as well since a decade at least, so you have the full expression that gave origin to that literal, but you don't need to compute it every time it is accessed. Although I don't remember seeing it with Dictionaries, but more with string concatenations or "magic numbers" like seconds in a day stored as ##(24 * 60 * 60). Regards, -- Esteban A. Maringolo