guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why not support (begin), (cond), (case-lambda), etc?


From: Mark H Weaver
Subject: Why not support (begin), (cond), (case-lambda), etc?
Date: Thu, 05 Jan 2012 19:49:44 -0500

Hello all,

I'd like to argue in favor of supporting (begin), (cond), (case-lambda)
and other such degenerate forms, for the same reason that we support
(*), (+), and (let () ...).

First of all: Is there any compelling reason not to support them?
I can't think of one.  Can you?  If so, please do tell.

Imagine if we didn't support (*) and (+).  Then you couldn't simply
write (apply + xs) to add a list of numbers; instead you'd have to write
(if (null? xs) 0 (apply + xs)).  In other words, they simplify
higher-order programming by freeing the user from handling degenerate
cases specially.

The same argument applies to (begin), (cond), and (case-lambda).  They
simplify writing robust syntax transformers without having to handle
degenerate cases specially.

Apart from this general argument, I can think of one particularly
compelling reason to support (begin).  Suppose you have a macro that
generates a sequence of local definitions.  How do you return an empty
sequence of definitions without terminating definition context?  The
only way I can think of is to generate a dummy definition with a gensym
name.  That's very ugly.  Why force users into such complications
needlessly?

     Mark



reply via email to

[Prev in Thread] Current Thread [Next in Thread]