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

Any good reason to disallow identifiers beginning with digit? #1764

Open
ds26gte opened this issue Oct 23, 2024 · 2 comments
Open

Any good reason to disallow identifiers beginning with digit? #1764

ds26gte opened this issue Oct 23, 2024 · 2 comments

Comments

@ds26gte
Copy link
Contributor

ds26gte commented Oct 23, 2024

Also identifiers starting with hyphen. These would be great for naming the results of algebraic operations, such as

2x = 2 * x
-y = 0 - y
@jpolitz
Copy link
Member

jpolitz commented Oct 23, 2024

Both of those are super misleading as “just” identifiers in algebra notation, and are things a student or teacher might write expecting an operation to happen.

I think this is a good nudge to give special error messages for those cases!

@shriram
Copy link
Member

shriram commented Oct 23, 2024

I agree. If we make these identifiers work, teachers will expect all kinds of things to "just work", especially the math teachers: if I write

x = 2
y = 4
2xy

is that 16?

There are a handful of times in Racket where I make use of this, and it's true that I do miss it in Pyret in those situations. But the likelihood of confusion/misconceptions, especially with one of our major audiences (programming-unsophisticated middle-school math teachers) is far, far greater and more important.

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