11
What is type Juggling? This concept is related only to dynamic typing languages like PHP and Javascript?
11
What is type Juggling? This concept is related only to dynamic typing languages like PHP and Javascript?
10
I only know the term being used in PHP. Has in the documentation. The term probably couldn’t be more correct, but in the wrong sense. And the definition there is poorly made (it’s PHP, so it’s normal).
The documentation starts by defining something that is typical of dynamic language, and so far I don’t know if the term fits. This start indicates that the variable has the type of the value at that time. According to the type theory that’s not even true. The variable has no type, or has a unique type with a tag to a value type. Who has the type is only the value.
Then the documentation starts talking about coercion and then the term seems more appropriate. The language makes a juggling to try to interpret what the programmer wants to do and give some result, even if it’s not what the programmer wants to do. It gives a possibly wrong result to make no mistake. It seems to be a case of inferring something without being sure, which can generate a false positive and cause more harm than was expected from this language resource.
It is not "beautiful" a language you add a boolean to a string and the result is an integer?
Behold working in the ideone. And in the repl it.. Also put on the Github for future reference.
At least now you get one Warning.
The limited coercion that produces a correct result is always no problem. The Juggling is to do what may not work.
This is typical of script and makes sense in very simple codes. I’m sorry if this displeases some, but use a language of script to make applications Nterprise is simply to use the wrong language, and the fact that the language starts to put language resources Nterprise without fixing these problems shows that she is lost or is trying to save herself in an environment that the bulk of the codes are Nterprise and not scripts.
This is typical of weak typing and not dynamic typing, a term that people confuse enough.
In fact JS does something similar, but I haven’t seen the term being used on her. There are other weak typing languages that do not use the term, because in many cases they are a little more controlled, for example C.
Browser other questions tagged php terminology characteristic-language typing
You are not signed in. Login or sign up in order to post.
"Isn’t "beautiful" a language that adds a boolean to a string and the result is an integer?" I couldn’t contain a laugh, haha :D
– Isac
It reminded me of that pearl here: https://www.destroyallsoftware.com/talks/wat :D
– Anthony Accioly
@Anthonyaccioly has a lot of these things, there’s a guy here in Brazil who does a JS standup, it’s sensational! I couldn’t find it online link, but has.
– Maniero
Seeing the rest, one of the two copied the other, or copied them all from someone else.
– Maniero
The guy who does this standup in Brazil is Rodrigo Cardoso @pokemaobr. The JS part was evidently inspired by a talk like this, but it has updated and included templates to other languages and frameworks. D
– Erick Petrucelli
@Erickpetrucelli is my friend :)
– Maniero