[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-smalltalk] short list of possible smalltalk extensions
From: |
Sungjin Chun |
Subject: |
Re: [Help-smalltalk] short list of possible smalltalk extensions |
Date: |
Sun, 5 Dec 2010 17:55:46 +0900 |
I like these extensions :-) But one question, how about compatibility?
On Sun, Dec 5, 2010 at 11:06, Paolo Bonzini <address@hidden> wrote:
> 1) nested classes. GNU Smalltalk already supports Class.ClassVar notation
> to access class variables. This could be easily extended to support nested
> classes, all it requires is parser support.
>
> Note these wouldn't be closures like Java inner classes, they would just use
> the class pool dictionary as a namespace.
>
> hidden complications: GUI support, fileout support,
> reflection support
>
>
> 2) additional binary operators. This can come in many ways:
>
> 2.a) ".." instead of #to:. Also make the compiler recognize "a .. b do: []"
> and similar.
>
> 2.b) Unicode binary operators. Less-than-or-equal for example. Let's wait
> for Perl 6 which also has those though. :)
>
>
> 3) additional literals. #/abc/ for Regex, for example.
>
>
> 4) A magic DWIM "match" (I'll call it #=~) and "transform" (#<<) operator:
>
> [:a | true] =~ something matches everything
> #/abc/ =~ something means something matches regex
> #(1 3 5 10) =~ something means something is in the collection
> 'aeiouy' =~ something strings are not special, but...
> #even =~ something ... means "something even == true"
>
> [:a | a] << something is the identity
> #/\[.*\]/ << something gives the first regex match
> #(1 2 4 8) << something maps key to value
> '0123456789' << something strings are not special, but...
> #abs =~ something ... symbols are
>
> #select: and #reject: use #=~, #collect: uses #<<. It is also possible to
> use keyword methods, of course.
>
>
> 5) Extended blocks:
>
> 5.a) Anonymous variables for blocks.
>
> x select: [ _ even ]
> 1..10 fold: [ _ + _ ]
>
> 5.b) Variable-argument blocks
>
> [ :r :m :a... | r perform: m withArguments: a ]
> value: 1 value: #+ value: 2
>
> 5.c) Optional (efficient) currying:
>
> plus := [ :r :m :a... | r perform: m withArguments: a ] curry
> value: 1 value: #+.
>
> plus value: 2 "=> 3"
>
>
> Any more ideas?
>
> Paolo
>
>
> _______________________________________________
> help-smalltalk mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-smalltalk
>
>