Closed svenvc closed 3 years ago
I guess the simplest possible change to the current code base (in Pharo) would be
STONReader>>#isClassStartChar: char
^ char isLetter and: [ char isUppercase]
STONReader>>#isClassChar: char
^ char isAlphaNumeric or: [ char = $_ ]
STONWriter could enforce this, but I am not sure this is needed, maybe a note is enough.
The specification (https://github.com/svenvc/ston/blob/master/ston-spec.md) should be updated as well.
Just a side note: at the moment one can use class names (which are symbols) including valid parts like german umlauts like äöü and other. The system accepts them although one can use them not directly but indirectly in playground expression (one can use them using #asClass)
The current definition what is seen as valid name is in String>>#isValidGlobalName
Ah OK, thank you, that is what I was looking for.
I think thge following should work better:
https://github.com/svenvc/ston/commit/4c340158ad9d26edd43af8a6ac9a9325ce147873
As remarked by @Rydier (Henrik Sperre Johansen) the definition of legal characters in class names is not well done.
STONWriter will write out any system class name, while STONReader has both an isClassStartChar: and isClassChar: that basically restrict class names to ASCII.
We need to figure out what would be the best way forward.
Note that there is no escaping mechanism in class names as there is for symbols.