|
|
|
|
|
by flyx86
3569 days ago
|
|
> Some tasks, especially around generic programming, can be very easily expressed in a dynamic language, but require more machinery in a static language. I think this is not generally true and not a point against static typing, but rather against statically typed languages with poor support for generics. Java stands out as the poorest implementation of generics I have ever seen. > For instance, a generic serialization library can be written in a dynamic language, without anything fancy, but providing the same thing in a static language requires more machinery, and is sometimes more complicated to use. As a counterexample, have a look at NimYAML (my work): http://flyx.github.io/NimYAML/
The examples there show how easy it is to provide the user with a generic interface for serialization in a statically typed language. The implementation does not differ much from what you'd do in a dynamic language: Provide a pair of serialization/deserialization handlers for each of [simple types (string, int, float, enums), array/sequence types, tuple/object/struct types, dict/map types, pointer/reference types]. |
|
* Introduce new generic types in a new namespace. .NET did this with `System.Collections` and `System.Collections.Generic`.
* Default unspecified generics to `Object`, including usage of generic types in bytecode tagged with pre-1.5 versions.