On 21 April 2011 17:37, Lukas Renggli <[email protected]> wrote:
>> A ++ operator is evil, because you cannot override or redefine it
>> (like any other message).
>
> In C++ you can.
>

yep.. been there

>> And it works only for numbers (no pointers
>> in smalltalk)
>> and so, completely falls out of object model.
>
> It can be done and has been done in Helvetia without falling out of
> the object model.
>
> I don't remember the details, but I was essentially rewriting
>
>    i++
>
> to something along
>
>    i increment: [ :v | i := v ]
>
> where you the semantics of #increment: are implemented in the objects
> as you wish. For numbers this would be something like:
>
>    Number>>#increment: aBlock
>        ^ aBlock value: self + 1
>
> For other objects other 'meaningful' implementations can be added, for 
> example:
>
>    SequenceableCollection>>#increment: aBlock
>        ^ aBlock value: self allButFirst , (Array with: self first)
>
>    Stream>>#increment: aBlock
>        ^ aStream skip: 1
>
>    etc.
>

So, what is your point? Yes, we can extend a syntax. And with Helvetia
this is piece of cake.
The question -  do we need it so much that want to sacrifice a syntax
simplicity, consistency and clarity for that? (outside of serving as
an example of extending syntax ;)

Well, yeah, we can introduce weird stuff at any moment. Things like
macros or quasi-quotes will eventually turn once self-explanatory
smalltalk code into DSL, where only author can understand what it
does...
I am fine with having DSLs around with any possible extensions that
people may want them to be. But making it to be default syntax? Hell
no!

-- 
Best regards,
Igor Stasenko AKA sig.

Reply via email to