[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Inconsistent 'return value' for definitions
From: |
Mark H Weaver |
Subject: |
Inconsistent 'return value' for definitions |
Date: |
Sun, 29 Jan 2012 17:38:17 -0500 |
Hello all,
I think the following behavior is inconsistent and undesirable:
scheme@(guile-user)> (list (compile '(define foo 3)))
$1 = (#<unspecified>)
scheme@(guile-user)> (list (primitive-eval '(define foo 3)))
$2 = (#<variable 103b9c80 value: 3>)
It doesn't really make sense for 'define' to return a value, because it
cannot be used in expression context. AFAICT, the only way to get this
'return value' is to call 'eval' or 'primitive-eval'. This weirdness
has bitten Paul Smith in his efforts to port his code to Guile 2.
I think we should change 'define' to always "return" SCM_UNSPECIFIED, at
least in 2.2. We might also consider nipping this in the bud and making
the same change in 2.0.4.
Thanks,
Mark
- Inconsistent 'return value' for definitions,
Mark H Weaver <=