3 ms·
> There is nothing implicit about x = 42 in Python. You wrote it explicitly. You wrote the assignment explicitly. You did not write any declaration that "a var
by IshKebab 3y ago
> There is nothing implicit about x = 42 in Python. You wrote it explicitly.
You wrote the assignment explicitly. You did not write any declaration that "a variable x should already exist" anywhere did you?
> Betz should fix his terminology to align with the industry.
His terminology is aligned with the industry. Google it. Here are the top two results for me:
* https://www.quora.com/What-does-the-explicit-and-implicit-declaration-of-variables-in-python-mean https://www.quora.com/What-does-the-explicit-and-implicit-de...
* https://stackoverflow.com/questions/56999347/variable-declaration-implicit-and-explicit-and-advantages-disadvantages https://stackoverflow.com/questions/56999347/variable-declar...
> Like that you can call a function without declaring it:
That's exactly the same as your Python example!! "There's nothing implicit about `puts("Hello");`. You wrote it explicitly."
> When we introduce something into a scope without giving any attributes about it like type, that's a definition. A declaration is something which makes facts known about an identifier: like whether it is a constant, does it have a type, and such. It doesn't necessarily make it exist.
No. A declaration can only declare that a variable exists. Consider this in Javascript:
let foo;
Not "having" declarations and declarations being implicit are exactly the same thing. You're getting tripped up over your language.
- kazinator 3y ago> A declaration can only declare that a variable exists. Yes; that's the only correct thing in your comment. A declaration can declare that a variable exists, and nothing more, which is useful in some language that has a strict rule that variables must have been indicated as existing before they can be used. If a declaration causes the variable to exist, then it's a definition. However, about that specific example, "let foo;" in Javascript is actually a definition. It causes foo to exist in the scope where it appears, with a value of undefined.