Skip to content

Conversation

@sogaiu
Copy link
Collaborator

@sogaiu sogaiu commented Jan 18, 2025

In a Zulip discussion about the if special form, it came up that the Special Forms page doesn't appear to mention that if and while can introduce new lexical scopes (though the coverage for do and fn touch on the topic).

This PR suggests the addition of some text to remedy the situation.

@sogaiu sogaiu force-pushed the mention-scopes-for-if-and-while branch from 7314580 to af65d34 Compare January 18, 2025 04:41
@sogaiu sogaiu force-pushed the mention-scopes-for-if-and-while branch from af65d34 to 8487790 Compare January 18, 2025 04:51
Copy link
Member

@pepe pepe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rwtolbert
Copy link
Contributor

I think when does the same as if.

@sogaiu
Copy link
Collaborator Author

sogaiu commented Jan 18, 2025

Yes, I think when does.

IIUC, that is because it's a macro that expands to if:

$ janet
Janet 1.37.1-60d9f977 linux/x64/gcc - '(doc)' for help
repl:1:> (macex1 '(when true :hello))
(if true (do :hello))

However, this PR is specifically about the current Special Forms page and I think because when is a macro (and not a special form), it's not covered there.

@sogaiu sogaiu marked this pull request as ready for review January 20, 2025 04:49
@bakpakin bakpakin merged commit 125c160 into janet-lang:master Jan 25, 2025
1 check passed
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

Successfully merging this pull request may close these issues.

4 participants