Skip to content

racket-var doesn't work in reference position #79

@michaelballantyne

Description

@michaelballantyne
#lang racket

(require syntax-spec-dev)

(syntax-spec
  (nonterminal dsl-expr
    (dsl+ e:dsl-expr e2:dsl-expr)
    v:racket-var)
  
  (host-interface/expression
    (dsl e:dsl-expr)
    #'#'e))

(let ([x 6])
  (dsl (dsl+ x 5)))

This is probably because it would need to be a special case; Racket variables don't have a syntax-local-value.

And the thinking in the table here shows that we can't actually distinguish all the cases:

;; situation ; identifier-binding ; syntax-local-value ; syntax-debug-info
;; bound as syntax ; non-#f value ; environment value ; has matching binding(s)
;; note: the following two cases can't be easily distinguished; this is why `lookup`
;; never tells you a name is unbound or out-of-context, and instead can only tell you
;; that it isn't bound to the particular kind of syntax you check via the predicate.
;; bound as racket ; non-#f value ; fails ; has matching binding(s)
;; out of context ; non-#f value ; fails ; has matching binding(s)
;; unbound ; #f ; fails ; no matching bindings (I hope!)
;; ambiguous ; #f ; fails ; has matching binding(s)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions