Gąska is a tart savour and wants to give floating jobs to Javascript
-
@Gąska said in Tales from Coronavee-rooss Italy, mamma mia!:
Having only one number type simplifies a lot of things. It's not as insane when you think about it
I have as much as I'm prepared to do so. For whom and which things in particular?
For designers and maintainers? I couldn't give a half shit about their plights. Literal checking, lifetime analysis and type conversion comes at a cost, mostly complicating the parser and compiler. Of course, that's what coders do best - invent fake problems only they can solve by doing some more coding...
Users? Considering they have to learn about types anyway to recognize edge cases like this even if they would perhaps never have such use case I'm not convinced that it does.
So don't write JS. Simple as that.
No, it fucking isn't. What the actual goddamn fucking bloody shit? On which Earth are you on? Fuck.
Have you considered that I cannot refuse to work on certain things at work just because I don't like them? And I have been doing that for two years, but I don't expect that will hold.
actually getting much simpler right now ... developed into something workable
Will you recognize the stupid marketing bullshit or should I point it out that it's stupid marketing bullshit? It's not simple and it will never be ready. It will only be rapidly developed until some hot shit new idea comes around, then it will be abandoned to be reborn about 10 years from now as another Holy Frail.
I'm objecting to putting blame on JS for people being lazy fucks.
People are lazy fucks. You can, of course, object, but you're - somewhat ironically - wasting time since it's not a problem anyone can fix.
Sounds like you didn't learn your tools before using them.
So?
How else would it be possible for you to miss that they use JS?
Everything uses JS nowadays! It could be that the COBOL mainframe in NJ unemployment handling has a reporting system for suits where JS is involved somehow. It's like a woodworm. Or a parasite. It quickly attaches to things so that only surgical separation is possible, but sometimes the patient would die. It's possible it actually feeds on all the negative energy we emit by mocking it.
-
I moved this to the sidebar, because that seems more appropriate for discussing JS and the people who use it.
-
@boomzilla said in Gąska is a tart savour and wants to give floating jobs to Javascript:
I moved this to the sidebar, because that seems more appropriate for discussing JS and the people who use it.
We already have a lifestyle thread!
-
@Applied-Mediocrity said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Gąska said in Tales from Coronavee-rooss Italy, mamma mia!:
Having only one number type simplifies a lot of things. It's not as insane when you think about it
I have as much as I'm prepared to do so. For whom and which things in particular?
For everyone and everything related to positioning visual elements on the screen, as well as displaying numerical data of various kinds. JS is and always will be primarily a language for interactive websites. Yes, it's a real tragedy that it has since been transplanted into types of applications it was never meant to support, such as web servers - but it's just not fair to judge the original design designed for a particular niche by the Rube Goldberg machines some idiots in their infinite idiocy have constructed fifteen years later.
Compare with how
this
works, which is actually retarded.Users? Considering they have to learn about types anyway to recognize edge cases like this even if they would perhaps never have such use case I'm not convinced that it does.
No matter what the JS designers would choose, there would be edge cases.
Integers only? "5/2==2 LOL JS SUCKS! xD"
Integers and floats with dynamic conversion? "Why does adding these numbers works but adding those same numbers doesn't? JS sucks!"
Arbitrary precision numbers? "The top voted answer on some SO question said that you have to explicitly round numbers every once in a while to avoid performance problems, so I'm doing it every other line. I didn't have to do this in any other language! JS sucks!"It's not that they've made a bad choice. They've just made a different one than you'd make, with different tradeoffs than you'd have, with different but just as many pitfalls everyone must learn to avoid shooting themselves in a foot.
So don't write JS. Simple as that.
No, it fucking isn't. What the actual goddamn fucking bloody shit? On which Earth are you on?
On one where there's still plenty Java, C# and Python jobs available, or hell, even C is still pretty popular. And my mailbox is spammed increasingly often with Rust jobs, of all things!
Have you considered that I cannot refuse to work on certain things at work just because I don't like them?
By not resigning you have made a conscious choice to continue working with JS. It means you consider working with JS better than the alternatives. So stop whining and do your work - or actually take steps to not have to write in JS anymore if you hate it so much.
actually getting much simpler right now ... developed into something workable
Will you recognize the stupid marketing bullshit or should I point it out that it's stupid marketing bullshit?
Have you tried it? Hm? Who's falling for stupid marketing bullshit now?
It's not simple
Of course it IS not. I never said it IS. I was only talking about what WILL be.
and it will never be ready.
Let's get back to this in 4 years and see how things are looking then, shall we?
I'm objecting to putting blame on JS for people being lazy fucks.
People are lazy fucks. You can, of course, object, but you're - somewhat ironically - wasting time since it's not a problem anyone can fix.
So don't shit on JS for not fixing this! For fuck's sake. What's wrong with wanting people to RTFM before complaining that things are broken because they don't work like they imagine they should?
How else would it be possible for you to miss that they use JS?
Everything uses JS nowadays!
You've clearly never worked in embedded. I highly recommend it to you, if you hate JS so much.
-
@Gąska said in Gąska is a tart savour and wants to give floating jobs to Javascript:
Compare with how this works, which is actually retarded.
It's basically required for prototypal inheritance of methods to work.
-
@error imagine how cool JS would be if it was designed in 2010, when the OOP brainworm was at its low. No prototypal inheritance and all the problems related to it!
-
@Gąska said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@error imagine how cool JS would be if it was designed in 2010, when the OOP brainworm was at its low. No prototypal inheritance and all the problems related to it!
Imagine if it wasn't designed in 10 days.
-
@Gąska said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@error imagine how cool JS would be if it was designed in 2010, when the OOP brainworm was at its low. No prototypal inheritance and all the problems related to it!
But JS didn't go with the more classical (pun intended, even if it might not be literally correct) approach to OO that was so en vogue with Java at the time. At least it has functions.
No JS experience here to know what the problems with prototypical inheritance are, except that it sounds awful and full of monkey patching.
-
-
@topspin said in Gąska is a tart savour and wants to give floating jobs to Javascript:
But JS didn't go with the more classical (pun intended, even if it might not be literally correct) approach to OO that was so en vogue with Java at the time. At least it has functions.
No JS experience here to know what the problems with prototypical inheritance are, except that it sounds awful and full of monkey patching.A few years ago they went ahead and added "real" classes to the language. The biggest problem with prototypical inheritance is that most JS devs don't understand it. Also, the
this
keyword behaves in a very weird way.Monkey patching is a feature of the language, but it's mostly used for evil and/or compatibility patches that break more than they fix. Basically, (until recent-ish things like Object.freeze) you can modify nearly any object; and since objects inherit from other objects (not classical), and methods are just properties that happen to be functions, you can swap in your own implementation for anything.
That may sound like a terrible idea, but wait, it gets worse! You can store a reference to the original method and apply the decorator pattern to transparently modify the input and output of an existing method.
Now, no one does this because it's obviously a bad id--- HAHAHA I mean everybody does it, and it's not uncommon for methods to be decorated several times over by the multiple competing frameworks and polyfill libraries on the same fucking page.
-
@error said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Gąska said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@error imagine how cool JS would be if it was designed in 2010, when the OOP brainworm was at its low. No prototypal inheritance and all the problems related to it!
Imagine if it wasn't designed in 10 days.
Python wasn't designed in 10 days and it took two rewrites before it even started resembling something remotely sane.
@topspin said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Gąska said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@error imagine how cool JS would be if it was designed in 2010, when the OOP brainworm was at its low. No prototypal inheritance and all the problems related to it!
But JS didn't go with the more classical (pun intended, even if it might not be literally correct) approach to OO that was so en vogue with Java at the time.
Because it was easier to code, not because the author preferred it.
No JS experience here to know what the problems with prototypical inheritance are, except that it sounds awful and full of monkey patching.
Well, first and foremost, as @error helpfully pointed out, the prototypical inheritance mandates the retarded behavior of
this
.
-
@Gąska said in Gąska is a tart savour and wants to give floating jobs to Javascript:
Well, first and foremost, as @error helpfully pointed out, the prototypical inheritance mandates the retarded behavior of this.
I mostly just prefer static systems over dynamic ones where possible except for prototyping / RAD, and the prototype-based system sounds like an unmanageable runtime mess compared to the class based one. At least the amount of different classes is finite. So I dislike it without having tried it.
-
@topspin said in Gąska is a tart savour and wants to give floating jobs to Javascript:
At least the amount of different classes is finite.
Well...
-
@topspin said in Gąska is a tart savour and wants to give floating jobs to Javascript:
At least the amount of different classes is finite.
100100100 is finite too, but I wouldn't want to count up that high.
-
@Gąska said in Gąska is a tart savour and wants to give floating jobs to Javascript:
related to positioning visual elements on the screen, as well as displaying numerical data of various kinds
What does visual representation have to do with binary representation of data types?
it's just not fair to judge the original design
It's not and yet I will judge all the same. I will judge for what it is now, in the objective reality, not what it was or what it was supposed to be, therefore is not anymore and will not be, accordingly.
No matter what the JS designers would choose, there would be edge cases.
But there would be far less of them.
Integers only? "5/2==2 LOL JS SUCKS! xD"
This is very correct. Divide integers, get integer result. Strong typing and understanding physical types is the only way to work with current CPU designs. Physical types cannot and should not be abstracted away.
Integers and floats with dynamic conversion?
No conversion. I'd forbid assigning floating point typed data with integer literals or values entirely. Explicit cast only.
It's not that they've made a bad choice.
No sir, they very much did.
there's still plenty Java, C# and Python jobs available
And a good deal of them are full stack, devops or some such shit, which basically means JS in at least some capacity.
And my mailbox
My mailbox != your mailbox. Fuck your mailbox and the mailhorse it mailed in on.
By not resigning you have made a conscious choice to continue working with JS.
I don't want to resign just because one of the factors has deteriorated. I'm not a cubicle drone in a faceless corporation that makes bank software for Y2K2 or something (it's only a soulless husk ruled by chaos borne of ignorance and obtuse hints of marketing, but other factors make up for it).
It means you consider working with JS better than the alternatives.
There are no other choices for frontend interactivity, period.
Have you tried it?
No. Have you seen the latest Uwe Boll film? How can you know you won't like anal penetration with a steel wire brush if you haven't tried it? Let's just say there are certain pointers.
I was only talking about what WILL be.
Nothing ever becomes more simple.
Let's get back to this in 4 years
Yes, let's.
So don't shit on JS for not fixing this! For fuck's sake.
Not for not fixing this. For having this.
What's wrong with wanting people to RTFM before complaining that things are broken because they don't work like they imagine they should?
It's quixotic, useless and not based in reality.
You've clearly never worked in embedded.
You've clearly never been to Singapore. Actually some part of my work consists (or did, at any rate) of gluing embedded to the backend. But for small projects some frontend work cannot be escaped from. The proper frontend has been lagging behind severely. And while I did propose actual application, it had its drawbacks, chiefly among which was that everyone now uses phones. They're all so bloody different, and retarded shit's changing all the time that with limited resources we have might as well go full
retardweb.
-
@Applied-Mediocrity said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Gąska said in Gąska is a tart savour and wants to give floating jobs to Javascript:
related to positioning visual elements on the screen, as well as displaying numerical data of various kinds
What does visual representation have to do with binary representation of data types?
This is a wrong question to ask. The right question is "what does the use case at hand have to do with binary representation of data?". And the answer is everything. Floating points are very convenient for manipulating visual elements, as well as displaying (NOT calculating) numeric data.
it's just not fair to judge the original design
It's not and yet I will judge all the same.
Okay, so if by your own admission you're not being fair, excuse me while I ignore this part of your post.
there's still plenty Java, C# and Python jobs available
And a good deal of them are full stack, devops or some such shit, which basically means JS in at least some capacity.
And a good deal aren't. So just skip over those that are and apply for those that aren't.
And my mailbox
My mailbox != your mailbox. Fuck your mailbox and the mailhorse it mailed in on.
It was just an example. There were virtually no Rust jobs at all a year and a half back.
It means you consider working with JS better than the alternatives.
There are no other choices for frontend interactivity, period.
That's why I chose backend.
I was only talking about what WILL be.
Nothing ever becomes more simple.
You're delusional. Or a troll (ie. pretending to be delusional).
So don't shit on JS for not fixing this! For fuck's sake.
Not for not fixing this. For having this.
You're blaming JS for having users? I think your blind rage made you lose track in your own words.
What's wrong with wanting people to RTFM before complaining that things are broken because they don't work like they imagine they should?
It's quixotic, useless and not based in reality.
You know what's quixotic, useless and not based in reality? Working with numbers of the order of 2^53.
You've clearly never worked in embedded.
You've clearly never been to Singapore.
I wasn't. And so I don't assume that everywhere in the world is like my neighborhood. That means I'm extremely hesitant of using words such as "all" and "never".
-
@levicki said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Applied-Mediocrity said in Gąska is a tart savour and wants to give floating jobs to Javascript:
No. Have you seen the latest Uwe Boll film? How can you know you won't like anal penetration with a steel wire brush if you haven't tried it? Let's just say there are certain pointers.
Kink thread is
Due to soshal distancing rules this is the new kink thread now. It just so happens that TS doesn't have proper numeric types either so poor @error, otherwise having poked several dick sized holes in a number of pants - all unfortunately his own - is well ahead of us in this game.
With JS, one is able to inflict pain on lots of people, far more at once. All as a token of affection, of course.
-
We have bigints:
-
@Applied-Mediocrity said in Gąska is a tart savour and wants to give floating jobs to Javascript:
Due to soshal distancing rules this is the new kink thread now.
Pah. It's merely appropriately socially-distanced from the kink thread.
-
@error said in Gąska is a tart savour and wants to give floating jobs to Javascript:
We have bigints:
Braggard.
-
@error said in Gąska is a tart savour and wants to give floating jobs to Javascript:
We have bigints:
-
As specified in ECMAScript, mixing
number
s andbigint
s in arithmetic operations is an @error. -
You specify them using
n
suffix to literals.
That's how I'd want floating point to be implemented. Integers as plain literals and floating points with
f
suffix, and never the twain shall meet (unless cast explicitly).
-
-
I remember how similar JavaScript felt to Lua when I wrote little bits of the former (only 161 cloc and one dependency so far) for a web interface project. One numeric type? Check.
var.Name
is syntax sugar forvar["Name"]
? Check. Methods are hash entries inherited from prototype hash? Check. Functions as first-class objects and potential for lots of fun with closures? Check. But Lua is a small scripting language usually embedded in bigger programs written in something else.@Gąska said in Gąska is a tart savour and wants to give floating jobs to Javascript:
You know what's quixotic, useless and not based in reality? Working with numbers of the order of 2^53.
Fun fact: until version 3 the R programming language was limited to vectors of size less than 2^31. Changing the core integer type of the language from 32-bit to 64-bit was deemed too backwards-incompatible even for a major release (C and Fortran interop code being too used to
integer
meaningint32_t
), so they changed the return type oflength(x)
instead: now it can return adouble
whileptrdiff_t
is used internally. It's not as crazy as it sounds, since 2^52 elements is far too much for the hardware R usually runs on anyway.
-
@Mason_Wheeler said in Tales from Coronavee-rooss Italy, mamma mia!:
The problem is that backwards-compatibility constraints have required those basic assumptions to remain baked into the language long after it's been shown that they were very wrong assumptions that bear no resemblance to the reality of modern-day web development.
Backwards compatibility gets blamed for everything. I call bullshit. People never actually TRY to bypass that problem. It's not impossible, and sometimes it's not even hard.
You start by defining some metadata like
<script language="js2">
. Now you can make a newer language and change anything you want. The hard part is ensuring there's easy interoperability with the previous version (because it's not going away any time soon), that it's similar enough that programmers can easily work with both versions and migrate code, and that there's an incentive to do so.The interpreter for the older version will always stay there, but you can now treat it as legacy code and just never touch it again (unless there's a security flaw).
-
@error said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Gąska said in Gąska is a tart savour and wants to give floating jobs to Javascript:
Compare with how this works, which is actually retarded.
It's basically required for prototypal inheritance of methods to work.
You say that as if it disproves the point you're quoting, but it really doesn't.
-
@Applied-Mediocrity said in Gąska is a tart savour and wants to give floating jobs to Javascript:
This is very correct. Divide integers, get integer result.
No. That's wrong. It's always wrong, it's always been wrong, and just because C did it that way doesn't make it any less wrong!
The right way to do it is to have division actually mean division, and have a separate operator for "integer division."
-
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
The right way to do it is to have division actually mean division, and have a separate operator for "integer division."
Operators mean whatever you define them to mean. This is just as true in maths as in programming.
We could have a frob operator. Would that be better?
-
@anonymous234 said in Gąska is a tart savour and wants to give floating jobs to Javascript:
The hard part is ensuring there's easy interoperability with the previous version (because it's not going away any time soon), that it's similar enough that programmers can easily work with both versions and migrate code, and that there's an incentive to do so.
Yeah. That right there is the backwards compatibility concern you're trying to avoid, and if C++ is any indication you've just proposed quite probably the worst possible way to go about it.
-
@error said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
The right way to do it is to have division actually mean division, and have a separate operator for "integer division."
Operators mean whatever you define them to mean. This is just as true in maths as in programming.
Division was already defined for centuries before C came along, and it's not defined as "integer division."
-
@Mason_Wheeler said in Tales from Coronavee-rooss Italy, mamma mia!:
@Gąska said in Tales from Coronavee-rooss Italy, mamma mia!:
It's not as insane when you think about it (especially when you consider what kind of things JS was designed for and what these things require).
As Eric Lippert put it:
The by-design purpose of JavaScript was to make the monkey dance when you moused over it. Scripts were often a single line. We considered ten line scripts to be pretty normal, hundred line scripts to be huge, and thousand line scripts were unheard of. The language was absolutely not designed for programming in the large, and our implementation decisions, performance targets, and so on, were based on that assumption.
The problem is that backwards-compatibility constraints have required those basic assumptions to remain baked into the language long after it's been shown that they were very wrong assumptions that bear no resemblance to the reality of modern-day web development..
If the language can't be fixed, the next best choice is to abandon it and replace it with something else.
If only the pattern of shortsighted decisions (because all we wanted is the monkey to dance) didn't repeat itself so much all the time. The entire industry has been one big Early Access Kickstarter Bitcoin. I will not mention Tesla, so as not to earn immediate downboat from you.... oops...
Alas, Eric L., honoris causa in civilized Discourse, happens to advocate exactly that - please your manglement and shareholders with the dancing monkey, then go and ramble on SO all day long.
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
The right way to do it is to have division actually mean division, and have a separate operator for "integer division."
Or you can have that. I actually started out with good old Pascal, so I was going to mention it, but I think the very idea of having separate operators for "the same thing" might break the modern programmer's brain.
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
Division was already defined for centuries before C came along, and it's not defined as "integer division."
Division on computers doesn't care how it was defined for centuries. Digital data is only an approximation of reality. If the majority of computer processors operate differently on integer and floating point, then that's what we should have.
-
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@error said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
The right way to do it is to have division actually mean division, and have a separate operator for "integer division."
Operators mean whatever you define them to mean. This is just as true in maths as in programming.
Division was already defined for centuries before C came along, and it's not defined as "integer division."
Yet division with remainder was the first type of division I learned in school.
-
@PleegWat said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@error said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
The right way to do it is to have division actually mean division, and have a separate operator for "integer division."
Operators mean whatever you define them to mean. This is just as true in maths as in programming.
Division was already defined for centuries before C came along, and it's not defined as "integer division."
Yet division with remainder was the first type of division I learned in school.
Where did you go to school?
-
@anonymous234 said in Gąska is a tart savour and wants to give floating jobs to Javascript:
It's not impossible, and sometimes it's not even hard.
It's a PITA for OUT arguments (and the equivalent in C and C++) as you need enough space in the receiving stack space to write the value or shit really breaks loose. You can fix that with a shim, but then you have to work out what to do when the value truly won't fit. The fix is, I guess, to provide a separate version of the API function that takes the new types (the ease of doing this varies with the language) but then you've got the problem that you now have a legacy API to support where the old way of working will still blow up in some way. It's all possible, but it's really very hard to handle everything in a truly satisfactory way due to the fundamental limitations. (Protip: have every function able to give an error-return/exception so that you can at least fail cleanly when you have a problem due to upgrades.)
It's so much easier when you don't have to putz around with caller-allocated storage and when every value is boxed. Then you can upgrade the implementations without nearly so much worry about whether stuff is going to blow up in someone's face.
-
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
The right way to do it is to have division actually mean division, and have a separate operator for "integer division."
That's how Pascal works. / is for floats/reals and "div" is used for integer division.
-
@CodeJunkie I know. I started out with Pascal.
That's also how Python works. They started out the C way, but abandoned it for a two-division-operators method once they realized the C way is pants-on-head stupid and completely wrong.
-
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@PleegWat said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@error said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
The right way to do it is to have division actually mean division, and have a separate operator for "integer division."
Operators mean whatever you define them to mean. This is just as true in maths as in programming.
Division was already defined for centuries before C came along, and it's not defined as "integer division."
Yet division with remainder was the first type of division I learned in school.
Where did you go to school?
Somewhere where they teach division before fractions? That would probably be everywhere in the world.
-
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@PleegWat said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@error said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
The right way to do it is to have division actually mean division, and have a separate operator for "integer division."
Operators mean whatever you define them to mean. This is just as true in maths as in programming.
Division was already defined for centuries before C came along, and it's not defined as "integer division."
Yet division with remainder was the first type of division I learned in school.
Where did you go to school?
What? It's just long division where you stop once you would introduce a decimal point, thus you automatically get the remainder (or more correctly like @Gąska mentioned: they wouldn't introduce fractions and thus the decimal point, instead they say "stop when the remaining number is smaller than the divisor, that's your remainder").
-
@levicki said in Gąska is a tart savour and wants to give floating jobs to Javascript:
For your information CPUs only deal with 1s and 0s on the lowest level, and base CPU registers before FPU was tacked onto it were integer only and had only integer DIV instruction which produced quotient and reminder.
Yes, I'm quite aware of that.
C therefore worked with what it had in hardware at the time it was invented.
Then how is it possible that Pascal got it right despite predating C?
-
@levicki said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
Then how is it possible that Pascal got it right despite predating C?
I am not sure what part of Pascal you consider to be right?
Virtually every part in which it differs from C, time and experience have shown that Pascal got that thing right before C got it wrong.
-
Speaking of abusing Javascript's type system
let things = ['A','ii',3,'four']; let thingPicker = function(which) { if (String(which) == Number(which)) { console.log('you picked thing', which, things[which]); } else { which = Math.floor(Math.random() * things.length); console.log('rolled thing', which, things[which]); } return things[which]; }
Works in Opera, not guaranteed anywhere else
-
@hungrier Someone disagrees with your JS abuse.
-
@loopback0 It must be a JavaScript rounding error.
-
@JBert said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@loopback0 It must be a JavaScript rounding error.
Looks like he's on a roll.
-
@JBert said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@PleegWat said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@error said in Gąska is a tart savour and wants to give floating jobs to Javascript:
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
The right way to do it is to have division actually mean division, and have a separate operator for "integer division."
Operators mean whatever you define them to mean. This is just as true in maths as in programming.
Division was already defined for centuries before C came along, and it's not defined as "integer division."
Yet division with remainder was the first type of division I learned in school.
Where did you go to school?
What? It's just long division where you stop once you would introduce a decimal point, thus you automatically get the remainder (or more correctly like @Gąska mentioned: they wouldn't introduce fractions and thus the decimal point, instead they say "stop when the remaining number is smaller than the divisor, that's your remainder").
I'm pretty sure they never made us do long division with decimals. We always stopped when the remainder was smaller than the divisor.
-
@PleegWat I think that's how I was initially taught about recurring decimals. 10/3, keep doing remainders. Do you think it will stop?
-
@PleegWat That's how long division works anyway. Use simple division with remainder (and some shifting by powers of the current base) to lop off the leading digit of the result, then rinse and repeat until you've done enough.
-
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
The right way to do it is to have division actually mean division, and have a separate operator for "integer division."
It might be the Right Way, but saying that the only division is the one that results in floating point (or whatever) results is objectively wrong.
-
@Mason_Wheeler said in Gąska is a tart savour and wants to give floating jobs to Javascript:
Then how is it possible that Pascal got it right despite predating C?
What happened here is that you encountered Pascal and formed some misconceptions about math and now can't believe that you don't know everything.
-
@boomzilla said in Gąska is a tart savour and wants to give floating jobs to Javascript:
can't believe that you don't know everything
that sounds like an apt description
-
@Luhmann But does he have super-cow powers?
42 internet pointzzzz if you get the joke without reading this note: google
apt
super cow powers otherwise
-
@boomzilla said in Gąska is a tart savour and wants to give floating jobs to Javascript:
and now can't believe that you don't know everything.
A recurring theme.