Perl: the Markov chain saw | |
PerlMonks |
Re^7: quickness is not so obviousby LanX (Saint) |
on Jan 24, 2015 at 07:48 UTC ( [id://1114343]=note: print w/replies, xml ) | Need Help?? |
I think the first time I saw an increment in a high level language was in a loop like for (j = 0; j < count; j++) { } The existence of ++j was only a side node without immediate use case.
So maybe blame K&Rą for this Anyway optimizing for such implantation details can bite you severely when processor technology advances. For instance linearizing loops used to be a good idea till the memory access for the longer code was beaten by inline caches being able to hold the smaller loops in processor memory. So who knows what comes next? Personally I don't like post increment since it's a side effect sometimes causing weird undefined conditions, and in the world of concurrency side effects are the worst sin. But in Perl at least I have to trust that it's optimized away in void and loop context.
updatesą) I found the oldest version in the net and it explicitly says:
But actually ++i would work the same, this post-increment notation hides the fact that the increment is only executed at the end of the loop's body. NB: like in Perl
˛) according to WP it was invented for B.
In Section
Meditations
|
|