[squeak-dev] [ENH] isSeparator

Marcel Taeumel marcel.taeumel at hpi.de
Wed May 12 05:37:17 UTC 2021


This reminds me of our #asNumber (or number parser) discussion where we agreed to not parse number-like appearances in Unicode to Integer. :-)

Instead of modifying CharacterSet etc., one could maybe extend TextConverter to support encoding-aware identification of separators etc and also provide encoding-aware #trim.

Best,
Marcel
Am 08.05.2021 04:12:21 schrieb Levente Uzonyi <leves at caesar.elte.hu>:
On Fri, 7 May 2021, Thiede, Christoph wrote:

>
> Hi Levente,
>
>
> thanks for the pointer. As far I can see from the linked discussion, Tobias' proposal has never been rejected but only postponed due to the upcoming release. I also see your point of performance, but IMHO correctness is more
> important than performance. If necessary, we could still hard-code the relevant code points into #isSeparator.
>
>
> > - consistency: CharacterSet separators would differ from the rest with your change set.
>
>
> Fair point, but I think we should instead fix the definitions of Character(Set) constants to respect the encoding as well ... By the way, Character alphabet and Character allCharacters also don't do this at the moment.
>
> Of course, all your concerns are valid points and need to be discussed, but I would be sorry if we failed to - finally - establish current standards in our Character library. I doubt that any modern parser for JSON or
> whatever would treat Unicode space characters incorrectly, and still, they are satisfyingly fast. I think we should be able to keep pace with them in Squeak as well. :-)

Well, you ignored my question "What is a separator?".
IMO a separator is a whitespace that separates tokens in the source
code.
Would you like to use zero-width space as a separator? Not likely.
#isSeparator is deeply buried into the system. Changing it would mean
changing other code your changeset doesn't touch, e.g. the parsers.

The method you propose is welcome, but IMO it shouldn't be called
#isSeparator. #isWhitespace is a much better fit.


Levente

>
> Best,
> Christoph
>
> _________________________________________________________________________________________________________________________________________________________________________________________________________________________________
> Von: Squeak-dev im Auftrag von Levente Uzonyi
> Gesendet: Freitag, 7. Mai 2021 22:01:18
> An: The general-purpose Squeak developers list
> Betreff: Re: [squeak-dev] [ENH] isSeparator  
> Hi Christoph,
>
> There was a discussion on this subject before:
> http://forum.world.st/The-Trunk-Collections-topa-806-mcz-td5084658.html
> Main concerns are
> - definition: What is a separator?
> - consistency: CharacterSet separators would differ from the rest with
> your change set.
> - performance: I haven't measured it, but I wouldn't be surprised if
> #isSeparator would become a magnitude slower with that implementation.
>
>
> Levente
>
> On Thu, 6 May 2021, christoph.thiede at student.hpi.uni-potsdam.de wrote:
>
> > Hi all,
> >
> > here is one tiny changeset for you: isSeparator.cs adds proper encoding-aware support for testing of separator chars. As opposed to the former implementation, non-ASCII characters such as the no-break space (U+00A0) will be
> identified correctly now, too.
> >
> > Please review and merge! :-)
> >
> > Best,
> > Christoph
> >
> > ["isSeparator.cs.gz"]
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210512/e2d1bd81/attachment.html>


More information about the Squeak-dev mailing list