Re:Things I Was Wrong About: Types
by withinboredom on Sunday September 27, 2020 @11:39AM
(#24607430)
Yeah, for sure. That's certainly possible, but I rarely see people build for it, at least when it comes to value types like strings, ints, etc.
One other thing that I DO like about type-less, is the ability to introspect, for example, in PHP:
``` foreach ((array) $my_class as $property => $value): ```
vs. a bunch of boilerplate and making sure types match up in most strongly-typed languages.
If you write code for a type that "has" stringiness, as expressed by a trait, then anyone can build a variant of their types that expresses that trait.