News for hackers. Stuff that matters.
Re:Ask HN: Why don't languages such as Java support json-lik... by thiagooffm on Friday November 10, 2017 @03:59AM (#15668754)
Why should it? Is it really a good idea or perhaps you've done loads of Javascript, considers it an important feature and would like to see it there?

I've had this a few times with other programming languages, why doesn't it have guard clauses like erlang, or macros, or X and Y?

I think the reason is that the people who maintain a language got already plenty of work and you try hard to avoid 'Feature creep', meanwhile still satisfying most of the people who uses it(or not...).

You could as well implement the feature yourself, see if people like it.

But just as you've mentioned Java, I have to tell you something. Java took like a decade to implement lambdas(or more). They need to reach consensus, agree a lot of things. Implementing things is easy, agreeing is hard. Most of programming languages got a lot of people with very different interests.

There is a performance hit on having this feature in the compiling phase. It's yet another feature they will need to support. The work to handle this is a huuuge language such as java is absolutely huge, again, not so coding wise, but also the whole ecosystem. People would even have to update their books...

Like if I had a programming language, I would never implement what you said. I don't find it a nice feature.

Re:Ask HN: Why don't languages such as Java support json-lik... by nailer on Friday November 10, 2017 @10:09AM (#15670318)
> already have plenty of work and try hard to avoid 'Feature creep'

It seems a basic thing though. Like String and Number and Array literals (these are also Objects in JavaScript).

I think the answer is more likely to be age and stagnation.

Re:Ask HN: Why don't languages such as Java support json-lik... by tdb7893 on Friday November 10, 2017 @01:59PM (#15672062)
Object literals would be weird in Java. My guess is that they would probably be implemented as essentially calling a no argument constructor and then a bunch of setSomeVar functions. Overall the no arg constructor and a bunch of setter functions often isn't a good pattern in Java in my experience
Re:Ask HN: Why don't languages such as Java support json-lik... by Viliam1234 on Friday November 10, 2017 @02:15PM (#15672177)
There are many other "basic things", for example maps and sets, regular expressions, XML... I am sure others could add more examples... trying to support everything by special syntax would indeed be feature creep.
Re:Ask HN: Why don't languages such as Java support json-lik... by nailer on Friday November 10, 2017 @05:07PM (#15673460)
Well yeah, finding patterns in text, and unique lists are pretty common too. It's not special syntax, it's batteries included.