racket / rhombus

Rhombus programming language
Other
350 stars 62 forks source link

Scope pruning in Rhombus blocks #467

Closed usaoc closed 9 months ago

usaoc commented 9 months ago

This Racket program

#lang racket/base
(let-values ([(id1 id2)
              (let ([id1 (quote-syntax id)])
                (values id1 (quote-syntax id)))])
  (bound-identifier=? id1 id2))

leads to #t, due to “scope pruning” in quote-syntax. However, this Rhombus program

#lang rhombus/static
import:
  meta -1:
    rhombus/meta.syntax_meta

block:
  let (id1, id2):
    let id1 = Syntax.literal 'id'
    values(id1, Syntax.literal 'id')
  syntax_meta.equal_name_and_scopes(id1, id2)

leads to #false. This can make the use of let in macros rather awkward, so we should probably try to align with what Racket is doing.