squiggle icon indicating copy to clipboard operation
squiggle copied to clipboard

Allow uppercase identifiers in Squiggle

Open berekuk opened this issue 11 months ago • 1 comments

Reasons:

  1. We've allowed them by accident in 0.9.0 and 0.9.2, and some models on Squiggle Hub are stuck on those versions.
    • we could handle this manually by emailing authors, but that's annoying to do
  2. We already have String(...), Calculator(...) etc. function on Squiggle.
    • It's possible that after we get structs we could convert these to constructors, but it's hard to tell if that's the case.
  3. The arguments in favor of lowercase-only identifiers are kind of weak:
    • Coding style - other languages (Python, JS) don't do this and they're fine; allowing uppercase is not any worse than allowing camelCase and snake_case
      • OTOH, our error reporting is mediocre and users could get confused
    • Reserving UpperCamelCase for some future feature, e.g. structs - I think for structs we're fine as is; and for some other low-level namespace for those, we could always fallback to weird sigils, e.g. $foo (I don't expect we'll need this though)

berekuk avatar Jan 06 '25 20:01 berekuk

I think I'm happy to add them back in. Could become a decent style for custom-made libraries and the like.

OAGr avatar Jan 07 '25 19:01 OAGr