Hacker News new | ask | show | jobs
by sk5t 1733 days ago
> I think if the Scala creators had been a bit less obsessed with symbology

This might not be something to pin on the language designers, if you're using certain third-party libraries. Indeed it is possible to name a method pretty much whatever you want, with some constraints[0]. Wanna call it "!^"? Go ahead! But, this is afoul of the naming convention in many cases[1]--acknowledging that the convention may have previously been a bit more lax in this regard.

OTOH the distinction between "::" and ":::", and the implications of stuff like "<:" often do require a refresher if they're not part of one's day-to-day.

[0] https://stackoverflow.com/questions/7656937/valid-identifier... [1] https://docs.scala-lang.org/style/naming-conventions.html

1 comments

A house is leaking from the roof.

If the language designers allow methods named "!^", then someone will actually name a method "!^".

Most languages allow a variable called "i", but it is for the programmer to choose when that is appropriate.

!^ might be useful, if the code implements an algorithm which uses this notation in the literature.

A hoarder never throws anything away because it "might be useful". That is not a useful criteria for choosing language features.
I think variables names and infix operators/method names are very different.
> A house is leaking from the roof.

Should one prefer the case where an adult cannot order a steak, because a baby can't chew it? Like, there is a grammar for acceptable identifiers, and it is a little broader than most. To me it seems like a good thing that unicode/multibyte identifiers are allowed, and that not more than the necessary portion of the top keyboard row symbols is reserved.

Yes, I'd like to have a beer with the people who think it's smart to allow punctuation as identifiers. Hopefully by the third pint I could change their minds...