4 ms·
Why do you say it's for data? Doesn't racket use "reader macros" heavily for language syntax, or am I misunderstanding something?
by mmalone 9y ago
Why do you say it's for data? Doesn't racket use "reader macros" heavily for language syntax, or am I misunderstanding something?
- soegaard 9y agoFWIWI The term "Reader macros" has slightly different meanings in Common Lisp and Racket. In Racket reader macros are used to modify the existing reader. Languages that have "almost" the same syntax as Racket can therefore use reader macros. Languages with new syntax (Scribble, Pascal, etc) don't use the Racket reader, but provide their own.
- lispm 9y agoYou can reprogram the reader. But by default the reader knows nothing about a programming language. All it implements is reading of data: numbers, symbols, strings, vectors, arrays, ... The reader does not know about functions. Something like (defun foo (bar) (+ bar 10)) is for the reader just another list. It does not know that the first symbol has to be DEFUN, that the next item needs to be a symbol, that the next item is a list of arguments and that then a sequence of body expressions follows. Something like (defun (bar) foo + (bar 10)) is also a valid list, but it is not a valid Lisp expression. The reader does not know that.