News for hackers. Stuff that matters.
Re:What Makes the Zig Programming Language Unique? by ghoward on Thursday October 06, 2022 @12:59AM (#33104548)
That seems true.

However, I think that if an interpreter does the execution, the interpreter can check every "instruction" that is executed. If every instruction is checked, how could that be evaded?

Honest question because I can't see how, and I need to.

The context for this is an interpreter that doesn't allow direct syscalls; only syscalls through the interpreter.

It seems even D has that because dynamic allocation could call `mmap()`, and you mentioned that D allows comptime dynamic allocation. So I'm confused.

Re:What Makes the Zig Programming Language Unique? by WalterBright on Thursday October 06, 2022 @02:51AM (#33105226)
Jai allows arbitrary syscalls at compile time, AFAIK.
Re:What Makes the Zig Programming Language Unique? by tialaramex on Thursday October 06, 2022 @07:10AM (#33106798)
Yes, the "classic" Jai example from early in development compiles a program which IIRC just prints out your score like "You got 10 points" every time you run it - but during compilation it finds the score by playing a video game, live, so if you want that program to say "You got 100 points" you need to score 100 points during compilation, once you "die" in the game your compilation finishes.

Whether this is desirable is dubious. But fundamentally it's not any more dangerous than Mara's nightly_crimes! Rust proc macro (which during compilation replaces your running compiler with a compiler that believes it is compiling the standard library and thus allows non-stable "nightly" features even though you aren't running a nightly build, then casually alters the compiler output to say that this was fine and there's nothing to worry about), or any number of other tricks which result from being powerful enough at compile time.

I doubt that D is as powerful as people would want and yet manages to ensure this can't happen. There are Rust people thinking about WASM sandboxing for this, but it's tricky.

Re:What Makes the Zig Programming Language Unique? by ghoward on Thursday October 06, 2022 @01:51PM (#33111554)
I believe you. However, I'm not sure how opening up my build system a little more the D would open the floodgates of people evading the sandbox.
Re:What Makes the Zig Programming Language Unique? by p0nce on Thursday October 06, 2022 @07:21AM (#33106866)
> D allows comptime dynamic allocation. So I'm confused.

with the GC, which is safe