"Chris K. Jester-Young" <cky...@gmail.com> writes: > On Tue, Dec 06, 2011 at 11:08:08PM +0100, David Kastrup wrote: >> > Have you considered using `(values)' as your way of saying, "I'm not >> > returning any values"? >> >> Testing for that is not all that much fun. It is also rather useless >> since pretty much all of the call-for-effect functions of Guile return >> *unspecified* rather than (values). > > You're not really supposed to test for it.
Lilypond is not Scheme but has a more complex syntax. You can use Scheme in a lot of places with different implications on the grammar depending on the type of the expression. It would not be feasible to create a separate Scheme calling operator for every possible type of expression. And "called just for action" is one such type. >> It is not clear to me why (values) can't just evaluate to a single >> *unspecified* just like '() evaluates to null. Outside of >> call-with-values, I don't see much need to treat it special. > > Implementing that would pretty much either require CPS transforms all > around (then you'd look at the arity of the continuation), or else > you'd have to be keeping track of the arity of the current > continuation some other way. Is it just me, or does that smell like > Perl's wantarray? Well, you'd need to have (call-with-values (lambda () *unspecified*) (lambda x (length x))) => 0 That's the actual clincher I presume? If one takes a look at the Scheme language definition, one finds for one thing: (define (values . things) (call-with-current-continuation (lambda (cont) (apply cont things)))) And, more importantly: Except for continuations created by the call-with-values procedure, all continuations take exactly one value. That means that one _only_ needs to consider the implications on call-with-values continuations. And it is not like Guile has a problem distinguishing content and package itself (at least Guile 1.8): guile> (write *unspecified*) #<unspecified>guile> (write (values)) #<values ()>guile> So I still don't quite see the problem that would arise from making (eq? *unspecified* (values)) => #t -- David Kastrup