guile-user
[Top][All Lists]
Advanced

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

Re: Why is an empty lambda body not allowed?


From: Tobias Brandt
Subject: Re: Why is an empty lambda body not allowed?
Date: Fri, 4 Jul 2014 21:14:43 +0200

Hi Taylan,

your points are all good and I kind of get the reasoning behind the current semantics. I'm not trying to start a big discussion here, it's just a little detail I noticed and that bothered me. 

I don't really care what (lambda ()) evaluates to as long as it's consistent with the rest of the language. But what rubs me the wrong way is that

    (define x (begin))
    (lambda () x)

is not the same as

    (lambda () (begin))

because one of the strength of functional programming is referential transparency. Therefore I would expect the definition of x (which has no side effects) to be substitutable for x itself. This is apparently not the case as one (begin) has a different meaning than the other because of its context.

As another data point, this seems to be fine:

    (use-modules (oop goops))
    (define-method (foo))

So, GOOPS doesn't mind empty method bodies. However

    (define-method (foo) (begin))

fails. Not very consistent either, I'm afraid.

Cheers,
Tobias

reply via email to

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