News for hackers. Stuff that matters.
Re:Show HN: Crown – A flexible game engine written from scra... by zakirenish on Thursday June 22, 2017 @08:21AM (#14611691)
If you come to finance, most of the developers love premature templatization, it makes them feel like they know something. Not sure it that can be attributed to their insecurity about C++ coding skills, but it gets really ridiculous at times.
Re:Show HN: Crown – A flexible game engine written from scra... by jcranberry on Thursday June 22, 2017 @08:37AM (#14611788)
I have a friend who runs a hedge fund, not really insecure at all but uses templates vigorously. More stuff in compile time rather than runtime. In critical sections inheritance can be prohibitively expensive because of the use of lookup tables.
Re:Show HN: Crown – A flexible game engine written from scra... by monocasa on Thursday June 22, 2017 @11:47AM (#14613042)
Thrashing your I$ because you have too many template instantiations can be prohibitively expensive too, it's just harder to metric.
Re:Show HN: Crown – A flexible game engine written from scra... by mhh__ on Thursday June 22, 2017 @12:50PM (#14613539)
Just how many nested templates are we talking about here? You can have that problem (obviously) with or without templates. Most sane template designs don't exist when the program is actually run (Debugging them when they don't work is another matter)
Re:Show HN: Crown – A flexible game engine written from scra... by makapuf on Thursday June 22, 2017 @12:35PM (#14613435)
if you're using templates for compile time computations it's maybe time for c++14 or even c++17 simpler constexpr functions (if possible and available, and if allowed to, ofc.)
Re:Show HN: Crown – A flexible game engine written from scra... by dbartolini on Thursday June 22, 2017 @08:29AM (#14611732)
I guess they start over each time the requirements change? :)
Re:Show HN: Crown – A flexible game engine written from scra... by ghostly_s on Thursday June 22, 2017 @11:34AM (#14612948)
What does this have to do with the link?
Re:Show HN: Crown – A flexible game engine written from scra... by typon on Thursday June 22, 2017 @09:28AM (#14612053)
What's wrong with using templates vigorously?
Re:Show HN: Crown – A flexible game engine written from scra... by Matthias247 on Thursday June 22, 2017 @10:14AM (#14612352)
Some things that are not so nice about templates:

- dozens to hundreds of compiler error lines for a single error, where it's hard to find out what the real problem is (IDEs often point to the wrong line)

- Code is hard to follow. E.g. try to figure out from boost asio source code which code is actually used if if you do a async_read(socket). I personally gave up after the second level of template substitutions, and have only a chance to follow the execution path in the debugger.

- Besides goto definition also other IDE features do not work really well with templates. E.g. no autocompletions for constructors with make_shared.

Re:Show HN: Crown – A flexible game engine written from scra... by mbel on Thursday June 22, 2017 @11:52AM (#14613100)
As a bonus you can meditate deeply on all conseqences of using tempates in the vastly increased compilation time that they are going to introduce.
Re:Show HN: Crown – A flexible game engine written from scra... by typon on Thursday June 22, 2017 @11:14AM (#14612790)
D has templates, yet their error messages seem fine for debugging what's going on.
Re:Show HN: Crown – A flexible game engine written from scra... by mhh__ on Thursday June 22, 2017 @12:53PM (#14613559)
That's because D's standard library doesn't use templates in the same way as the STL (No iterators, less policies). Also, D has is actually vaguely modern and has proper static reflection, static asserts and static if: Writing template constraints is easy, unlike C++ (even with Concepts/-lite)
Re:Show HN: Crown – A flexible game engine written from scra... by ryandrake on Thursday June 22, 2017 @10:50AM (#14612608)
All three of these seem to be compiler/tool UI problems and not problems with templates themselves.
Re:Show HN: Crown – A flexible game engine written from scra... by zakirenish on Thursday June 22, 2017 @09:41AM (#14612134)
Well, let me give you an example that I have seen recently. There was this function that suppose to convert numeric value to string. So numeric type was templatized. Then with combination of enable_if and static_asserts there were checks to avoid doubles/floats negative numbers. So whats there left besides unsigned integers?
Re:Show HN: Crown – A flexible game engine written from scra... by nyanscat on Thursday June 22, 2017 @11:36AM (#14612967)
explicit overloads or concepts