2015-09-30 19:35 GMT+02:00 Lyle Kopnicky <lylew...@gmail.com>: > Hi folks, > > It seems that if I (incorrectly) quote a symbol in a 'define' form, it > breaks all symbols from that point on. I would expect instead it would give > me an error saying that I passed the wrong sort of thing to 'define', and > not break future use of symbols. Is this a bug? > > Welcome to DrRacket, version 6.2.1 [3m]. > Language: racket; memory limit: 128 MB. > > 'foo > 'foo >
Note that 'foo is short for (quote foo). > > 'bar > 'bar > > (define 'foo 5) > This is the same as (define (quote foo) 5) which means that you are defining a function named quote that when called with one argument returns the number 5. > > 'foo > . . foo: undefined; > This means (quote foo) i.e. you are now calling the (newly defined) quote function - but the argument foo is not defined - hence the error. > cannot reference an identifier before its definition > > 'bar > . . bar: undefined; > cannot reference an identifier before its definition > > > Try > '3 5 The lesson here is that at the top-level (in the REPL) it is possible to redefine builtin syntax. Here the shorthand ' makes it hard to spot. /Jens Axel -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.