> On 9 Nov 2017, at 00:52, Martin McClure <[email protected]> wrote:
>
> On 11/08/2017 01:15 PM, Sven Van Caekenberghe wrote:
>> What is the opinion of the original Tonel designers ?
>
> Well, Esteban did the largest part of the work, but I guess I am *one* of the
> original designers, in that various design proposals were floated back and
> forth, starting with one of mine and ending with Tonel.
>
> My intent is that Tonel, as a declarative cross-platform format, should use
> strings exclusively, never Symbols. I *think* I discussed this with Esteban
> during ESUG, and I *think* he agreed, so it seems likely that the current
> behavior with class definitions is unintentional.
>
> Regards,
>
> -Martin
Thanks for your reply, Martin.
Ah, OK, I didn't know that.
Still, since the current Tonel implementation in Pharo uses a custom STONWriter
subclass, it is easy to change Symbol printing (not that it is needed, but it
would help in appearance).
TonelSTONWriter>>#isSimpleSymbol: symbol
"Customize STON to only consider very clean symbols as literal,
for all others err on the safe side and quote them."
symbol isEmpty
ifTrue: [ ^ false ].
('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' includes:
symbol first)
ifFalse: [ ^ false ].
^ symbol allSatisfy: [ :each |
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' includes: each
]
I would also make the following change
TonelWriter>>#toSTON: anObject
^ String streamContents: [ :out |
(TonelSTONWriter on: out)
newLine: self newLine;
nextPut: anObject ]
Sven