3 ms·
So yes, there is a fundamental difference in approach between a pessimistically (?) strongly typed environment and an optimistically loosely typed one. Okay. Go
by creer 3y ago
So yes, there is a fundamental difference in approach between a pessimistically (?) strongly typed environment and an optimistically loosely typed one. Okay. Good point.
I find myself writing with an optimistic more general thinking (so more general typing choices and architecture) but where I know that the code that I never have to write is the most efficient one. Heh. Or perhaps where I could have spent the time to write safer, narrower classes but couldn't be bothered. THEN I have to make the resulting working program safer before later foot-shooting situations. And the thing is in use so compile-time errors are not allowed (in this style of thinking.
"assert" was mentioned earlier. Useful and clean and greppable abstration, yes!
Raku has interesting options for types and signatures that I have not yet abused, like:
multi sub doesnt_handle_everything ( Int $n where {$_ < 5} ) { etc; };
or:
subset Monster of Str where { $_ eq any( <godzilla gammera ghidora> ) };