Live data from Hacker News

JEP 430: String Templates (Preview) Proposed to Target Java 21

openjdk.org

241–246 of 246 posts

Re: JEP 430: String Templates (Preview) Proposed to Target Java 21

#241
post #178

Earlier quoted context omitted.

It's the only sane way. Checked exceptions were a fundamental mistake which basically makes it impossible to actually use (non-RuntimeException derived) exceptions reliably for their intended purpose. As soon as you introduce any higher-order programming (e.g. functions that take other functions as parameters) you start to have to wrap e.g. IOException... but that means that calling code can no longer catch that wrap…

> Of course, this probably happened because Java basically didn't have much in the way of higher-order constructs at the start, so they didn't notice that they were painting themselves into a corner... The problem is generifying over checked exceptions (i.e. parametric polymorphism over checked exceptions), and there's actually an elegant solution that's been long known -- so the "corner" was well-noticed, as well as…

> it's getting there, so stay tuned

It's nice to see from a theoretical perspective. But my impression is that the ecosystem is moving towards having no checked exception. What will happen to the existing code when generics works with union typed checked exceptions?

Re: JEP 430: String Templates (Preview) Proposed to Target Java 21

#242

Earlier quoted context omitted.

> We could have unsigned integers but we're choosing not to because on the whole their disadvantages outweigh their advantages. You (collectively) have this wrong; C, C++, C#, Rust, Go, et al. have it right. As long as we're just stating our beliefs outright instead of justifying them, that is. (That's not a request to justify your opinion; I'm sure it's been argued to death already.) > security experts quite simply…

The problem with unsigned is the ridiculous underflow behavior. Unsigned integers are inherently unsafe without underflow checking at runtime. When you are using signed integers for a positive number, then seeing a negative number tells you everything you need to know (the program is wrong and it will most likely crash soon). However, when you are using unsigned to mean a number that can never be negative, then you c…

My favorite example of this was the major outage at a Swedish futures exchange in 2012 where the system wound up treating an unsigned order quantity as "negative" and placed an order for 4 billion futures contracts: https://www.reuters.com/article/markets-sweden-bug-idUSL5E8M...

Re: JEP 430: String Templates (Preview) Proposed to Target Java 21

#243
post #239
post #217

Earlier quoted context omitted.

I don't think that's working out so well for you, because developers disagree https://survey.stackoverflow.co/2022/#section-most-loved-dre...

Could a diet people would say "works well" be determined by looking at the dishes people say they love most? Topping the list would be foods that are too unhealthy or too expensive, foods that most would agree wouldn’t "work well" as a sustainable diet. When you've followed such polls for many, many years, you see that programmers report they "love" languages that they pick more than those that are picked for them, t…

My 2c, I call Java a phalanx language.

Spears seems unsexy and rather limited compared to swords at an individual level, even a skilled soldier fighting with a long spear would probably lose 1v1 with a soldier who primarily fights with a sword. Put a few dozen of them in phalanx formation though, and the swordsmen don't even stand a chance.

I feel most programmers often judge tools primarily by how they function at an individual level and managers and CTOs pick based on how they perform at scale, and neither side understands the other's priorities much leading to so many debates on this aspect. So it may be unloved by individual programmers(I don't agree with most such people), but people who're responsible for delivering software absolutely love it imho.

Golang too fits in the same category, every time it comes up, half the crowd here likes shitting on it for one reason or other, but quality software is being written in golang in many places.

Re: JEP 430: String Templates (Preview) Proposed to Target Java 21

#244

Earlier quoted context omitted.

Smalltalk should be a no-brainer then. Arguably one of the simplest languages with merely 6 keywords and immense power. The ecosystem is of course a question. I think I can understand the journey from Java -> other -> Java, because as you learn more about programming, you become more capable of solving problems properly in a simpler language. But there might be a point, when you get fed up again with writing the same…

I've tried to get into Smalltalk many times but I find I always get turned off by the required, clunky, development environments

The code browsers?

https://cuis-smalltalk.github.io/TheCuisBook/ch10-ImageSetUp...

Re: JEP 430: String Templates (Preview) Proposed to Target Java 21

#245
post #230

Earlier quoted context omitted.

we should probably also not blow this "problem" out of proportion. If you actively maintain your things, you can probably handle swapping a few strings out that are garantueed to give buildtime errors. If you dont maintain your application and run on antiquated runtimes? well good news, it keeps totally unchanged... edit: okay, i guess if you do some funky stuff like reflection or having stuff in various config files…

It's more involved than just "swapping a few strings". You also need to make sure that all the libraries you depend on are on the same side of the divide, that is, you have to "swap a few strings" and update all your dependencies at the same time (and these updates could bring unrelated breaking changes with them). And some of these dependency changes might be unexpected; you might not expect a general-purpose loggin…

well sure, I have been through this myself, but I have exercised some restraint in my dependency chain, and so should everyone else. Dependencies can be wonderful, or they can be liabilities.

nevertheless, I stand by my point, sure, you may have a little bit of a crappy time, but thats it. If you dont maintain your application? well you're every bit as fine as before. If you do maintain it? well then you had better be updating dependencies at some point, and sure, you might have chosen a dependency that breaks compat and such stuff, but then you have this problem ANYWAY, and are probably running old code with at best just irellevant bugs, but more likely various security implications (as the dependencies are probably not trivial, right? and those bugs might be like the insanity going on in a certain popular logging library...)

Re: JEP 430: String Templates (Preview) Proposed to Target Java 21

#246
post #244

Earlier quoted context omitted.

I've tried to get into Smalltalk many times but I find I always get turned off by the required, clunky, development environments

The code browsers? https://cuis-smalltalk.github.io/TheCuisBook/ch10-ImageSetUp...

Yes
Post reply on HN