[ANN] Nile 0.9.0

Klaus D. Witzel klaus.witzel at cobss.com
Sun Jun 10 21:20:10 UTC 2007


Hi Andreas,

on Sun, 10 Jun 2007 22:18:53 +0200, you wrote:
> Hi -
>
> Damien Cassou wrote:
...
>>> The lesson here is (at least for me) that after trying to wrap my brain
>>> around the code in NSStringReader>>next: I'm willing to give up the
>>> speed. A nice example for what can be done if you understand byte code
>>> execution but by no means production code (pity the bugger who at some
>>> point will need to understand that the "0-position" is required since
>>> position cannot occur on the right-hand side of that expression ;-)
>>
>>  I do not understand this paragraph.
>
> I just mean that I prefer code like this:
>
>    prior := position.
>    position := capacity min: position + amount.
>    size := position - prior.
>
> over code like this:
>
>    size := 0 - position + (position := capacity min: position + amount)
>
> (and yes, it's equivalent ;-) The latter is a real brain-teaser if you  
> don't have the former to compare it to, in particular that "0 - position  
> + X" is equivalent to "X - position(before X executed)".
>
> And although the latter will be faster, I strongly prefer the former.

FWIW this was all discussed (and summarized on the NewCompiler list)  
during Nile development and Stef suggested that is a job for a future  
optimizing compiler so code can be entered and maintained in the  
"needs-absulutely-no-further-comment-to-be-understandable" form that you  
gave above [translation of the quoted text by me].

OTOH I would have a problem when an employee (professional developer)  
would came to me and would claim that the [partly] optimized form above is  
not understandable or not maintainable. There are just very, very basic  
math equations involved and doing subexpression elimination back and forth  
with any piece of code is the minimum I do expect from a professional  
developer (no offense, Squeak => doIt *and* have fun :) expecially with a  
language so simple as Smalltalk :)

/Klaus




More information about the Squeak-dev mailing list