4 ms·
I have no idea how people program effectively without types. `x = call_some_function()` What can I do with x now? Does it have methods? Which ones? Is it some
by staticassertion 5y ago
I have no idea how people program effectively without types.
`x = call_some_function()`
What can I do with x now? Does it have methods? Which ones? Is it sometimes null? Sometimes a list?
In a typed language I can just look up the type definition, and just as importantly, my IDE will know what I can do as well.
- foxylad 5y agoIf you have to consume functions called call_some_function(), you've got way bigger problems than untyped parameters. A well designed function/class will have a descriptive name and descriptive parameters, which should give you good hints about their usage. And if it that isn't enough, a quick scan of the code will show you exactly how the function works - a good idea (even in typed languages) if you have any doubts about what you're calling. The fact that people can program effectively without types is demonstrated by the enormous volume of code in non-typed languages.
- kortex 5y agoA) I think call_some_function() is metasyntactic, not literal. But even if it was... B) I largely agree but I still don't get how people manage without types, though I get why it occurs. People have different brain styles and hence different programming styles. Personally I dislike dealing with untyped code with "descriptive" names, because it's rarely descriptive enough. I'd take a strong type system with methods like .call(), .string(), .get(), .issue() with an IDE vs overly-descriptive methods like .frob_the_snozzberries() and .squelch_parrots() any day. It's not composable, it's not predictable - wait was it .frob_snozzberries()? There's no symmetry. That style usually accompanies very dynamic code, since if your interface is very specific, .post() only can mean one thing.
- staticassertion 5y agoSo how do I know if a function will return a list or a string? Will it be "get_things_list" ? Or maybe 'get_things', it's got an s, so therefor it's many things? Or at least an iterable thing? Or maybe an object that contains some values? If there are many things can I index into it, or just iterate over it? If I have to guess, will that force me to use a List over an Iterable, even if that's the wrong abstraction? At some point you have to convey the type or I have no idea wtf you're giving me, and I'd rather have you convey the type in a way my computer can understand than have you convey it through the godawful way that people name things. That people manage to do so is no endorsement. Humans managed for quite a while without antiseptic but I don't hear anyone endorsing going around with shit on their hands. Honestly, I've been programming in both typed and untyped languages for ages and it I am asking how you manage this problem, because I find IDEs radically less effective in dynamically typed languages, I find that I have to ask more questions, do more manual work, etc. In typed languages these things become trivial.