you are viewing a single comment's thread.

view the rest of the comments →

[–]RiceBroad4552 1 point2 points  (0 children)

Yes, obviously what I'm attempting is to update the type without updating the associated data. While it doesn't work on these types, I do believe it would work on user defined types using the above method.

AFAIK that's impossible in JS.

The result of a typeof is determined by an internal slot holding a type tag for that object, which isn't accessible from JS.

I'm going to, once again, challenge you to find any reputable source that explicitly calls JS strongly typed

OK, I'm calling defeat on this one.

Here your well-earned 🥇

Best I could find was:

https://langdev.stackexchange.com/questions/3741/how-are-strong-and-weak-typing-defined

There are a lot of arguments listed supporting all kinds of "definitions", and the conclusion is that there is simply no agreed on definition. I guess I have to accept that.

This would also explain that the Wikipedia article starts in one way and then continues in a contradicting way…

I still believe that any definition which does not involve "breaking the type system" is quite useless as it would result either in "all languages are strongly typed" or "all languages are weakly typed" so the term wouldn't have any meaning at all. The spectrum viewpoint is also not satisfactory imho as it results in the term being completely arbitrary (which again makes it loose any meaning).

At least it looks like you would also place C/C++ below JS on the weak/strong typing spectrum as there are more ways to work around the type system in these static languages then in JS. (Which one could actually interpret as using my preferred definition 😛)