News for hackers. Stuff that matters.
Re:Compile Time C++ Snake Game (2016) by gsaga on Sunday July 15, 2018 @04:50AM (#17534414)
... and I was feeling smart because I implemented compile time float calculations...
Re:Compile Time C++ Snake Game (2016) by atesti on Sunday July 15, 2018 @08:06AM (#17534884)
Sounds like what Jonathan Blow demoed in his new programming language JAI: https://youtu.be/UTqZNujQOlA?t=2024 Execute a invaders game with OpenGl while compiling and embedding the score in the code (Just a demo, the idea is to replace makefiles with compile time execution, etc.)
Re:Compile Time C++ Snake Game (2016) by adamnemecek on Sunday July 15, 2018 @01:41AM (#17533962)
C++ templates are so overpowered. It has dependent types by accident.
Re:Compile Time C++ Snake Game (2016) by earenndil on Sunday July 15, 2018 @01:57AM (#17534000)
Honestly I wouldn't say overpowered so much as poorly designed. I don't think there's anything wrong with having a way to perform arbitrarily complex operations at compile time; in fact, ante[1] (and others) even have this as a selling point. The problem comes when you don't mean for this to happen and you're just trying to implement type erasure.

1: https://github.com/jfecher/ante

Re:Compile Time C++ Snake Game (2016) by pietroglyph on Sunday July 15, 2018 @03:00AM (#17534124)
Ante is super cool! I think the following passage neatly encapsulates the power of (thoughtful) compile-time extensiblity:

> "Ante provides several different methods of memory management, including manual management. Don’t want to bother with any of it? Simply 'import GC' to use a garbage collector."

Re:Compile Time C++ Snake Game (2016) by earenndil on Sunday July 15, 2018 @04:10AM (#17534317)
Do note that most of the language as specified isn't yet implemented yet. There's no GC nor is there (afaik) any form of memory management beyond malloc/free. Also pattern matching isn't there yet. However, development seems to be reasonably active so I'm sure those are in the pipeline.
Re:Compile Time C++ Snake Game (2016) by pjmlp on Sunday July 15, 2018 @02:32AM (#17534066)
Yes, the positive part is that while they might be clumsy from the point of view of Lisp macros or Idris, at least I get to use them at work without having to justify why the customer would need to migrate their tooling to another programming language. :)
Re:Compile Time C++ Snake Game (2016) by fjsolwmv on Sunday July 15, 2018 @01:57AM (#17533999)
By accident as in the creators didn't intend it but it was discovered later, or just not directly expressible in the language (so "by accident" is via anthropomorphism of the type language)?
Re:Compile Time C++ Snake Game (2016) by knome on Sunday July 15, 2018 @02:08AM (#17534026)
http://www.stroustrup.com/bs_faq.html#understand

> I was very surprised when Jeremy Siek first showed my the compile-time if that later became std::conditional, but I had aimed for generalty (and gotten Turing completeness modulo translation limits). I opposed restrictions to C++ immediately when Erwin Unruh presented what is widly believed to be the first template metaprogram to the ISO Standards committee's evolution working group. To kill template-metaprogramming, all I would have had to do was to say nothing

Discovered by users after being created as a side effect of the power of the template expansion defined by the committee, and then kept thereafter.

Re:Compile Time C++ Snake Game (2016) by Negitivefrags on Sunday July 15, 2018 @04:01AM (#17534289)
I would say that you are misrepresenting the thing you are quoting.

It was a side effect yes, but it’s not like a working compiler was released and a users found this.

It was discovered during the design phase of templates by people involved in standardisation process.

And it sounds like leaving it in was even a contentious point that others were against.

So far from an accident, it was a feature that was extensively discussed and intentionally supported.

Re:Compile Time C++ Snake Game (2016) by abenedic on Sunday July 15, 2018 @12:31AM (#17533790)
So, this is old, but pretty cool. I really like his VR experiments though.
Re:Compile Time C++ Snake Game (2016) by zilchers on Sunday July 15, 2018 @01:40AM (#17533959)
And I thought I got bored at work...