[racket] why do I get undefined , when using internal definition?
Eli Barzilay wrote at 07/10/2011 02:25 AM:
>> it should work as you originally expected, or it should raise an
>> error to complain about an internal "define" referencing itself like
>> that and ignoring the pre-existing binding from the argument.
>>
>
> An error would be nice, but racket never did that. Same as `letrec'.
>
So, I think that this should be an error, given the current semantics:
(define X X)
Maybe that's an extremely simple example of a more general error of
attempting to evaluate an uninitialized variable. At least, I think
that the ones that can be proven statically to always be uninitialized
references should be compile errors. Or is there a good reason for the
compiler to be more liberal?
Separately, I also think that maybe the following should be an error,
since someone doing this with internal-"define" instead of "let" is most
likely a student, and a student probably doesn't mean to do this:
(define (foo name)
(define name ...)
...)
--
http://www.neilvandyke.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110710/91dce4e7/attachment.html>