Don't even think about it. If any of those even is consistently more efficient, the difference will be so small it is hardly going to matter. The key here is that it's a very concise way of doing what it does. In this case it is a oneliner, but in general, it doesn't matter how many lines an idiom takes (the Schwartzian Transform rarely fits in a single line, f.ex) - just that it is concise way of expressing a certain action. Don't confuse that with golfing: an idiom is not about saving keystrokes, it is about saving "brain cycles". The idea is that a) it is conveniently short so that people do use it and b) when you see it used in a snippet, you immediately know what it does just by the unique look of it.
It simplifies communication between the original programmer and the maintainer of his code.
Makeshifts last the longest.
|Replies are listed 'Best First'.|
Re: Re^4: Cheap idioms
by Sihal (Pilgrim) on Oct 17, 2002 at 13:48 UTC