Hacker News new | ask | show | jobs
by usefulcat 1385 days ago
C++ has this problem too, but the funny thing is that I rarely run into it in practice.

There is a lot of templatized c++ library code out there, yet in everyday practice I find it's very rare that I need to instantiate a template with a type that causes a compile error.

2 comments

> C++ has this problem too

That's true. C++ templates are exactly like that too.

They are a bit arcane though, and many developers are afraid of them and use them very conservatively or even avoid them altogether so maybe this helps mitigate the issue.

Comptime (at least with the language I'm currently working on) are a lot less scary, and people use them quite a lot without thinking too much, so maybe it's the main difference. And I think Zig is closer to this than it is to C++ templates, but I can't be sure since I've never seen people writing Zig code.

I am afraid of being robbed in a dark alley, now in regards to programming languages I never understood what one should be afraid of.
I've fortunately never been robbed in a dark alley and that's not something that sounds like a real threat to me, but I had to intervene on nightmarish code-bases and some “convenient” feature sometime turn to be real curses (JavaScript `with` anyone?).

Edit: it's late in here, and I completely missed your point. I'm personally not usually afraid with language features, but some requires more work than others to be accustomed to, and not everyone is willing to spend their spare time doing so.

Lucky you :)

I used to code in C++ and I had that problem quite often. Including in implementations of the STL.