Re:Some thoughts on hylang (2017)
by coldtea on Thursday March 21, 2019 @09:17AM
(#19451916)
>The fight against imperative programming has come so far that we banned not just goto but every commonly used control flow primitive.
Not really. We have not banned them from anywhere, except where they were not part of the culture (e.g. Scheme -- and even there you can use them trivially).
Almost all working professional programmers (say, 99% of them, aside a statistically insignificant percentage working professionally with Haskell and Lisp and F# and so on) use for, while, if, exceptions, and so on. Hardly "banned".
>We have banned global variables too
And for good reason.
>and FP purists want to go even further and remove the assignment operator
Your initial data and constants need to come from somewhere, so nobody bans the assignment operator. But if you can avoid mutations, sure.
>What is the end result except more confusing code ?
Clearer code that you didn't took any time to study the concepts of to understand?
Having to know fewer concepts to use a language is not the same thing as the code being easier to understand.
A language with fewer concepts can lead to weak expressibility, so you need to e.g. write 100 lines to do what another does in 5, and with their intention more explicit in the code.
For an extreme example, consider how easy it is to understand a piece of code doing the same thing in assembly and in C. The C code will be much easier to follow, despite requiring you to learn more language constructs.
And inversely, a BASIC programmer could say the same things you said, but about, say, Python: "Why do we need all those language features, aren't line numbers and GOTO simpler?"
If learning 5 new concepts makes it possible to handle the same functionality in half the code, understand old codebases better, and write the same thing with less bugs, then those 5 concepts lead to simpler code -- even if they add to what someone already knows.
Not really. We have not banned them from anywhere, except where they were not part of the culture (e.g. Scheme -- and even there you can use them trivially).
Almost all working professional programmers (say, 99% of them, aside a statistically insignificant percentage working professionally with Haskell and Lisp and F# and so on) use for, while, if, exceptions, and so on. Hardly "banned".
>We have banned global variables too
And for good reason.
>and FP purists want to go even further and remove the assignment operator
Your initial data and constants need to come from somewhere, so nobody bans the assignment operator. But if you can avoid mutations, sure.
>What is the end result except more confusing code ?
Clearer code that you didn't took any time to study the concepts of to understand?
Having to know fewer concepts to use a language is not the same thing as the code being easier to understand.
A language with fewer concepts can lead to weak expressibility, so you need to e.g. write 100 lines to do what another does in 5, and with their intention more explicit in the code.
For an extreme example, consider how easy it is to understand a piece of code doing the same thing in assembly and in C. The C code will be much easier to follow, despite requiring you to learn more language constructs.
And inversely, a BASIC programmer could say the same things you said, but about, say, Python: "Why do we need all those language features, aren't line numbers and GOTO simpler?"
If learning 5 new concepts makes it possible to handle the same functionality in half the code, understand old codebases better, and write the same thing with less bugs, then those 5 concepts lead to simpler code -- even if they add to what someone already knows.
>What is a monad exactly if not the ";"?
Tons of other things.