On 20 April 2011 23:18, Ted F.A. van Gaalen <[email protected]> wrote: > Thanks Tobias and Igor for your thoughts about this increment/decrement theme. > @Tobias: what kind of side effect(s) are you talking about? I don't > understand, sorry. > > @Igor, Yes, I completely agree with you that Smalltalk should not > transform to a C++ like dialect. At first, I simply would like wanted > ++ -- (monadic) and for that matter also += -= *= and /= (dyadic) as > messages for the Integer classes, possibly as primitive methods. > > But then again, If this would be implemented, I can imagine people > using ugly and hard to read statement trains like > anotherInt += anInt ++ * 1234 , > I don't find these constructs very nice either.. So, after realizing > this.. perhaps you're right: just let it be. (probably would have > needed here () as wel)
Yes. As to me it is simply not worth to dedicate a special operator for increment or decrement. It makes no sense, considering how many other operators you could imagine, and considering how often you using value increment in smalltalk. If you do things right, you don't need to write it by yourself , because it is done once in #to:do: and/or #do: loops. So, it is really very small number of use cases where you may need to use increment or decrement. Unlike from C, where you will use ++ or -- on almost every loop , in smalltalk for loops you using collections and closures, incread of manually writing them again and again. -- Best regards, Igor Stasenko AKA sig.
