Can also use more defensive and reverse-algebra logic and cut out most of the conditionals and validation.
That's always incredibly satisfying.
Can also use more defensive and reverse-algebra logic and cut out most of the conditionals and validation.
That's always incredibly satisfying.
yeah, i do a lot of that sort of stuff too. another thing is strong typing lets you prevent incorrect things from even getting past the compiler, like fixed size arrrays and creating derivative types of base types so only correct ranges of values are available to the caller. saves a lot of mistakes.
dynamic typed languages are so easy to create bugs that hide forever. another one is variable shadowing, most go programmers are constantly using the allocate-and-assign := operator all the time for everything and explicitly specifying return values. those two also can create hard to find bugs. i avoid them altogether by named return values and short functions with "naked" returns. my IDE also always shows the function signature at the top when it's scrolled down part way in so the return values names are always in front of me.
Well, that's the Rust advantage, I guess. I have barely started writing Typescript and I already sort of hate it.
rust is full of expressive constructs. overflowing. i'd sooner learn typescript than rust, the worst of typescript is objects and inheritance. i've seen enough of how it works and how ugly its syntax is. i mean, the whole thing of the last statement's return value being the return for a function is just stupid, though not entirely stupid.
all the stuff that gives hints to the garbage collector is way too arcane. yes, rust has a fucking garbage collector. this is one of the biggest lies of Rust evangelists. IT HAS A FUCKING GARBAGE COLLECTOR. it's a retarded one, that you have to give exhaustive, explicit instructions how to manage the memory of everything. you can mess that up pretty easily too but seriously, having to say "i'm just borrowing this, will return at end of function" is so lame compared to a smart GC that uses escape analysis during compilation to generate those hints for you.
there's a lot of things that these supposed "expressive grammars" make "easier" but they actually just end up making the code far more complex to understand and read. they create a very idiosyncratic idiom very easy to create for programmers and that's bad for the poor bastard that comes afterwards, who then has to basically learn a new language.