Live data from Hacker News

Based C++

github.com

21–30 of 40 posts

Re: Based C++

#21
post #13

Earlier quoted context omitted.

But some are more suited then others. For example, I believe the C standard to not describe what is supposed to happen when the definition of a function changes.

It doesn't have to, that is an implementation detail or OS specific feature. Two scenarios where the definition of a function in C changes, are dynamic libraries on OSes that allow reloading the same library multiple times, or self-rewriting code. Here you stay within the realms of a compiled language implementation, where what happens, is only expecified by compiler specific features, or OS capabilities handling exe…

Yes, but it suddenly matters if you execute code in an interpreter, where the user can change any symbol/function definition at anytime. What do you do with a a struct definition, that changes? Do all the functions return something different now? Or does the return type of all the functions change to an anon struct and the name now refers to something different. Stuff like that is what the distinction is between a compiled and an interpreted language.

Re: Based C++

#23
post #19

Earlier quoted context omitted.

Usually means "based on facts".[1] Here, probably used ironically. [1] https://www.urbandictionary.com/define.php?term=based

I don't think I've ever seen it used outside of a heavily irony-poisoned context.

So it fits perfectly.

Re: Based C++

#24
post #14

Man, that went way over my head. But if you just want to run C++ in a REPL, you can use Clang-Repl https://clang.llvm.org/docs/ClangRepl.html > which uses the LLVM JIT to "interpret" C++.

I had good experience with Xeus cling for a notebook interface.

Re: Based C++

#25
post #20

Would anyone like to explain in text form how this works? I've got as far as the use of <{ meaning to run at compile time, so the whole thing is going to be one of those template metaprogramming stunts.

it is "simply" a DSL implementing a full custom language that is run at compile time. As far as I can tell the DSL is implemented with the tried-and-true technique of expression templates[1] combined with constant evaluation and unrestricted template value parameters (although these days there are multiple options to implement compile time DSLs, up to compile time parsing of strings).

As to why, I can't pretend to know the author mind, but I suspect they did it because they could, the project itself is the objective.

[1] https://en.wikipedia.org/wiki/Expression_templates

Re: Based C++

#26

I wish all projects like these had some sort of documentation as to how they worked. All I can see is that the `-B` flag tells GCC to look in the ased directory for internal binaries (cc1plus and ld), but anything other than that would require more than the few minutes I have to look into. It's also really interesting to see the audience this is reaching. The issues on the GitHub repository are quite telling.

Open the cc1plus or ld "internal binaries" to be even more confused ;)

Re: Based C++

#27
post #13

Earlier quoted context omitted.

It doesn't have to, that is an implementation detail or OS specific feature. Two scenarios where the definition of a function in C changes, are dynamic libraries on OSes that allow reloading the same library multiple times, or self-rewriting code. Here you stay within the realms of a compiled language implementation, where what happens, is only expecified by compiler specific features, or OS capabilities handling exe…

Yes, but it suddenly matters if you execute code in an interpreter, where the user can change any symbol/function definition at anytime. What do you do with a a struct definition, that changes? Do all the functions return something different now? Or does the return type of all the functions change to an anon struct and the name now refers to something different. Stuff like that is what the distinction is between a co…

The same way you deal with them as they come from a dynamic library, and the code gets reloaded on the fly, like on game engines that use compiled C and C++ instead of whatever scripting language.

Compiled code with dynamic replacement during execution,

https://liveplusplus.tech/

https://learn.microsoft.com/en-us/visualstudio/debugger/hot-...

https://dev.epicgames.com/documentation/en-us/unreal-engine/...

Plain interpreters,

https://iel.ucdavis.edu/publication/2006/CUJ_proof.pdf

https://root.cern/

Just some examples.

Re: Based C++

#28
post #18
post #12

Earlier quoted context omitted.

You'll need this https://www.youtube.com/watch?v=cFtymODJEjs

This video doesn't explain what the project does and how it does it. Also it's deliberately misleading the viewer, for example it purposefully incorrectly states that C++ is an interpreted language. Also the music is way is too loud and sudden.

The video is a compliment to the Github repository, the presenter even shows code and brings up the repo in the video. I guess you didn't watch that part and unfortunately you didn't get the joke either.

Re: Based C++

#30
post #18
post #12

Earlier quoted context omitted.

You'll need this https://www.youtube.com/watch?v=cFtymODJEjs

This video doesn't explain what the project does and how it does it. Also it's deliberately misleading the viewer, for example it purposefully incorrectly states that C++ is an interpreted language. Also the music is way is too loud and sudden.

Well the video is almost entirely a joke and almost every sentence in it is ironically false; that's the point.
Post reply on HN