News for hackers. Stuff that matters.
Re:Zig: a system language which prioritizes optimality, safe... by CaliforniaKarl on Sunday August 28, 2016 @09:27PM (#12379432)
I don't know. C is very close to the hardware, and it's pretty portable, too.

I'd suggest doing what some other languages do, and get yourself to the point where almost all of the code for Zig is written in Zig.

In other words, you'd first write a `microzig` that's written in C++, and microzig knows enough to make `minizig`, which knows enough to make the rest of zig. This is what Perl does, and I expect other languages do the same thing.

On the other hand, zig is supposed to be able to cross-compile really well, so maybe you can skip that: Have version 0.9.9 be the last version written in C++. Then, for version 1.0, re-write the entire toolchain in Zig, and use the 0.9.9 compiler to compile Zig 1.0. At that point you are in full dogfood mode.

Finally, since it's called Zig, I get to close with this sentence: "You have no chance to survive make your time."

Re:Zig: a system language which prioritizes optimality, safe... by dllthomas on Sunday August 28, 2016 @10:23PM (#12379598)
> C is very close to the hardware

At this point, I'd more say that the hardware does an awful lot of work trying to look like it's close to C.

Re:Zig: a system language which prioritizes optimality, safe... by bradhe on Sunday August 28, 2016 @10:40PM (#12379642)
It's an interesting phenomenon, specifically how processor companies (erm, Intel), who make "general purpose" CPUs, have clearly made trade offs to optimize for OSes that behave like UNIX or Windows varients!
Re:Zig: a system language which prioritizes optimality, safe... by dbcurtis on Sunday August 28, 2016 @11:07PM (#12379756)
Well, in fact, Intel and all the other major makers spend a huge amount of effort benchmarking important workloads. It isn't a decision to optimize for Unix or Windows, it is a decision to chase dollars. They will optimize processors for your favorite workload, too. Just demonstrate how many millions of dollars of business your workload represents, and create some sound benchmarks for it. Easy.
Re:Zig: a system language which prioritizes optimality, safe... by dman on Tuesday August 30, 2016 @03:54PM (#12393336)
Any information on how many millions before a workload becomes interesting to Intel/AMD/Nvidia?
Re:Zig: a system language which prioritizes optimality, safe... by jakub_h on Monday August 29, 2016 @08:37AM (#12381420)
Well it's certainly better than what they were doing before, trying to look like the iAPX 432 with their memory segments and all that stuff.
Re:Zig: a system language which prioritizes optimality, safe... by lohankin on Sunday August 28, 2016 @11:14PM (#12379776)
This seems to be changing. Hardware is trying to move closer to java -by adding support of GC, bounds checks, etc - something that won't help C programs as much.
Re:Zig: a system language which prioritizes optimality, safe... by Sanddancer on Sunday August 28, 2016 @11:22PM (#12379802)
Unfortunately, the C compiler devs didn't implement the bounds checking extensions of C11, etc. It would have been really nice to have a good checked C that was the standard.
Re:Zig: a system language which prioritizes optimality, safe... by pjmlp on Monday August 29, 2016 @11:17AM (#12382397)
Making it optimal is not a way to foster adoption.
Re:Zig: a system language which prioritizes optimality, safe... by dllthomas on Monday August 29, 2016 @11:54PM (#12387419)
Sounds like a great way, actually.

... I assume that you meant "optional".

Re:Zig: a system language which prioritizes optimality, safe... by pjmlp on Tuesday August 30, 2016 @03:13AM (#12388098)
Yeah, every time I post to HN via mobile, my autocorrection plays such jokes on me, when I type in a hurry.
Re:Zig: a system language which prioritizes optimality, safe... by AndyKelley on Sunday August 28, 2016 @10:35PM (#12379623)
https://github.com/andrewrk/zig/issues/89

As long as we rely on libclang and LLVM there will be a part of the compiler written in C++, and I foresee these dependencies sticking around.

Re:Zig: a system language which prioritizes optimality, safe... by tom_mellior on Monday August 29, 2016 @04:37AM (#12380743)
> C is very close to the hardware, and it's pretty portable, too.

Here you seem to be suggesting that portability is good, but then...

> zig is supposed to be able to cross-compile really well, so maybe you can skip that

... you seem to be suggesting that this project should give up its (already existing!) portability. Without saying why.

In 2016, it's not clear at all why having having a compiled language be self-hosting should be considered a worthy goal. It's just a lot of busywork instead of simply using an existing toolchain. Certainly not the right thing to do from a software engineering point of view. Certainly not the right thing to do if you want portability. Certainly not the right thing to do if you want interoperability with existing sanitizers. Certainly not the right thing to do if you want powerful optimizations.

I'd agree that the frontend should probably be bootstrapped, at some point. But the whole toolchain? Just to avoid random HN commenters throwing "every self-respecting programming language is bootstrapped" at you? Nah.

Re:Zig: a system language which prioritizes optimality, safe... by toomanybeersies on Sunday August 28, 2016 @09:51PM (#12379504)