4 ms·
It's like writing fn square(numberToBeSquared : number): number { return numberToBeSquared * numberToBeSquared; } The one letter variable versio
by lalaithion 6y ago
It's like writing
fn square(numberToBeSquared : number): number {
return numberToBeSquared * numberToBeSquared;
}
The one letter variable version of the function is perfectly readable. Most generics aren't used in a significantly complicated way. Sure, maybe if you're doing something like Haskell's lenses, then you should use descriptive names might be better, but how often are you writing
type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t
and is
type Lens source dest gettable settable =
forall structure. Functor structure =>
(gettable -> structure settable)
-> source
-> structure dest
really any easier to read?
- scns 6y agoThe second Lens version is way easier to read IMO
- lalaithion 6y agoThanks for providing this feedback - now I'm glad I actually bothered to write it all out, because while I was doing that I was thinking to myself "This is going to be nonsense to anyone who doesn't already understand the first one".
- Aeolun 6y agoEither is really, really hard to read, but I suspect that’s more haskell and the code itself than the naming.
- seanparsons 6y agoIf you think that's hard don't look at the types for any moderately complicated JavaScript project.