Submit

Back to the channels

#primate

  1. nevet [ByteCode.News] Where Does The Experience Come From? - https://bytecode.news/posts/2026/11/where-does-the-experience-come-from
  2. blue dreamreal: thoughts on `var` in java? after we moved to java 21 at work, my boss signalled being against it. I largely agree, in that. a strongly typed language that hides its types is.. weird. That being said, the verbosity of potentially declaring the same type left and right is weird. a language should provide good abstractions for it
  3. blue (this is slightly related to the above article)
  4. blue (re knuth "read like essay")
  5. dreamreal It doesn't hide the types, though: var foo=new ArrayList<String>() <-- the type is right there, why would you NEED it redeclared? var isn't appropriate outside of tightly scoped functions
  6. blue cit approach: enforce left, be nice on right; Point point = { x: 1, y: 2 }; where Point is a struct with fields x and y, both i32
  7. dreamreal I'm actually kinda neutral on var
  8. dreamreal I use it but eh
  9. blue dreamreal: it doesn't in YOUR example. but it does when right is NOT a `new`
  10. blue the invariant isn't universally held
  11. blue ex: `var foo = bar.subList(0, 1);`
  12. * dreamreal nods. I am not a pedant when it comes to var. Use it when it helps, ignore it when it does not.
  13. dreamreal It is not rocket science.
  14. dreamreal if that means no var ever, well, there you are: you have to be able to read your own codebase.
  15. blue nothing is rocket science, except rocket science. however, communicating intent, and being transparent, are invaluable, I think. it's nice to know this is a List or an ArrayList *without* hovering over it
  16. blue `var` feels to much javascripty to me: in a bad way, for a statically typed language
  17. blue too much*
  18. dreamreal If you're using concrete types in your lvalue without that being significant, you're doing it wrong!
  19. dreamreal var comes from languages like JS, scala, kotlin
  20. blue ya hence List
  21. blue I'm just not very comfortable with var; or auto in c++, for that matter. I fear the gains aren't significant, and the payment is dear
  22. blue anyway, good article
  23. dreamreal Thank you.
  24. blue dreamreal: btw, another thought: "The LLM affirms" is generally, but not *universally* true. In my example, "the clanker is servile" is the more accurate observation. It will generally pushback first, if it can; especially if the conversation has little charted ground yet (your tone is less authorative). Generally speaking, it will try to accomodate a niche between its general knowledge and your wishes. But
  25. blue it doesn't affirm universally, all the time, everywhen
  26. blue In my experience*
  27. blue push back*
  28. blue authoritative*, oof, my typing is terrible
  29. blue dreamreal: anthropic IPO nov 20 or thereabouts
  30. blue hi phaleth
  31. phaleth hi blue
  32. blue 0.45 expected this week, god willing
  33. blue also known as the Trump #1 release
  34. blue :P
  35. blue I hope 0.46 won't be slow...
  36. blue ^ dreamreal
  37. phaleth repopack is already updated to 0.44
  38. blue yes
  39. phaleth mobile perf of primate website is still very good https://pagespeed.web.dev/analysis/https-primate-run/wyxa3mh0bb?form_factor=mobile
  40. phaleth is the website expected to become slower?
  41. jreicher blue: I use var wherever it's possible, partly because finding where it's not possible is sometimes useful information.
  42. jreicher Ditto with <>
  43. jreicher I'm aware of (respectable) arguments against var though
  44. blue jreicher: I do use <>; also recommend by my boss. but var I do not use at all; I wouldn't use it even had he blest it
  45. blue recommended*
  46. blue as I laid out above, there are scenarios where using var obscures the type, when you read it. this isn't a big deal statically, but it makes overviewing code harder, for no good reason other than terseness
  47. blue it also violates a certain principle wherein Java is different than JS; a JS var/let/const can bind to any type; this is not the case in java; but `var` seems to suggest that. And last but not least, the name is preencumbered by other programming languages
  48. blue I think those three arguments satisfy the threshold of "not worth to use"
  49. blue dreamreal: flog is edging closer to being able to format the rcompat project; after that, primate. if you wish, I can also train it on `ui-primate`
  50. blue note that it formats in an opinionated way, much like prettier does; 2-spaces, double quotes, 80 columns
  51. blue the main adventures is that it is very fast and that it spares you from dealing with a formatting policy in your project
  52. blue it will format .ts and .js files for starts, probably .tsx/.jsx later (irrelevant in your case, you use marko)
  53. dreamreal blue: not a matter of wishes on my part, if it's useful, USE IT
  54. blue dreamreal: primate 0.45 is getting transactions, and it is absolute amaze sauce!
  55. jreicher blue: your last two points aren't relevant to Java because, quite literally, they are not about Java. It's not really a valid argument to criticise a language for confusions suffered by people proficient in other languages.
  56. blue await using tx = await db.transaction(); /* await OtherStoreINeedLocked.lock(); await Store.update(); await tx.commit();`
  57. blue a few notes about `await using` in JS: it's relatively; it uses known global symbols to allow you to clean up automatically upon leaving context; in this case, the transaction will automatically roll back if the route handler throws
  58. blue relatively new*
  59. blue it also uses async context, which is another, not new, but relatively lesser known feature of JS. it basically allows you to 'serialise' (I'm oversimplifying it) callbacks
  60. blue I learnt about it a year or two ago from systemfault, and it's really cool. this is how we 'connect' the stores to the transaction
  61. blue it's a bit of magic, but I think it's good magic (tm) there
  62. blue hm, I botched up the example, should have not written /* there
  63. blue jreicher: I disagree. language designers do not live in a vacuum. they look at prior art, and it's a perfectly valid argument to criticise them for confusings they have created, by overloading known terms
  64. blue example: TS people refer to arrays like this: [string, number] as tuples. the term is misleading: tuples are NOT arrays of a fixed length and fixed types. I suppose they borrowed the tuple term because in this case, the order of the types matters, but they are not tuples. it would have been better to call them bounded arrays or something that expresses better what they are, but the decision was made to call
  65. blue them tuples
  66. blue the java designers have choices; they could come up with a new keyword, they could choose to not introduce `var` because on how ubiquitous it is already, the fact it exists in js, is highly associated with it, and even in js itself, has very confusing semantics (hoisting). the java designers would have been better served with `auto`, which would have been just as overloaded, but at least in a very similar
  67. blue manner, in another strongly typed language
  68. blue as it stands, they made the more confusing choice
  69. blue and it's 100% on them and on no one else
  70. blue historically java already shared many confusing similarities with js; js' Date was modelled after java's. this is, of course, not java's fault, but as said, the designers do not exist in a vacuum
  71. jreicher Why is it not a valid complaint to say Java is right and the other languages are wrong? You seem to place a high value on tradition.
  72. blue because 'right' means nothing when the choices you made serve to confuse rather than elucidate
  73. jreicher What if the Java designers believe they are elucidating, and it's worth the cost?
  74. jreicher I should perhaps add this is not theoretical for me. I'm working on a language design that does exactly this.
  75. blue then they are gravely mistaken, in my eyes, in that instance. I do not know who they wanted to elucidate with such a poor choice of an historically heavily burdened term
  76. jreicher Well I can't take myself as an example. The term they chose has worked excellently for me. That's one of the reasons i use it every chance I get.
  77. jreicher ^can't^can
  78. blue in my eyes, `var` is eternally burnt by js. I might not like it, but any other language I come across, it confuses me. scala has the same situation
  79. jreicher And I don't feel the same way, because my exposure to JS is much less than my exposure to other languages.
  80. blue in your language, you might not have much or any history with JS, which is ok, in that case that term would work for you
  81. blue but for most people it wouldn't. js is extremely ubiquitous
  82. blue s/in your language/in your case/
  83. jreicher Ah, now we come to the truth of it. You believe JS has special status.
  84. blue I don't. What special status should it have?
  85. dreamreal are we still yapping about var?
  86. jreicher You believe it's special in its ubiquity. If a relatively "unpopular" language loaded a term I don't think you would be bothered.
  87. blue this works both ways: it was a mistake by JS to replicate Java Date. They are paying for this until today. Temporal is a dumpster fire whose only existence is on account of the fact Date is so terrible
  88. jreicher dreamreal: kind of. Not the concept of it (LVTI) but now just the name.
  89. dreamreal I mean, var was requested: it's relatively safe in that it can infer its type from the use; people wanted var; they got var.
  90. jreicher blue: I understand your point, but I don't believe JS has the status you think it does.
  91. blue dreamreal, that isn't the discussion at all. the discussion is whether language designers exist in a vacuum, and shouldn't look around when introducing new constructs, and using terms that are heavily encumbered
  92. dreamreal scala and kotlin, other popular JVM languages, used var (and val), so there you were
  93. jreicher Where "heavily encumbered" means "in use by a language of exceptional popularity according to the person making the criticism"
  94. blue it's not according to me, it's a quasi-universal truth
  95. jreicher According to you. :)
  96. blue "JavaScript is the most widely used language among professional developers, utilized by approximately 68.9% of them in 2025"
  97. blue this is factual, you can look it up yourself, in countless surveys and reports
  98. jreicher I understand your point. I still don't think the popularity has the special status you think it does.
  99. jreicher It's a bit like saying "most happy songs are written in a major key, so you can't use a major key for an unhappy song"
  100. jreicher Statistically true, stylistically false.
  101. blue you still haven't answered the question of why java couldn't have chosen a more appropriate identifier
  102. blue auto and others come to mind
  103. jreicher I don't know the answer. There might have been something compelling the choice of "var".
  104. blue heck, even scala's `val` would have been better. it's *way* less encumbered
  105. jreicher Check the original JEP perhaps?
  106. blue " - While it was not the most popular choice in the survey, it was
  107. blue clearly the choice that the most people were OK with. Many hated
  108. blue var/val; others hated var/let. Almost no one hated var-only."
  109. blue so basically, it was vibe-designed. great.
  110. blue https://openjdk.org/jeps/286 and https://mail.openjdk.org/pipermail/platform-jep-discuss/2016-December/000066.html (SYNTAX)
  111. nevet https://openjdk.org/jeps/286 "JEP 286: Local-Variable Type Inference" || https://mail.openjdk.org/pipermail/platform-jep-discuss/2016-December/000066.html "Update on JEP-286 (Local Variable Type Inference)"
  112. blue note that javascript isn't even mentioned as prior, whilst much more obscure languages (groovy???) are mentioned as reference
  113. blue this is ridiculous
  114. jreicher According to you
  115. blue of course it's according to me
  116. blue this is my opinion
  117. jreicher And I'm OK with you having that opinion. :)
  118. blue I understand that clearly
  119. blue but people "hating" stuff is a good way to design a language
  120. blue isn't*
  121. blue there are other considerations
  122. blue the email mentioned `var` wasn't even the most popular choice
  123. jreicher yes, but it also describes the designers' reasoning based on statistical fact. So in their opinion they had a compelling reason for "var", and it's not obvious your reasoning is superior.
  124. blue I don't care for `var` or `auto`, in this case. the way they look doesn't play a significant role for me, and honestly, nor should it for the language's designers, I would imagine
  125. blue prior art, and how real people might perceive the feature, is way more important than some commitee's aesthetic prefs
  126. blue this isn't somewhere in the aether; my boss said he rejected `var` partially on account of how javascripty it feels. this isn't evidence for a general pattern, but I can imagine other people out there in the big wide world feel the same
  127. blue maybe they're a minority. maybe java users are perfectly content with var, and there's no confusion, and wide adoption; I wouldn't know really
  128. blue but one thing you cannot argue: you cannot argue a "should" from an "is" (Ist->Soll). the fact this is already decided and out there, and people, you amongst them, use it (even happily), doesn't make it good
  129. blue I use many features of JS that I don't like...
  130. blue ugh, this reminds, TS using private members for type comparison is an abomination...
  131. blue "Apache Groovy is a Java-syntax-compatible object-oriented programming language for the Java platform."
  132. blue TIL...
  133. blue people *use* that?
  134. blue dreamreal: ^
  135. blue def myGroovyBean = new AGroovyBean()
  136. blue def monthMap = [ 'January' : 31, 'February' : 28, 'March' : 31 ]
  137. blue this is really nice. bit weird for map syntax, but nice
  138. dreamreal people use groovy, yes
  139. dreamreal why, I could not tell you
  140. blue I like that def keyword
  141. blue I don't like the missing semicolons
  142. blue but it looks kinda nice
  143. dreamreal groovy is a giant chunk of crap that managed to work
  144. blue LOL
  145. dreamreal the most common usage is in gradle, and it's going away there day after day
  146. blue gradle?
  147. dreamreal gradle
  148. nevet gradle is a build tool for many languages; it uses a Groovy or Kotlin DSL, and provides a configurable as well as a conventional build model. It's very terse but can be absolutely maddening if you color outside the lines at all. URL: https://gradle.org Tags: build tool, groovy, kotlin, and jvm
  149. dreamreal groovy
  150. dreamreal pffft, need a groovy factoid
  151. blue that shows you how popular it is :P
  152. dreamreal It's relatively limited in scope, most people learn enough groovy to use gradle and that's it, and even there kotlin is taking over
  153. dreamreal kotlin, incidentally, uses val and var
  154. blue like scala?
  155. blue Mein Gott dreamreal.
  156. blue anything that reminds me of that dumpster fire language is terrible
  157. dreamreal Scala is a beautiful language
  158. dreamreal scala
  159. dreamreal it needs a factoid, too
  160. dreamreal but I don't have one because of javabot :D
  161. blue I thought you hated scala like brimstone.
  162. blue Actually, I *know* you do.
  163. blue I also know why, and it's not necessarily the language, though it should be :P
  164. dreamreal I refuse to use it.
  165. dreamreal The language is great. Everything around it is awful.
  166. blue Community makes the language, I guess?
  167. dreamreal Community makes the ecosystem.
  168. blue This is kind of the reason I like Java, btw. The people are so much better than other communities I know.
  169. dreamreal The language is quite capable, quite usable, quite nice, really. The community ruins it.
  170. blue I *really* don't like Java as a language (this is no secret).
  171. blue But I love the community.
  172. dreamreal Take every negative trope about argumentative Jews, amplify it by 700, add in toddler-level emotional tantrums and add knives. You'll have a gentle approximation.
  173. blue Compared to basically any community I know... first and foremost JS, the Java community is a dream. The people feel mature and no toddlers.
  174. dreamreal I can point out toddlers if you like :D
  175. blue The JS community is full of ego-laden toddlers.
  176. dreamreal lombok
  177. blue lol
  178. dreamreal grrr, no lombok factoid either
  179. blue What on god's green earth is lombok?
  180. dreamreal javabot's factoid database sucks compared to nevet's features, but it's far more developed
  181. blue yo ucould migrate the data..
  182. dreamreal https://projectlombok.org/
  183. nevet Project Lombok
  184. dreamreal I could, yes, but I don't want to, nevet is not intended to compete with javabot and it's less "#java-owned"
  185. blue anyway: I truly love the Java community in terms of people.
  186. blue I dislike the language very much indeed, but the people/culture make it worthwhile
  187. dreamreal A language is what it does
  188. dreamreal I find java usually pretty verbose myself, I prefer writing kotlin
  189. blue the JS situation is reserved: I *love* the language, the community... MUCH less
  190. blue reversed*
  191. blue the TS community is somewhat more mature
  192. * dreamreal still resents hasOwnProperty()
  193. blue yes, you shouldn't be using that
  194. dreamreal I don't know if JS has made that more palatable
  195. dreamreal it's been a while
  196. * blue points to Object.hasOwn
  197. dreamreal So you can't override that?
  198. blue override what?
  199. dreamreal That was always the problem with hasOwnProperty
  200. blue you wouldn't be using it
  201. dreamreal You ended up having to use something like Object.prototype.hasOwnProperty()
  202. blue yes. and the short sytnax today is Object.hasOwn(obj, prop)
  203. dreamreal Ah, right, so you're calling it directly via Object
  204. blue the reason people using the prototype directly doesn't have much to do with this particular method
  205. blue it's just js objects can overwrite anything
  206. blue obj = { hasOwnProperty() { console.log("nope"); return -1; } };
  207. blue and Object.hasOwn doesn't really fix it, either
  208. blue because you can do Object.hasOwn = () => {}
  209. dreamreal I thought that's why you use the prototype
  210. blue also I believe Object.hasOwn deals with null and what not better
  211. systemfault People use objects as dictionaries. Nobody use Object as a dictionary
  212. blue sorry, I mean null-prototype objects
  213. systemfault Ahh, most people don't even know they exist.
  214. blue const obj = Object.create(null);
  215. blue this is the 'clean' way to create a dictionary in JS, because it doesn't carry all the Object.prototype baggage
  216. dreamreal aight, off

Search posts