Re: Paul Graham's Arc is released today... what is the long term impact?
- From: Damien Kick <dkixk@xxxxxxxxxxxxx>
- Date: Mon, 18 Feb 2008 21:49:47 -0600
Kjetil S. Matheussen wrote:
[...] I still end up writing the macro version instead
only because "(when a b)" is faster to read
than "(when a #'(lambda () b))".
Really? Faster to read. If you sat down with a stop watch and actually timed yourself, how long do you think it would take you to read either form. What is the speed advantage of the first form? What are you shaving off your read time? The first form takes you only five seconds while the second takes all of twenty seconds? I'm only kidding, though. Surely you don't read that slowly. The macro form takes only one second while the lambda form takes all of two seconds? If you write all of your code in the first form, you can go home a full hour and a half hour sooner because you've shaved off all that unnecessary time reading that cumbersome lambda form. Maybe if you remove the speed bump of #', you could go home an hour earlier.
Really?
I can fully understand that people have personal preferences. Some people like short pithy names or just plain hate vowels, but even Ken Thompson admits that if he had to do it over all again, he would've spelled creat with the 'e'. Some people like long names which almost read like sentence fragments. But I really can't stand having to sit through code reviews in which people try and explain their purely subjective preferences with these bull*** pseudo-objective justifications like "it is faster to read."
I like (when a b) better, too. But that's because I already know that WHEN does not FUNCALL it's second argument. My difficulty in reading the one over the other has nothing to do with laboring over all those extra characters. (Honey, I'm going to have to stay late at work tonight. I'm having a hard time reading all those damn lambda forms. If only the designers of Common Lisp had used something four characters shorter!) It's trying to figure out why you wrote (when a #'(lambda () b)) as an alternative to (when a b) instead of (when a (funcall #'(lambda () b))). In other words, WHEN is a bad example because it's semantics are already defined. If you happen to be writing something with the semantics of a WHEN, i.e. introducing syntax for a new control structure, perhaps a macro is the best way to write it because of purely semantic reasons.
And if every Lisp operator was defined to take an anonymous function which would be FUNCALLed, I would probably find it annoying to have to use LAMBDA everywhere, too.
CL-USER> (defun when* (test value)
(when (funcall test)
(funcall value)))
WHEN*
CL-USER> (when* #'(lambda () (< 13 69))
#'(lambda () :is-less-than))
:IS-LESS-THAN
CL-USER>
If every Lisp operator was defined like this hypothetical WHEN* function, then all of those LAMBDAs everywhere would get to be truly annoying. But that would have nothing to do with the word LAMBDA. It would have everything to do with unnecessarily having to wrap everything into an anonymous function, regardless of the syntax used for it.
.
- Follow-Ups:
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: Kjetil S. Matheussen
- Re: Paul Graham's Arc is released today... what is the long term impact?
- References:
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: Kent M Pitman
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: John Thingstad
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: Rob Warnock
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: Joost Diepenmaat
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: Ron Garret
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: Marco Antoniotti
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: Thomas F. Bur***
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: Espen Vestre
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: danb
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: Joost Diepenmaat
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: George Neuner
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: Joost Diepenmaat
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: Damien Kick
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: Joost Diepenmaat
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: Damien Kick
- Re: Paul Graham's Arc is released today... what is the long term impact?
- From: Kjetil S. Matheussen
- Re: Paul Graham's Arc is released today... what is the long term impact?
- Prev by Date: Cells/Arc
- Next by Date: Re: Cells/Arc
- Previous by thread: Re: Paul Graham's Arc is released today... what is the long term impact?
- Next by thread: Re: Paul Graham's Arc is released today... what is the long term impact?
- Index(es):