[Pharo-dev] Pharo and special unary selectors
g.cotelli at gmail.com
Fri Nov 17 11:40:57 EST 2017
I would really like to see % removed as a binary selector and available to
use in unary or keyword ones. The only implementor in a Pharo 6 image is:
^ self \\ aNumber
So it's juts aliasing \\ , and % most widespread usage in the real world is
por percentages (the use in modular arithmetic is more a programming thing
that math notation I think).
And for allowing more Unicode code points for selector names I'm totally in
for Symbols, Arrows, Math Symbols, etc... We just need to analyse the ones
that makes sense as binary selectors, and the ones allowed for unary and
keyword ones. This will allow us to write pretty cool DSLs.
Just my opinion.
On Fri, Nov 17, 2017 at 6:32 AM, Torsten Bergmann <astares at gmx.de> wrote:
> just something to think about: one thing I always liked about Smalltalk is
> that it allows for nice DSL's. We have nice things
> like a unit framework in Pharo, ...
> In the most simple case one can easily implement own units just by
> providing a unary messages:
> 1 m
> 1 second
> 1 px
> 1 EUR
> One can easily implement an own Money class with a currency and then do
> polymorphic tricks like
> 10 EUR + 20 EUR
> But we can currently can not implement special unary selectors (including
> special unary selectors with unicode) like:
> 100 %
> 20 $
> 40 €
> 12 ‰ (for promille)
> Especially things like 20 % would be nice for layout issues or other (Bloc
> comes to mind).
> Maybe we should put that on the roadmap of Pharo because IMHO it would be
> cool to support such things in the
> future. Dont know how much effort it currently means on the technical
> level but maybe others can comment.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-dev