Live data from Hacker News

“Screw it, I'll make my own” – The story of a new programming language

breuleux.net

1–10 of 74 posts

Re: “Screw it, I'll make my own” – The story of a new programming language

#3
post #2

[deleted]

> I don't understand why people would use a dash "-" inside a symbol

No need to use the shift key. At the levels of efficiency that a good language can reach, this matters.

Also, dashes match established lexicographical conventions better than underscores because dashes look like hyphens.

Re: “Screw it, I'll make my own” – The story of a new programming language

#5
post #2

[deleted]

Well camel-case does reduce the length of the identifier without sacrificing clarity. This can help reduce line length, which, in turn, allows more files to be viewed on a single screen in splits, without wrapping or scrolling. I think this solidifies camel-case as the most practical style, if you ignore aesthetics.

The underscore was invented to allow people using typewriters to underline text.

I think that the hyphen is more pleasing, aesthetically, but overall I think that it's a poor tradeoff.

Re: “Screw it, I'll make my own” – The story of a new programming language

#6
Nice story. I have similar feelings about my own attempt, Runa (https://github.com/djc/runa), in particular about just how large a language (ecosystem) has to be in order to be viable to a few more people.

Still, just the journey is quite interesting. It makes you understand other programming languages and their tradeoffs better, and I'm now much less afraid of parsers and lexers and so on. :)

Re: “Screw it, I'll make my own” – The story of a new programming language

#7
post #3
post #2

[deleted]

> I don't understand why people would use a dash "-" inside a symbol No need to use the shift key. At the levels of efficiency that a good language can reach, this matters. Also, dashes match established lexicographical conventions better than underscores because dashes look like hyphens.

[deleted]

Re: “Screw it, I'll make my own” – The story of a new programming language

#8
post #5
post #2

[deleted]

Well camel-case does reduce the length of the identifier without sacrificing clarity. This can help reduce line length, which, in turn, allows more files to be viewed on a single screen in splits, without wrapping or scrolling. I think this solidifies camel-case as the most practical style, if you ignore aesthetics. The underscore was invented to allow people using typewriters to underline text. I think that the hyph…

why would you ignore aesthetics? I'd much rather spend my time poring over pleasant looking code than ugly looking code.

Re: “Screw it, I'll make my own” – The story of a new programming language

#10
post #5
post #2

[deleted]

Well camel-case does reduce the length of the identifier without sacrificing clarity. This can help reduce line length, which, in turn, allows more files to be viewed on a single screen in splits, without wrapping or scrolling. I think this solidifies camel-case as the most practical style, if you ignore aesthetics. The underscore was invented to allow people using typewriters to underline text. I think that the hyph…

The underscore in computing was developed to be able to separate words used as part of a variable name on computers with only upper-case. Quoting https://en.wikipedia.org/wiki/Underscore#History :

> IBM's report on NPL (the early name of what is now called PL/I) leaves the character set undefined, but specifically mentions the break character, and gives RATE_OF_PAY as an example identifier

It links to the 1964 report at http://bitsavers.informatik.uni-stuttgart.de/pdf/ibm/npl/320... which defines the "_" as the "break" character, on page 22, and on p23 says "[A]n identifier is a string of alphabetic characters, igis, and break characters with the initial character always alphabetic. Any number of break characters are allowed within an identifier; however, consecutive break characters are not permitted. Also, a break character cannot be the final character of an identifier."

(To verify the timing, "_" was not in X3.4 1963 (see http://worldpowersystems.com/archives/codes/X3.4-1963/page6.... ) and that ASCII code point was instead "left arrow".)

You argument regarding "more files to be viewed on a single screen" is valid, but incomplete. It's more a question of total program comprehension rather than a single metric.

This is hard to measure. We can look to related metrics of speed-of-identification and accuracy to see how messy the subject is. The report at http://www.cs.kent.edu/~jmaletic/papers/ICPC2010-CamelCaseUn... says that programmers who are trained in underscore style can recognize underscore style more quickly than camel case, while https://www.researchgate.net/publication/221219628_To_camelc... says that camel case is all around better.

At the very least it suggests that "most practical style" is hard to determine.

Post reply on HN