On 08/25/2012 01:08 PM, Neil Toronto wrote:
On 08/25/2012 10:53 AM, Ryan Culpepper wrote:
On 08/25/2012 12:19 PM, Neil Toronto wrote:
I've reordered these a bit:

number
string
bytes
character
regexp

In other words, "literal data". But did you check that the '#%datum'
macro associated with them has the standard meaning? If not, they could
expand into arbitrary expressions (possibly with side effects)!

A number can expand to an arbitrary expression? How?

And what do you mean by "the '#%datum' macro associated with them"?
Applied to them?

> (let-syntax ([#%datum (lambda (stx) #'(printf "hello\n"))]) 5)
hello

In Racket, literal data carry lexical information just like identifiers. When a literal datum is used as an expression, the macro expander synthesizes a '#%datum' identifier that determines what to do with the literal. The Racket '#%datum' macro just expands into a 'quote' expression if the datum is not a keyword.

The implicit '#%app' syntax works similarly, except it takes its lexical context from the pair that represents the application.

Ryan

_________________________
 Racket Developers list:
 http://lists.racket-lang.org/dev

Reply via email to