Live data from Hacker News

Sometimes Java is just weird

vsadt.com

1–10 of 19 posts

Re: Sometimes Java is just weird

#3
The only weird thing to me is this:

> # There are 46,908 different valid characters that you can use in an identifier

And yet among all those characters I can't have a question mark at the end of a boolean variable or function name...

Anyway, weirdness is no excuse for not supporting a feature in a parser!

Re: Sometimes Java is just weird

#4
post #2

Perhaps I am nitpicking here - but it's "weird" not "wierd". Also, I am not sure rewording the title added any value. The title of the article IMO was just fine - See http://ycombinator.com/newsguidelines.html

Thank you for the correction. I guess I was typing too fast. :-)

Re: Sometimes Java is just weird

#5
post #3

The only weird thing to me is this: > # There are 46,908 different valid characters that you can use in an identifier And yet among all those characters I can't have a question mark at the end of a boolean variable or function name... Anyway, weirdness is no excuse for not supporting a feature in a parser!

That must be because of the ternary operator:

    condition ? result-if-true : result-if-false
although you're probably right that a smarter parser should be able to distinguish between both cases. But then the next guy comes along and complains that he can't use a colon as a valid character in his variable names...

Re: Sometimes Java is just weird

#6
post #3

The only weird thing to me is this: > # There are 46,908 different valid characters that you can use in an identifier And yet among all those characters I can't have a question mark at the end of a boolean variable or function name... Anyway, weirdness is no excuse for not supporting a feature in a parser!

Bear in mind that this parser's job is only for syntax highlighting and, later on, refactoring. Hmmm... maybe highlighting literals would be useful. I'll have to think on that.

Re: Sometimes Java is just weird

#8
"For now, I'm not going to support this in the parser as it appears to be a fairly dusty corner of the language. Maybe at some later date."

And that is why this particular parser won't pass the Java TCKs.

Re: Sometimes Java is just weird

#9
I understand the need for localization and all, but 46 THOUSAND characters? Jeez.

There are that many Han characters alone, so I’m not sure what the surprise is. It’s not like you have to hard-code them in your grammar.

If anything, I’d hope that new languages in 2010 allow any of the roughly 100,000 non-control non-whitespace [edit: non-punctuation] Unicode characters. For a lot of the code I see, ASCII is at least as constraining as, say, fixnums would be.

Re: Sometimes Java is just weird

#10
post #9

I understand the need for localization and all, but 46 THOUSAND characters? Jeez. There are that many Han characters alone, so I’m not sure what the surprise is. It’s not like you have to hard-code them in your grammar. If anything, I’d hope that new languages in 2010 allow any of the roughly 100,000 non-control non-whitespace [edit: non-punctuation] Unicode characters. For a lot of the code I see, ASCII is at least…

Actually, it is possible it does. I only ran the test from 0x0000 to 0xFFFF. Maybe I should revisit.
Post reply on HN