Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is “static typing”, and how is it similar/dissimilar to Smalltalk?

0
Posted

What is “static typing”, and how is it similar/dissimilar to Smalltalk?

0

Static typing says the compiler checks the type-safety of every operation STATICALLY (at compile-time), rather than to generate code which will check things at run-time. For example, with static typing, the signature matching of fn arguments is checked, and an improper match is flagged as an error by the COMPILER, not at run-time. In OO code, the most common “typing mismatch” is invoking a member function against an object which isn’t prepared to handle the operation. E.g., if class “Fred” has member fn “f()” but not “g()”, and “fred” is an instance of class “Fred”, then “fred.f()” is legal and “fred.g()” is illegal. C++ (statically typed) catches the error at compile time, and Smalltalk (dynamically typed) catches the error at run-time. (Technically speaking, C++ is like Pascal–PSEUDO statically typed– since ptr casts and unions can be used to violate the typing system; which reminds me: only use ptr casts and unions as often as you use “goto”s).

0

Static typing says the compiler checks the type safety of every operation statically (at compile-time), rather than to generate code which will check things at run-time. For example, with static typing, the signature matching for function arguments is checked at compile time, not at run-time. An improper match is flagged as an error by the compiler, not by the run-time system. In OO code, the most common “typing mismatch” is invoking a member function against an object which isn’t prepared to handle the operation. E.g., if class Fred has member function f() but not g(), and fred is an instance of class Fred, then fred.f() is legal and fred.g() is illegal. C++ (statically typed) catches the error at compile time, and Smalltalk (dynamically typed) catches the error at run-time. (Technically speaking, C++ is like Pascal pseudo statically typed since pointer casts and unions can be used to violate the typing system; which reminds me: only use pointer casts and unions as often as you use go

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123