News for hackers. Stuff that matters.
Re: Haskell is our first choice for building production soft... by pjmlp on Monday January 11, 2021 @07:49AM (#25728191)
Not only do modern compilers give better error messages (with room for improvement still), it is possible to make use of enable_if and if constexpr/static_assert to give proper error messages for templates, and when C++20 gets widespread enough, concepts.
Re: Haskell is our first choice for building production soft... by dkersten on Monday January 11, 2021 @10:27AM (#25730147)
Modern clang (usually, there are edge cases) gives pretty good error messages over all. And like you point out, if you use constexpr you get even better messages. Hell, I watched some cppcon videos over the weekend and learned that clang can even detect out of scope access of temporaries when in a constexpr (but not otherwise sadly), and also that in many cases, a lot more of a program can probably be constexpr than we might think.

The talks were by Jason Turner, who has an ARM emulator implemented entirely as constexprs and a test suite that runs at compile time (so if it compiled, the tests passed). Obviously for actually interacting with it, its not running at compile time, but the logic has the ability to run at compile time, which is pretty cool.

Re: Haskell is our first choice for building production soft... by pjmlp on Monday January 11, 2021 @10:40AM (#25730348)
Jason Turner has very cool talks, check the C64 one if you still haven't watched it.
Re: Haskell is our first choice for building production soft... by dkersten on Monday January 11, 2021 @12:31PM (#25732380)
I haven’t watched that one yet, thanks for the recommendation! I’ll give it a look tonight.
Re: Haskell is our first choice for building production soft... by dmitriid on Monday January 11, 2021 @01:10PM (#25733105)
I personally call it "old school" vs "new school".

"Old school" is asically the programming languages that originated in the 70s-80-90s. An incorrect but an illustrative way to describe error messages for them is "The programmer needs to suffer". They are any combination of cryptic, terse, complex, exposing internal machinery of the compilers and linkers etc. There are many reasons for this: computers were not powerful enough to afford better code analysis, parsing, backtracking etc; the users of the tools also knew the tools and could tinker with them etc.

"New school" is from late 2000s on. I usually say it started with Elm. Clear messages pinpointing the exact problem, solutions to problems inside error messages, error clarity as one of the priorities in language/compiler/tool design.

Re: Haskell is our first choice for building production soft... by pjmlp on Monday January 11, 2021 @03:09PM (#25735728)
Some of it caused by too much reliance on tools like yacc.

Category grammars were much better but more resource demanding, just like proper ASTs instead compiling as one goes.

Ironically there were already some attempts to Smalltalk like tooling for C++ back then, but again as you mention too much resource constraints.