Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A let before another def in the same block #480

Closed
usaoc opened this issue Feb 17, 2024 · 2 comments
Closed

A let before another def in the same block #480

usaoc opened this issue Feb 17, 2024 · 2 comments

Comments

@usaoc
Copy link
Collaborator

usaoc commented Feb 17, 2024

(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?

@samth
Copy link
Sponsor Member

samth commented Feb 17, 2024

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

@mflatt
Copy link
Member

mflatt commented Apr 4, 2024

Made an error in bfbb097

@mflatt mflatt closed this as completed Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants