rhombus-prototype icon indicating copy to clipboard operation
rhombus-prototype copied to clipboard

A `let` before another `def` in the same block

Open usaoc opened this issue 1 year ago • 1 comments

(Found during the writing of e7dc0d9; opening for public attention)

Currently, a let can “scope over” another def in the same block:

#lang rhombus

block:
  let x = "outer"
  def x = "inner"
  // refers to the `let` binding, i.e., "outer"
  x

This is because the let binding has an extra scope (in order to achieve “forward definition”) compared to the def binding. Is this a reasonable behavior? And in general, how should let and def interact within the same block?

usaoc avatar Feb 17 '24 08:02 usaoc

I think either an error or "inner" are acceptable behaviors here.

samth avatar Feb 17 '24 12:02 samth

Made an error in bfbb0975096f34a8bbe9e566ce912555427a114a

mflatt avatar Apr 04 '24 20:04 mflatt