I dint know many OO languages that don’t have a useless toString on string types.
Well, that’s just going to be one of those “it is what it is” things in an OO language if your base class has a toString()
-equivalent. Sure, it’s probably useless for a string, but if everything’s an object and inherits from some top-level Object
class with a toString()
method, then you’re going to get a toString()
method in strings too. You’re going to get a toString()
in everything; in JS even functions have a toString()
(the output of which depends on the implementation):
In a dynamically typed language, if you know that everything can be turned into a string with toString()
(or the like), then you can just call that method on any value you have and not have to worry about whether it’ll hurl at runtime because eg. String
s don’t have a toString
because it’d technically be useless.
Everything that’s an Object
is going to either inherit Object.prototype.toString()
(mdn) or provide its own implementation. Like I said in another comment, even functions have a toString()
because they’re also objects.
A String
is an Object
, so it’s going to have a toString()
method. It doesn’t inherit Object
’s implementation, but provides one that’s sort of a no-op / identity function but not quite.
So, the thing is that when you say const someString = "test string"
, you’re not actually creating a new String
object instance and assigning it to someString
, you’re creating a string
(lowercase s
!) primitive and assigning it to someString
:
Compare this with creating a new String("bla")
:
In Javascript, primitives don’t actually have any properties or methods, so when you call someString.toString()
(or call any other method or access any property on someString
), what happens is that someString
is coerced into a String
instance, and then toString()
is called on that. Essentially it’s like going new String(someString).toString()
.
Now, what String.prototype.toString()
(mdn) does is it returns the underlying string
primitive and not the String
instance itself:
Why? Fuckin beats me, I honestly can’t remember what the point of returning the primitive instead of the String
instance is because I haven’t been elbow-deep in Javascript in years, but regardless this is what String
’s toString()
does. Probably has something to do with coercion logic.
Sure!
Honestly, just properly funding anything that is designed to do benevolent things for the community as a whole is a tough sell with way too many US community politicians
This seems to be a problem with at least conservative politicians everywhere. In Finland where I live we do still have the vestiges of a welfare state (and it really is vestigial at this point), but right wing politicians keep dismantling it and cutting taxes on the rich, and later on leftist politicians find it impossible to roll back any changes due to resistance from the right.
Yeah this is absolutely the most fucking infuriating part about conservatives. They’ll crow about how “leftists” (ie. what seems like anyone left of the Strasserites) want to have a one-party fascist state that controls every aspect of people’s lives, and when they get in power they start doing exactly what they accuse leftists of wanting.
They also have a real habit of blaming all of their own fuckups on the left; our current extremist government got in to power by claiming that our previous leftist government caused some sort of massive debt problem (government debt did increase, but they had COVID to deal with), when the reality is that it has been the previous 20 or so years of right wing governments who have consistently cut taxes for the rich and sold government property to cover for the budget deficits. Conveniently reich-wingers ignored the part where their ideology is the one that wants to cut taxes, leading to higher debt and cut social programs and public services, and somehow they’re stupid enough that they don’t even see it themselves and they believe it when their lying politicians claim it is all the evil leftists’ fault that our public healthcare is now completely broken and the welfare system is among the worst in Europe.
The way I’ve understood the “defund the police” movement’s point is that they’re saying police funding is excessive because a lot of the things cops do should be handled before the cops have to get involved, eg. with higher funding for mental health and social services, housing for homeless people etc. So the point is that you wouldn’t need as many cops in the first place if things were handled more humanely “downstream” so to speak, instead of just letting problems fester until things go sideways
I assume that the reich-wingers will use these protests as justification for crackdowns.
Here in Finland we had months of strikes against our current extremely conservative government’s cuts to public services, welfare etc. – naturally their reaction was to refuse to negotiate and make political strikes illegal, and to use the strikes to vilify unions and as scapegoats for poor economic performance
we thought the values of this corporation were very clear in terms of access to information.
Well there’s your problem.
The values of any corporation are “make the stockholders and executives richer”. Whatever utter horseshit they spew in their “mission statements” and “values” documents are just that, utter horseshit.
Weeelll, they do still export a lot even to countries that have nominally sanctioned them. Obviously less nowadays than before the full-scale invasion of Ukraine, but China definitely isn’t their only export destination for petrochemicals:
(source for graph)
What might screw Russia over is their reliance on Chinese imports, however. Everything they need for eg. maintaining that oil production – let alone consumer products – has to come from somewhere, mostly either from dodging sanctions (making it more expensive and slower) or from China
Musk, the employees said, was not pleased with Tinucci’s presentation and wanted more layoffs. When she balked, saying deeper cuts would undermine charging-business fundamentals, he responded by firing her and her entire 500-member team.
The dude’s a petulant child. No wonder conservatives fawn over him.
Hey I still get impressed by smartphones and I’ve had one for almost 20 years now. I also remember when the emscripten LLVM-to-asm.js compiler came out which was one of the first tools that allowed people to compile pretty surprising things for browsers, and I definitely still get impressed by the fact that we can emulate old systems in our web browsers which were absolutely not intended for that.
Oh I wish it was. Eg. here in Finland sharing movies etc. among friends or downloading them off the internet used to be legal as long as you weren’t doing it for profit or distributing stuff to a huge audience, but that changed in 2006 because the new EU Copyright Directive required it, and that directive was hugely influenced by the likes of WIPO.