News for hackers. Stuff that matters.
Re:Why did we ever think a student's first programming langu... by Retric on Sunday June 27, 2021 @07:17AM (#27650606)
Haskell very much has an if then else equivalent.

  if' :: Bool -> a -> a -> a
  if' True  x _ = x
  if' False _ y = y
https://wiki.haskell.org/If-then-else

Also, Java was designed to handle performance critical code like that. That’s why people call it a fast language, you can write non performance critical code however you want, but optimize for speed and it’s going to look like C.

Re:Why did we ever think a student's first programming langu... by josephg on Sunday June 27, 2021 @10:15AM (#27651727)
Maybe I'm nitpicking, but I see that construction as the equivalent of the ternary operator. Its not the if-else construct you find in imperative languages. The claim was "Every language can do some form of if then else" - which I read to imply that every language is semantically familiar to someone who knows python / C / java. Haskell's approach is certainly not familiar if you've only ever written javascript or something.

> Also, Java was designed to handle performance critical code like that. That’s why people call it a fast language

Sure; but my point is that idiomatic java looks quite different from idiomatic C. If your first language is C, its easy to write java that looks like C. If your first language is java, you can torture C into looking like a bad version of java. But both approaches are newbie mistakes. Learning a language involves a lot more than just being able to make programs that work at all. Its also learning a culture, and learning to make code that fits well with the existing ecosystem. You won't get very far in the java programming community if you don't know how to write java in the popular style.

Thats why they say learning your second language is difficult. You need to unlearn some of how you approach programming so you can come at your second language with fresh eyes.

Re:Why did we ever think a student's first programming langu... by Retric on Sunday June 27, 2021 @09:51PM (#27657303)
Doing better is irrelevant when we are talking about what constitutes the basics of programming. You can always improve your personal skills, but the basics are in effect the smallest set of skills that works.
Re:Why did we ever think a student's first programming langu... by josephg on Monday June 28, 2021 @04:58AM (#27659513)
“The smallest set that works” in the real world requires that you can write code that others can read, write code that could pass a PR. And that you can read the code that others write.

If you only know enough Java to be able to translate awkwardly from C, you aren’t fluent in Java. I know bits and pieces of Haskell - probably enough to make working programs. But I’m not fluent in Haskell. I can’t read the code others write. I can’t think in Haskell. And that’s not enough.

Re:Why did we ever think a student's first programming langu... by Retric on Monday June 28, 2021 @07:59AM (#27660712)
This is talking about students. Writing code that works and others can read is roughly the benchmark for operating at the professional level. It’s not enough to get a job at FAANG, but many company’s have lower standards.

“Professional” is not what most people mean when they talk about the basics as say a welder, cook, etc.