ByteCode.News
Submit RSS Atom Sign in

Back to the channels

#java

  1. dreamreal https://bytecode.news/posts/2026/03/json-toon-yaml-and-more-considering-data-serialization-formats
  2. Tenchi dreamreal: so did you upgrade to v3 or not ?
  3. dreamreal yes
  4. dreamreal I did not migrate away from JSON anywhere
  5. dreamreal but jackson 3 was implemented, everywhere except in one place
  6. dreamreal but that's a separate article
  7. cheeser yaml is the best data transport format.
  8. DoofusCanadensis look, you
  9. cheeser if you're looking to fight me, i'll add you to the list. i think i have this right. it's a yaml doc so ...
  10. cheeser hey, copilot, i'm getting an NPE because in the code you generated, you're not passing a parameter so the default value of null gets used. fix it, please. "oh, i see what's wrong. I need to pass 'context = null' as an argument so the default value of null doesn't get applied to that parameter."
  11. DoofusCanadensis geez
  12. pengu1nx1 Memory pooling is used for storing many Objects of the same type with short lifespans, right? I don't quite understand the reasoning, does the garbage collector immediately remove free space? Or why is memory allocation so bad?
  13. deebo note sure what you mean with "memory pooling", generic object pooling can be used for situations where the objects are reusable/borrowable and take a "long" time to initialize, like http or database connections
  14. pengu1nx1 I meant that, my bad
  15. deebo outside of the well known uses, probably not worth it, atleast not without validating a bottleneck that could be helped with a pool
  16. dmlloyd https://openjdk.org/jeps/8357464 looks nice
  17. javabot dmlloyd's title: "JEP draft: Enhanced Local Variable Declarations (Preview)"
  18. nevet JEP draft: Enhanced Local Variable Declarations (Preview)
  19. Para Oh I'm loving that.
  20. deebo hmm, is there something blocking typescript type destructuring like {location: {int x, int y}, double radius} = myCircle;, that Circle(Point(...), ...) looks wordy
  21. Para That's more of a TypeScript's quirk though, as its emulating types on top of duck-typed objects.
  22. Para If that lands proper, IDEA's going to have some kind of smart refactoring thing available for picking values anyway so I'm not that worried :)
  23. deebo yeah then you try to indent it and it swaps half your file with ai slop
  24. Para There probably is one step more in squeezing that, but it would look a bit noisy IMHO. Like, either use vars instead of object names. Java already kinda has parsed meaning for ((()()) so it wouldn't be that easy to handle in backwards compatible manner, but as it's a draft, maybe they'll come up with something extra.
  25. Para Like for example if it's a sealed class, the matching is exhaustiva -> allow some shorthand.
  26. deebo great feature though, i'll just end up hating the verboseness and lisp level of () in deep nesting
  27. Para Use proper lisps and it'll be ridinculously simpler :)
  28. Para Destructuring in Clojure is very dense and feature rich.
  29. Para (that family also includes Fennel and jank)
  30. kcomhnall heh, so that jep preview is something that's clearly already existed in other languages? Rust.. Python.. Typscript as you guys already mentioned and others.
  31. kcomhnall yeah..."nice"
  32. kcomhnall or am I missing something?
  33. * kcomhnall suddenly feels like writing in C#
  34. dmlloyd yeah the language team is very careful about adding stuff
  35. dmlloyd other languages are a bit more aggressive about it
  36. kcomhnall by the language team I assume you're talking about project amber?
  37. Para Java the language, JVM the runtime/platform. They're two very distinct things, but obviously interlinked.
  38. Para JVM is bleeding edge, Java is conservative. It has always been like this on purpose.
  39. dmlloyd amber is only one of several projects related to enhancing the language
  40. kcomhnall bleeding edge? huh.. interesting take on a mature runtime env
  41. kcomhnall the maturity is the whole reason I enjoy using Java... hardened and w.o.r.a are important for my projects.
  42. kcomhnall "JVM"
  43. MikeBux i still wan to learn a compiled language like go, rust or c/c++ though,
  44. dmlloyd that's also a poor distinction, as java is compiled at run time, and can optionally be pre compiled to a native executable by projects such as graalvm
  45. Para Maturity and bleeding edge are not exclusive either; that's why e.g. that draft is available through feature flag as preview.
  46. MikeBux yes but the usual way is to compile the bytecode at runtime, which means, every time you want to run a program, it needs to be compiled
  47. kcomhnall ~karma Para
  48. javabot para has a karma level of 24, kcomhnall
  49. kcomhnall hmm
  50. dreamreal jep 8357464
  51. nevet jep 8357464: draft: Enhanced Local Variable Declarations (Preview) (https://openjdk.org/jeps/8357464)
  52. dreamreal pengu1nx1: that's a very complex subject; java's memory model is largely pluggable and therefore there's not a great answer to it that is actually correct for all cases
  53. dmlloyd the upside of jit compilation is that you get compiled cods tailored for your cpu's features every time, which isn't always possible or practical with precompilation
  54. Para look also: linux kernels
  55. dreamreal yeah, sometimes there's a question of whether you need it or not: tradeoffs everywhere
  56. dmlloyd code, not cods 🐟
  57. dreamreal I don't mind go but I've failed to be impressed with it
  58. Para vibe cod
  59. dreamreal I do mind rust but OTOH it HAS impressed me
  60. dreamreal https://bytecode.news/posts/2026/03/enhanced-local-variable-declarations-in-java
  61. nimaje dmlloyd: well for that you could also change the system to compile to some IR, distribute that and on install optimise it for the target cpu (afaik android does that)
  62. dreamreal nimaje: it's doable, yes
  63. dmlloyd well, java bytecode _is_ an IR
  64. dreamreal I have a project that runs on an embedded device that's, well, Intel, sort of... we COULD theoretically AOT it externally but that's a lot
  65. dreamreal (It is intel but we don't know the exact cpu profile)
  66. Para IA-32
  67. nimaje a jit can additionally optimise on concrete runtime values, especially if it knows that it will be loaded once and then stay the same
  68. dreamreal yes, we're aware :D
  69. Para That sounds like AI to me!
  70. dreamreal you know, as time goes by I hate the "AI" label more and more
  71. dreamreal I mean, AI is... a whole series of algorithms, an LLM is just one variant and an expensive one
  72. nimaje about everything is AI, be more specific
  73. cheeser dmlloyd: so that JEP is destructuring, basically
  74. dmlloyd yeah basically, at least for the local variable case
  75. dmlloyd it will be very helpful for cases where you have to interrupt/split an otherwise trivial conditional to introduce a local variable
  76. dreamreal How expensive is that, though
  77. dreamreal (interrupting/splitting an otherwise trivial conditional...)
  78. dmlloyd the only cost would be at compile time; the bytecode is the same
  79. dmlloyd oh, the cost there is reduced readability
  80. dmlloyd in other words, the language enhancement will enable better readability
  81. dreamreal ... will it? I mean, it might - and destructuring CAN be useful in some languages, but the places where it'd really matter would be really limited. Simple expressions might benefit but I really do wonder how many people are desperate for deconstructed declarations like that.
  82. dreamreal I've been using Java since 1998, and I've yet go to "dang, I sure wish java let me do deconstructed declarations," not that it might be the best thing java's seen since sliced bread or whatever
  83. Chronos What's an example of a deconstructed declaration?
  84. dreamreal Predicate(subject, predicate, value) = p.rdf; // do something with subject
  85. Chronos dreamreal: Thanks.
  86. * Chronos is mildly skeptical of the value of that particular syntactic sugar.
  87. Chronos It looks like Java 21 has something called "Record Patterns" which has some kind of deconstruction.
  88. Chronos If I'm understanding this correctly...
  89. Chronos For example: Object obj = new Person("Alice", 30); if (obj instanceof Person(String name, int age)) { ... }
  90. dreamreal yes
  91. dreamreal but that's a different level of deconstruction
  92. Chronos Oh, it looks like JavaScript has had this feature since ES6
  93. Chronos dreamreal: Ah.
  94. Bombe dreamreal, eh, I feel the same about pattern matching.
  95. Bombe It always feels like I’ve failed to properly utilize OOP when I suddenly need to know the type of an object.
  96. Chronos OK, I can see how this syntactic sugar could be nice :)
  97. cheeser i've wanted destructuring plenty of times in java but kotlin kinda ruined me in that regard.
  98. cheeser pattern based destructuring will be fine, i guess, but not as convenient as kotlin's syntax.
  99. dreamreal that's kind of the problem: kotlin has it, other languages have it, does java NEED it?
  100. dreamreal I mean, it's possible; it might be a simple extension of the switch/case stuff
  101. sbalmos depends on whether you see continued viability of the ecosystem as Java-centric, or JVM-centric
  102. dreamreal That's a good point - I guess I see it as jvm-centric so it's kinda meh for me to worry about destructured stuff