I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad
-
@Arantor said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@Gustav said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@Mason_Wheeler said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
Having 5/2=2 has always been an ugly, error-prone mistake from the day Dennis Ritchie first coded it up.
In statically typed languages, what's the alternative? Make the return type float? Disallow integer divisions entirely?
Make the return type float. If you expressly want integer, use a different operator to signify the difference.
I take it you don't like operator overloading either. BTW did original C even have floats?
I've seen languages use \ for this.
In an alternate universe, Richie had the same idea and now people are bitching about how in C you can insert line breaks anywhere you want in the code EXCEPT after integer division operator.
Crazy idea: instead of changing integer division operator, change the float division to
/.
like OCaml did.
-
@Gustav said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
Speaking of curl. I want to personally congratulate the fuckwit who designed the -s and -S flags.
"congratulate" is the wrong word. You should amend that sentence to:
Speaking of curl. I want to personally put the fuckwit who designed the -s and -S flags in front of Steve's GAU-8 and pull the trigger;
-
@Gustav said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
I take it you don't like operator overloading either.
Not in a dynamic language, bad things happen.
I give you JavaScript's overloading of + for both addition and concatenation and the fun you have of having to remember to type cast numbers to be numbers so that 1 + 1 gets you 2 not 11, especially when dealing with user input because that all comes in as strings...
In an alternate universe, Richie had the same idea and now people are bitching about how in C you can insert line breaks anywhere you want in the code EXCEPT after integer division operator.
The languages I've seen this done don't have the semantics of \ as an escape character. I don't do C...
-
@Arantor said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@Gustav said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
I take it you don't like operator overloading either.
Not in a dynamic language, bad things happen.
And my question was explicitly about static languages. I agree that overloading in dynamic languages is evil. Although the idea of dynamic languages is evil to begin with. Funny how all popular dynamic languages eventually hacked static types back in.
-
@Gustav I was answering the operator overloading question. I don't like it in any context precisely because it transfers the mental effort of 'what type is this' to the programmer.
JavaScript still hasn't hacked static types back in, but TypeScript exists and hasn't entirely supplanted it yet.
And PHP's idea of static types isn't quite the same; ints and floats are sort in the same bucket until they're not.
-
@Arantor said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
it transfers the mental effort of 'what type is this' to the
programmerIDE.FTFY
And no, "what about people who don't use IDEs" is not a valid point. It's 20 fucking 22. If you refuse to use basic tools of trade, it's on you.
-
@Gustav oh you sweet summer child, you think an IDE helps for those of us who use dynamic languages that have... questionable type hinting for languages, especially on big-ass legacy codebases.
-
@Arantor said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
Not in a dynamic language, bad things happen.
Lua lets you do it, and it seems to work. (On the other hand, it doesn't do ridiculous things like use + for string concatenation, nor does it convert automagically from strings to other types, IIRC.)
As for division returning a float. Eh, sure. But now you're stuck with a (double precision) float, which also sucks at representing rational numbers accurately and has much more complicated rounding behaviour than integers.
E.g.,
>>> print( 2/49*49 == 2 ) False
So, things now suck unpredictably (for the average programmer at least), compared to sucking predictably with integer division.
-
@Arantor point of clarification: I only meant that IDE helps when you're using a non-retarded language. Of course it won't help much if even the interpreter doesn't know what the fuck it's doing (and having to consult vtable all the time for type info is a form of not knowing).
-
@cvi Fair enough, I'm used to living with a shit language that does shit things except when it doesn't except when it does, and has a bastard number type that is int by default until you do something that makes it a float then it's a float...
-
@Gustav I do WordPress as a day job so... before that I did Moodle as a day job. I work in PHP and JavaScript because someone has to...
-
@Arantor To be fair, C++ (my daily driver) is YOLOing type conversions too (and will even do it for your own types if you're not careful), so I know that pain to some degree. (And std::string supports concatenation with +, so there's that. But that's something I don't have to deal with often.)
-
@Arantor said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
I work in PHP and JavaScript because someone has to...
It's not true! Nobody has to do this! Cast off your mind-forged chains! Or whatever just stop.
-
@cvi said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
C++ (my daily driver) is YOLOing type conversions too
But that's because it expects you to know what you're doing, vs avoiding you having to know.
-
@Gustav said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
I take it you don't like operator overloading either.
I'm just fine with it, as long as it's used appropriately. Like anything else in programming, there are right, wrong, and horrifyingly ways to use it.
BTW did original C even have floats?
Not sure, and it turns out that that's a surprisingly difficult question to Google, but I don't see anything to indicate that the answer is no.
Crazy idea: instead of changing integer division operator, change the float division to
/.
like OCaml did.That might work too, but I like the standard division operator returning the result that is the closest to being mathematically correct, rather than the one that's obviously wrong.
-
@Gustav said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
Although the idea of dynamic languages is evil to begin with.
If you agree with this point, why are you reaching for JS and Python as your go-to languages to do random coding tasks with?
-
@Arantor said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
I work in PHP and JavaScript because someone has to...
Counterpoint: The only reason bad languages survive is because people continue to use them. If enough people refused to do so, they'd go extinct.
In close to a decade and a half as a professional coder, the only time I've ever touched PHP was to help migrate a project off of it.
-
@Mason_Wheeler well, isn't that just wonderful for you. Someone has to prop up the ecosystem because I'm not clever enough to work in a real language.
-
@Mason_Wheeler said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@Gustav said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
Although the idea of dynamic languages is evil to begin with.
If you agree with this point, why are you reaching for JS and Python as your go-to languages to do random coding tasks with?
Because there are no universally available statically typed scripting languages.
-
@Arantor said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@Mason_Wheeler well, isn't that just wonderful for you. Someone has to prop up the ecosystem because I'm not clever enough to work in a real language.
I thought you're in it for the money. Come on, Rust isn't that hard. And there are many job offers outside crypto now!
-
@Gustav If I were actually in it for the money, I would have learned Java or C# years ago.
-
@Arantor if it's not money then what keeps you? I for one wouldn't shed a tear if the PHP ecosystem collapsed and went extinct.
-
@Gribnit said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@Arantor said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
I work in PHP and JavaScript because someone has to...
It's not true! Nobody has to do this! Cast off your mind-forged chains! Or whatever just stop.
Not even a follower of The Old Ones wants PHP and JavaScript.
-
@Zecc reminds me for some reason
-
@Mason_Wheeler said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
In close to a decade and a half as a professional coder, the only time I've ever touched PHP was to help migrate a project off of it.
For the same amount of time, I've been making a living working with PHP
It still powers 77% of websites
-
PHP is far from perfect, but it's easy to do what you are trying to do.
Something like
$decoded_json = json_decode ( file_get_contents ("http://www.example.com/somefile.json") );
And on any Debian-based distro, it's just one
apt install php-cli
away
-
@TimeBandit said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
And on any Debian-based distro, it's just one apt install
-
@Mason_Wheeler said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@Gustav said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@Mason_Wheeler said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
Having 5/2=2 has always been an ugly, error-prone mistake from the day Dennis Ritchie first coded it up.
In statically typed languages, what's the alternative? Make the return type float? Disallow integer divisions entirely?
The same thing that Python eventually did: make the return type a float and create a distinct integer division operator for when that's what you want. Pascal did that before C even existed, and it's the most correct solution.
I'd be curious how often people want the float result. Frequently when I'm doing integer division I'm also grabbing the remainder so the int way makes sense in programming. I've usually not been doing "normal math" stuff. If I wanted normal math I'd just cast the int to float first.
-
@Gustav said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
You think Python and NodeJS are installed by default?
-
@TimeBandit said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
For the same amount of time, I've been making a living working with PHP
It still powers 77% of websites
-
@TimeBandit said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@Gustav said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
You think Python and NodeJS are installed by default?
Python definitely is on many Linux distros, but I haven't heard about Node being installed by default. You'd really hope the people in *nixland aren't that dumb... but then you remember they're voluntarily living in *nixland.
-
@Mason_Wheeler said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
they're voluntarily living in *nixland.
At least, our files are where we left them
-
@TimeBandit said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
Python
Yes. It's even in Debian's live-task-standard. That puts Python higher in hierarchy than less. (I only learned this just now and I'm as surprised as you).
NodeJS
@Gustav said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
We already depend on Node for critical parts of the project, so (a) we already need to install it anyway, and (b) it's never going away for us.
-
@Gustav said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
We already depend on Node for critical parts of the project, so (a) we already need to install it anyway, and (b) it's never going away for us.
That's horrifying. Remember, it's been 6 years now since the left-pad fiasco conclusively proved that Node was being run by people with no clue what they're doing. In any sane world it would have been abandoned immediately. (But then again in any sane world NodeJS would never have been invented in the first place!) Instead people are still using it and even depending on it for critical parts of their projects.
Why is the software world so bad at object permanence?
-
@Mason_Wheeler thankfully not in actual deployment. Only our dev/CI/management infrastructure.
-
@Mason_Wheeler said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
Why is the software world so bad at object permanence?
We need a lot of garbage collectors for the tab hoarders to cope
-
@kazitor said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@Mason_Wheeler said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
Why is the software world so bad at object permanence?
We need a lot of garbage collectors for the people living in the 90s and their OOP silver bullets
-
@ObjectMike said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
I'd be curious how often people want the float result. Frequently when I'm doing integer division I'm also grabbing the remainder so the int way makes sense in programming. I've usually not been doing "normal math" stuff. If I wanted normal math I'd just cast the int to float first.
It really depends on what you are doing. Long experience says that different application areas tend to have extremely different profiles of operations. That's one of the reasons that libraries are so useful: they augment the set of operations so the base language doesn't have to supply everything.
-
@Gustav said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@Arantor if it's not money then what keeps you? I for one wouldn't shed a tear if the PHP ecosystem collapsed and went extinct.
Well, it is money, but it’s not the big bucks. No one goes into PHP to be wealthy.
I’ve been making a living off PHP for the last 14 years. It’s not often particularly interesting, actually it’s often downright grotty but it pays the bills and is within my capabilities.
I’ve tried branching out before but it’s painful going, and in any case going from a senior PHP dev to, well, not a senior in another language is a pay cut at this point.
-
@Mason_Wheeler said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@Gustav said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
Although the idea of dynamic languages is evil to begin with.
If you agree with this point, why are you reaching for JS and Python as your go-to languages to do random coding tasks with?
Once again you're ignoring the "OP's" stated constraints.
-
@boomzilla he reminds me of my stepdad and his “developers should write everything in assembly, it’s so much faster” while ignoring all the realities of that.
-
@cvi said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
(And std::string supports concatenation with +, so there's that.
It does, but it doesn't let you do
stringvar + numericvar
or vice versa. If you try, the compiler will fart in your general direction. (Yes, I know, that's just a generic statement of obvious obviousness, given that it's a moderately strict statically-typed language.)
-
@Arantor said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@boomzilla he reminds me of my stepdad and his “developers should write everything in assembly, it’s so much faster” while ignoring all the realities of that.
Ideal reply: "It's possibly a bit faster to run, but it sure isn't faster to write, by many orders of magnitude."
-
@dkf that doesn’t matter, I’ve challenged with that in the past.
-
@dkf said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@Arantor said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@boomzilla he reminds me of my stepdad and his “developers should write everything in assembly, it’s so much faster” while ignoring all the realities of that.
Ideal reply: "It's possibly a bit faster to run, but it sure isn't faster to write, by many orders of magnitude."
The real question is how to make it faster to write good, correct software. Neither the assembly of old nor the new-fangled JS excrements are any good at that. Although, back in the day things might have had fewer bugs by virtue of being generally smaller and updates being more costly.
-
@topspin said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
The real question is how to make it faster to write good, correct software.
The real question is how to make it possible to write adequate software on schedule and under budget.
-
@Arantor said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@dkf that doesn’t matter, I’ve challenged with that in the past.
My counter is usually something along the lines of assembly being high-level code these days anyway, and only having a passing relation to what the hardware does under the hood.
-
@dkf said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@Arantor said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@boomzilla he reminds me of my stepdad and his “developers should write everything in assembly, it’s so much faster” while ignoring all the realities of that.
Ideal reply: "It's possibly a bit faster to run, but it sure isn't faster to write, by many orders of magnitude."
But every system comes with an assembler! What if I write it in FORTRAN II and my colleague uses FORTARN IV, eh?
-
@dkf said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
The real question is how to make it possible to write adequate software on schedule and under budget.
Machine learning ... just write a short prompt about the program and the AI networks will do the magic for you.
Filed under: KNUT-H
-
@cvi said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
@dkf said in I knew Python was slow, but not THIS slow. And I knew JS was bad, but not THIS bad:
The real question is how to make it possible to write adequate software on schedule and under budget.
Machine learning ... just write a short prompt about the program and the AI networks will do the magic for you.
Do you want Skynet? Because that's how you get Skynet.