|
|
|
|
|
by davexunit
3943 days ago
|
|
I use a pattern matcher that can match against types in Scheme, a
language without static typing. Static types are just not the crucial
feature that some people make them out to be. I believe this
criticism of Pascal and C from SICP applies to other languages with
static types (sans the pointer stuff): Pascal and C admit structures whose elements are structures. However,
this requires that the programmer manipulate pointers explicitly, and
adhere to the restriction that each field of a structure can contain
only elements of a prespecified form. Unlike Lisp with its pairs,
these languages have no built-in general-purpose glue that makes it
easy to manipulate compound data in a uniform way.
With static typing, it's also difficult to write procedures that operate on arguments of which the type is none of the procedure's business.https://sarabander.github.io/sicp/html/2_002e2.xhtml#FOOT73 |
|
The thing is that any operation you are using on those arguments (of which the type is none of the procedure's business) can be described by an interface which the argument implements.
You're much safer knowing in compile time that the operations you'll use will be valid, instead of hoping something doesn't crash in runtime.