<ixti>
But I guess it's pretty good for majority of use cases :D
perrierjouet has joined #ruby
entropie has joined #ruby
georgemp has joined #ruby
Milos has joined #ruby
swaggboi has joined #ruby
duds- has joined #ruby
Furai has joined #ruby
willow has joined #ruby
desnudopenguino has joined #ruby
artyn has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
<ox1eef_>
ixti: looks like magic to me, but i guess that is subjective. it's surprising behavior, and it's best not to have surprising APIs.
<ox1eef_>
a good API works just like you expect without ever reading the docs.
jl- has joined #ruby
<ixti>
ox1eef_: on one hand I agree, on the other it's pretty biased approach based on experience with other languages..
<ixti>
I mean the "expectation" is based on something...
<ox1eef_>
that doesn't mean it is not just inherting surprising behavior from other languages, though.
<ox1eef_>
and for newbies, who probably have no experience with perl, or awk, it's even worse.
<ixti>
Well, I learned myself to always read documentation and source code... So I'm rarely surprised. Only when documentation says one thing and code does the other :D
<ox1eef_>
it reminds me of C APIs that nowadays are recommened to never be used, because unless you read their docs you shoot yourself in the foot.
<ixti>
LOL :D
<ixti>
Could String#split had better signature, sure it could. Especially now with keyword arguments... But changing API of a function that was since the beginning is bad idea too :D
<ox1eef_>
i agree, but then, it should have an obvious replacement for this particular case. it's not particularly performant to create a regexp just for this special case.
jl- has quit [Ping timeout: 272 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 272 seconds]
<ixti>
ox1eef_: Performance hit in this case I believe is negligible.
<ox1eef_>
indeed, i would guess so, but probably depends on the case - if you find yourself in a loop, it would be better to have one frozen string than multiple regexps created over and over again. my main issue is that it is just a surprising API that would do the last thing youd expect unless you have knowledge of its inner workings, and 'read the docs' is not a great defense of such APIs imo.
<ixti>
You don't need to create regexp over and over again. Create it outside of the loop :D
<ox1eef_>
that's just gymnastics for a surprising API
<ixti>
ox1eef_: I totally understand what you're saying. API might be surprising. But only if you have background of another language.
markong has quit [Ping timeout: 256 seconds]
<ixti>
And I believe each language has its quirks ;D
swaggboi has quit [Read error: Connection timed out]
<ixti>
After all languages are tools designed to help solving problems. They are designed by humans with different background and history...
<ox1eef_>
certainly, no language is absolute perfection but i think we have to be honest when given an example which is clearly surprising, rather than defend it with emotion because we love so and so language.
swaggboi has joined #ruby
<ixti>
ox1eef_: Oh, I'm not defending. It's just I certainly remember having lots of questions about Kotlin APIs when I tried to use them the way I get accustomed in Ruby :D
<ox1eef_>
roger that
<ixti>
:D
<ixti>
After all, surprising or not - that's what we have right now :D
<ixti>
We can rant, or we can enjoy ;D
<ixti>
I definitely prefer the second one :D
<ox1eef_>
well, probably the example was introduced with frustration and a bit of anger, which is best avoided but i think its a valid case all the same.
<weaksauce>
At least some of your points are rational. Those behaviors are inherited from Perl.
<weaksauce>
I don't think we can change the behavior. We are not going to break existing code for the sake of consistency.
<weaksauce>
Matz.
bastienleonard has quit [Ping timeout: 268 seconds]
cocalero has joined #ruby
<ox1eef_>
that doesn't change much, nor does it once address the exact scenario we're discussing. JS has the same problem where it has to support clear mistakes for the sake of compatibility. it doesn't mean that if it were decided today, it would remain the best choice. it clearly isn't.
swaggboi has quit [Ping timeout: 264 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 256 seconds]
jl- has joined #ruby
jl- has quit [Ping timeout: 248 seconds]
Al2O3 has quit [Quit: I'm quitting, thanks for all the sharks.]