7 ms·
Todays dynamically typed languages are already too ambiguous for most people to write correct software without tests, how should this get any better with using
by k__ 10y ago
Todays dynamically typed languages are already too ambiguous for most people to write correct software without tests, how should this get any better with using English? :D
- cookiecaper 10y agoYeah, I think this is the key. English is simply not specific enough to work as code. To the extent that "English" some day becomes a programming language, it will be a special dialect that looks an awful lot like something along the lines of SQL.
- majkinetor 10y agoYeah, because current paradigm in programming is about specification. When dominant paradigm becomes focused on probability, then English could become programming language.
- fmap 10y agoYour money was transferred to your account with 60% probability and donated to the Trump Foundation with 40% probability. Press escape or e to abort with 10% probability. So uhm... More seriously, what do you mean?
- pvg 10y agoThe tests are not because the languages are 'ambiguous'.
- braveo 10y agosure it is, you can have syntactically correct programs that do the wrong thing because of name lookup. That name lookup is ambiguous.
- pvg 10y agoWhat's an example of such a program?
- braveo 10y agoI'm not going to play that game, if you can't think of an example of a dynamic language that's syntactically correct but fails at runtime due to name lookup issues, that's on you, but it doesn't change the validity of the point.
- pvg 10y agoVery well.
- cortesoft 10y agoI think he should have said that we don't need tests 'only' because of ambiguity. Even with no ambiguity at all, would still be needed.
- pvg 10y agoYou're in an empty room with a light switch. GLaDOS says 'please turn on the light'. You flip the switch and the floor disappears, dropping you into a pool full of hungry gators. That doesn't make 'turn on the light' ambiguous.
- braveo 10y agoThankfully, that's not how programs work, so your analogy doesn't really apply.
- kolme 10y agoNo, dynamic languages are not "ambiguous" in any possible way. Programming languages are unambiguous by definition, as any formal languages. What they are, indeed, is dynamic. The lookups you are talking about are done in runtime, so the result of these lookups can vary depending on the state in memory at a given time. That doesn't mean they're ambiguous. Everything is perfectly unambiguous and deterministic. They're just dynamic. And that's fine. FYI: People also write tests in static languages.
- k__ 10y agoSorry, I'm not a native speaker. What I meant were things like automatic type conversions or used of undefined object properties, which aren't ambiguous, but certainly seem ambiguous and lead to many errors.