Chat Logs

  1. * five618480339176 joined #java
  2. * kusanagi joined #java
  3. * hiredman joined #java
  4. * domicron joined #java
  5. * Flow joined #java
  6. * fgarcia joined #java
  7. * michele joined #java
  8. * vobar joined #java
  9. * lostlazy joined #java
  10. * julemand101 joined #java
  11. * sponkz joined #java
  12. * hwpplayer1 joined #java
  13. * jreicher joined #java
  14. * MikeBux joined #java
  15. * Afroboy joined #java
  16. * Gaz7051122720067 joined #java
  17. * mixfix41 joined #java
  18. * leppard joined #java
  19. * GreenResponse joined #java
  20. * Afroboy joined #java
  21. * szkl joined #java
  22. dreamrealhttps://bytecode.news/posts/2026/06/what-s-old-is-old-again
  23. javabotdreamreal's title: "What's Old is Old Again | bytecode.news"
  24. ParaI have special price offer for that work, it's zero. As in, normal rate but with one zero added.
  25. dreamrealI haven't gotten any work from that particular mode yet, it'll be interesting to see what happens when I do.
  26. * Aedil joined #java
  27. * jamezp joined #java
  28. * hwpplayer1 joined #java
  29. * metalmaniac joined #java
  30. * leppard joined #java
  31. * leppard joined #java
  32. * Afroboy joined #java
  33. * wedr joined #java
  34. wedrHelloooo. this stumped me badly... I didn't know if a non-empty string contains an empty string, this is evaluated to be true.
  35. wedrhttps://onecompiler.com/java/44t9567gk
  36. nevetJava Online Compiler
  37. javabotwedr's title: "Java Online Compiler"
  38. wedrIs this for real??
  39. dreamrealWell, what does "contains" mean?
  40. wedrThe contains() method
  41. dreamrealI know. But what does teh contains() METHOD imply?
  42. dreamrealIt says "this sequence can or cannot be found in the instance being referred to," yeah?
  43. wedrFrom the doc, it says "Returns true if and only if this string contains the specified sequence of char values."
  44. dreamrealIt takes a CharSequence, is called on a String. Right?
  45. wedrYes
  46. dreamrealOkay, what does it say ABOUT THE SPECIFIED SEQUENCE?
  47. wedrAn empty string implies that it is a non-null CharSequence object?
  48. Parawedr: FWIW you can as an exercise implement contains, substring and a few other basic operations using char arrays and as simple as possible constructs (for loops with manual index management and such) and you'll kinda see why the things behave like they do.
  49. ParaAnd yes, "" indeed is not null :)
  50. wedrUgh, I gotta go back and fix a 6 years old bug.
  51. fizzieHere's one way to think about it, if you like: a.contains(b) is true iff a.substring(x, y).equals(b) for some x, y.
  52. dreamrealThere you go. Does "foo" contain a valid but empty "" sequence? yes.
  53. ParaBeen poking at code from 2017 myself lately...
  54. dreamrealwedr: always fun to realize you left out a constraint, innit :/
  55. * wedr is baffled.
  56. dreamrealthankfully, it's never happened to ME! ... pardon me while I check a shedload of codebases to scrub
  57. dreamrealfor, uh, something else entirely, surely
  58. dreamrealit'd not baffling! Any nonempty string contains an empty-but-valid sequence
  59. dreamrealit's indexOf() in the end, although codepages factor in
  60. ParaThis reminds me of a discussion I see every now and then - not commonly but still - where someone doesn't quite get why empty collection is not the same as null. Different problem entirely, but there's some logical overlap.
  61. fizzie"foo" contains "" in four different places, even.
  62. Parafizzie: regex split agrees
  63. wedroh no, I now see why, but goddamnit it's not that intuitive until you see it.
  64. dreamrealhmm, I can understand that
  65. dreamrealI don't know that I AGREE with it, but I can understand it
  66. wedranyway, we have so many string checks throughout the code, so I will have to check them all.
  67. ParaAnd another overlap, with URIs the path segment of URI is handled in sort of similar way. This is why path "/" is different than "", or "foo/" has two segments while "foo" has just one.
  68. ParaThis latter part is also why it's potentially a security defect to do URI rewrites involving trailing path.
  69. ParaAnd people do that a lot as cargo culting because back in the day Apache directory serving used that to sniff whether you mean foo-the-dir or foo-the-file.
  70. * Drixtan joined #java
  71. * hwpplaye` joined #java
  72. * mwnaylor left #java (ERC 5.6.0.30.1 (IRC client for GNU Emacs 30.2))
  73. * JazzJackalope joined #java
  74. * acidsys joined #java
  75. * sponkz joined #java
  76. * m2 joined #java
  77. * llanhmock joined #java
  78. * hwpplayer1 joined #java
  79. * Drixtan joined #java
  80. * tomboy64 joined #java
  81. * ztevoz joined #java
  82. * keb joined #java
  83. * nimaje joined #java
  84. * ferdna joined #java
  85. * Odyss3us joined #java
  86. * magla joined #java
  87. * Betal joined #java
  88. * Ragnor joined #java
  89. * nimaje joined #java
  90. * henbruas joined #java
  91. * magla joined #java
  92. * akaWolf1 joined #java
  93. * akaWolf1 joined #java
  94. * nimaje joined #java
  95. * nimaje joined #java
  96. jreicherI think the term "empty string" could be confusing, and is probably a misnomer. It kind of suggests there's no string there, but there is of course still a (zero-length) string.
  97. jreicherIt's not like "empty list", because a list is a collection. A string isn't really a collection in some ways.
  98. * nimaje joined #java
  99. MaxdamantusHow is it different? "empty set", "empty list", "empty string", "empty sequence" .. I think these are all understood in pretty much the same way.
  100. MaxdamantusThere is a set/list/string/sequence, and the fact that it's empty means its length is 0.
  101. dreamrealheh. What's the intersection of the ['a', 'b', 'c'] and [] sets?
  102. MaxdamantusJust like how an empty bottle has 0 contents in it.
  103. Maxdamantus[]
  104. jreicherBy people who understand them, yes. But I think people who don't are getting caught by the fact that a String (the java object) is not a collection.
  105. dreamrealat what position is the [] set in the first set?
  106. Maxdamantussets don't have positions.
  107. jreicherYou can interpret as a string as a collection (of chars), but you need that interpretation
  108. dreamrealyeah, but those aren't JAVA sets, assume they're ordered
  109. ParaI suspect at least some of the confusion I mentioned earlier has caused by teachers wanting to overfeed functional programming theory as the only way to see programming.
  110. jreicherBut it is... :p
  111. ParaLike cool, Set(3) is also identity of 3 in a set...and no one cares.
  112. MaxdamantusWell, a string is a thing that has a length or size. That's what allows it to be conceptually empty.
  113. Maxdamantusgtg
  114. dreamrealI'm still very vaguely annoyed that teachers don't start with actual ML
  115. dreamrealon, like, eight bit processors
  116. jreicherOh, come on. Nobody says "empty distance", do they?
  117. ParaGenZ slang is kinda like that, apparently.
  118. ParaAnyway. One issue that I've seen a few time is that people really don't understand that the collection itself has functionality and properties tied to its type. Like set and its ordering.
  119. ParaThey'll just blank on "how can identy of nothing be unordered" kind of mismash.
  120. Para(I meet a person like this maybe once every few years, mind you)
  121. ParaSo, about monads...
  122. jreicherYou mean enchiladas.
  123. Parammm, those would be nice
  124. ParaCan't really get good ones over here.
  125. jreicherGood Mexican food is very good food.
  126. * nimaje joined #java
  127. * nimaje joined #java
  128. * nimaje joined #java
  129. jreicherI had the wrong control codes before but I think this channel strips them anyway. Was trying to do italics
  130. * five618480339176 joined #java
  131. * polyrob joined #java
  132. * mindCrime joined #java
  133. * LtHummus joined #java
  134. * metalmaniac joined #java
  135. * kathadris joined #java
  136. * marcel1 joined #java