← Back to context

Comment by randyrand

4 days ago

Maybe just me, but huge complicated languages like C++ seem as unappealing as ever.

If I’m going to write code by hand, the requirement for a beautiful pleasant language is bigger than ever.

Rust is quite complicated but people like it a lot. Python too in a way - it's quite large and complicated but it exposes the complexity in a very gradual way and you can ignore so much of the language and still get things done.

I agree with you about simple languages though. I really like Go - the "there should be only one way to do things" from the Zen of Python actually applies to Go in a way that it doesn't apply to Python at all.

  • Languages like Go, is how you end up with what appears simple on the surface, while in reality is full of gotchas and boilerplate for what complex languages support out of the box.

    That is how you get double nils, exception handling that pretends not to be one, url based imports that requires source code and rewrites when the host changes, generators by code patterns, generics that miss some language constructs,....

    • Written a few hundred kloc of go and I'd never heard of double nil. Turns out it's nasty.

          var i interface{} // (Type: nil, Value: nil) -> i == nil is TRUE
          var p *int = nil  // p is nil
          i = p             // (Type: *int, Value: nil) -> i == nil is FALSE!

      4 replies →

    • > url based imports that requires source code and rewrites when the host changes

      This is not the case. It can be avoided quite easily with 'replace' directives and/or GOPROXY.

      1 reply →

  • This is just how I've felt writing both Rust and C++. Rust's language complexity often feels like it's there so that I don't have to think about so much complexity when interfacing with the code, whereas C++'s language complexity introduces footgun after footgun and I have to think very carefully about what everything could possibly do (e.g. if destructors even get run in certain instances when I'd expect them to).

Lots of programmers match the right language to the right job, I think the zen of C++ is embracing the ugly as a feature; there are so many subsets of that language you never have to leave it.

  • > there are so many subsets of that language you never have to leave it.

    I wouldn't call it "subsets" as much as support for "Multiple Paradigms" in the same language. They can all be used together to express powerful abstractions. James Coplien wrote "Multi-Paradigm Design for C++" in 1998 (before C++11!). Then people figured out Template metaprogramming etc. and the design space became even more wider.

    Today with all the available language features and library additions you never have to leave the language at all whatever be the platform(cpu-arch+OS) you are working on. Add-in trivial interop with C and there is nothing out of bounds.

  • Exactly, you can code like C devs (Petzold used the C subset in his famous Win32 book), go to the extreme of GUI, ORMs, Web frameworks in 1990's, inspired from Smalltalk before Java and .NET took over that role, go crazy with Haskell style programming, or chose somewhere in between.

On the one hand, almost everyone (including C++ fans) agrees that the language is too big. On the other hand, comtracts just formalize an existing and useful concept.

  • Profiles should (hopefully) rein this in by getting people to start subsetting language features in their codebases

    • Let's see, they are still a bit of a dream regarding what they wish for, and what current static analysers can achieve, especially the lifetime one.

      21 replies →

  • Exactly. Many years ago people used to use C `struct` for objects but then that was formalized as `class`.

I view C++ (and increasingly C# and Java) as a test bed for language features. You throw every possible feature into it and people can then see what makes sense and what doesn't. That allows others to pick features and use them for more opinionated and simpler languages.

  • That "test bed" description fits Rust way better. Rust is in many ways also significantly more complex than C++, believe it or not.

    rustc is also awfully shoddy. https://github.com/rust-lang/rust/issues/164348#issuecomment...

    • > That "test bed" description fits Rust way better.

      This assertion seems rather debatable given Rust's general lack of trailblazing in the language design space.

      > Rust is in many ways also significantly more complex than C++, believe it or not.

      I'm a bit skeptical that "many" is the right qualifier there. "Some", perhaps, but it isn't obvious to me how you'd reach "many".

  • C++ as a reference language. That’s actually a great concept.

    Doesn’t hurt that it has fantastic, minimal, navigable documentation.

    You can see the entirety of the language on a single page: https://cppreference.com/