Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Lensflare17097161dFascinating. It’s like learning about how a long forgotten culture used some weird way of counting that we cannot comprehend today.
Except that the php culture is still alive. -
ars14065161d@Lensflare I imagine it’s similar to what those anthropologists that go to the Amazon to interact and observe the Yanomami must feel.
-
C0D468146161dI can't say I've ever done this, and thinking about it, life would have been easier if I did.
And people hate on php, it's just does things you never expect is all. -
caiofior1899161d@ars1 keep in mind that I'm a fruit of this culture. And in latest versions php has a great syntax that could coexist with old strange oddities as the one that I described.
-
cuddlyogre1189161dI gave up on PHP when it discovered that it can't send an array as JSON. It converts it to an object with the index as the key and sends that.
It is annoying I have branching logic in the main application so that I can handle proper requests and PHP requests. -
Lensflare17097161d@cuddlyogre that’s exactly the reason why a well thought out and properly implemented type system is one of the most crucial parts of a programming language. Without that, we get those clown languages like php or js, which have random conversion rules between built in types, which were implemented for some irrelevant use case at the beginning and then stay forever in the language because of backwards compatibility.
-
kobenz845161dI like how Haskell does it, a string is a list of characters and it's Begone Deimon!
-
devRancid631160d@Lensflare noone sane uses == or needs to know about all these rules nowadays tho
-
devRancid631160dPrevious PHP versions had even worse implicit comparison of the same type: '0010e2' == '1e3'
-
Lensflare17097160d@devRancid … which is a testament to its fucked up type system in itself.
Not using it because it’s bad is admitting that it’s bad. -
Lensflare17097160d@devRancid Btw, js doesn’t have a built in way to check for equality for reference typed values. == and === will both not work.
So two equal objects and two equal arrays would still be unequal according to == and ===.
The type system is garbage. -
Lensflare17097160d@jestdotty show me the code to check two arrays or two arbitrary objects for equality in js.
In Swift, you just conform the object to Equatable and then compare with ==. Arrays do conform to Equatable automatically if the element type is also Equatable. I bet my ass that Rust does the same.
Now tell me which is more verbose.
All that === does is skipping the retarded implicit conversions. It still is a joke of an equality operator which doesn‘t work with reference typed values like arrays and objects, as I said. The type system is still garbage. -
Lensflare17097159d@jestdotty what a strange question.
You need to check objects for equality to check if some data has changed. That’s essential for reactive and functional programming.
But I think I can see why js devs don’t recognize this problem because js doesn’t have custom value types, and changes in state are handled with reference types. That’s bad because you need to deal with mutable state but there is no other way of course.
That’s the problem with js: It makes you blind for its problems because you never learn good coding practices because they are not possible with js. -
kobenz845159d@jestdotty tbh I think equality is too dangerous and limiting on non-lisp languages, so I avoid it as much as possible.
I say dangerous cuz your average programmer will go on symbolic mode when doing it and most likely miss a fuckton of minutiae or come up with hard to maintain clusterfuck code.
In that sense, pattern matching like Rust, Ocaml, or, better yet, Haskell, tends to be less error prone. Though it kicks readability out the window, it does remove all that equality nonsense @Lensflare's pic shows βπ»π
Bet then, if all languages were like that, we'd have a hard time finding programmers πΆππ»
I am NOT sure if THAT would be a bad thing though -
Lensflare17097159d@jestdotty you quoted me wrongly and inserted a few words which change the meaning. I believe you misread or misunderstood me.
My point wasn’t about performance. It was about verbosity and correctness.
I don’t want to insult you. You insult yourself by confirming my prejudices about js devs.
It may not be your first language but it is your main language that you also like. So it’s appropriate to refer to you as a typical js dev. -
kobenz845159d@jestdotty definitely, but throw in typescript instead and it's a world of pain. In that sense I rather do it python or JavaScript and rewrite in Rust afterwards
Related Rants
Today I learned.
In php if you cast a string to array you get an array with one value: the string.
rant
type jugling
php