pyret-lang icon indicating copy to clipboard operation
pyret-lang copied to clipboard

Any good reason to disallow identifiers beginning with digit?

Open ds26gte opened this issue 1 year ago • 2 comments

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

2x = 2 * x
-y = 0 - y

ds26gte avatar Oct 23 '24 12:10 ds26gte

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!

jpolitz avatar Oct 23 '24 16:10 jpolitz

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.

shriram avatar Oct 23 '24 21:10 shriram

Agreed. I think we should close as WontFix, but I don't think I have the authority to do that

schanzer avatar Sep 11 '25 15:09 schanzer

Agreed. Filing under “just because we can, don't”

jpolitz avatar Sep 11 '25 16:09 jpolitz