[plt-scheme] Re: Using PLT Scheme libs elsewhere?
On May 20, 2007, at 4:34 PM, SpinyNorman wrote:
> Is the (UNLESS ...) vs. (IF (NOT...)) issue purely stylistic, or for
> enhancing clarity for the poor schmo who has to read my code a month
> from now, or would you expect a speed difference?
One-armed if is a great way to do really stupid things. This is
because many scheme forms contain a "body ...", and it's easy to make
this assumption for if as well.
Not that I would ever do something this startlingly stupid, but:
Week 1: I write this code:
(if (file-is-larger-than-3-gig)
(delete-file file-name))
Week 2: let's add some logging:
(if (file-is-larger-than-3-gig)
(printf "name of file is: ~v\n" file-name)
(delete-file file-name))
Oh... I just deleted every file smaller than 3 gig.
Oh dear.
Note that "unless" makes it easy to avoid this problem.
John Clements
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2223 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20070520/c42525a7/attachment.p7s>