News for hackers. Stuff that matters.
Re:Maintain It with Zig by nrclark on Wednesday September 08, 2021 @01:13PM (#28460092)
I think that's correct with some overlap, yes. Zig's explicit goal - as stated by the creator - is to replace C. Nothing more, nothing less.

I feel like Rust wants to replace C but it also wants to replace C++. And given the complexity difference between the two languages, that means that Rust will end up closer to C++ than to C.

So there's some overlap based on how Rust positions itself, but not based on how Zig positions itself.

Re:Maintain It with Zig by masklinn on Wednesday September 08, 2021 @01:34PM (#28460399)
> I feel like Rust wants to replace C but it also wants to replace C++.

Rust wants to make systems programming memory safe (and type safe while at it). It's not really about any specific language, it's about dragging the field forwards on the safety front.

Well it's not really Rust, it's the Rust community, which kinda wrestled it away from Graydon Hoare: the original inception of Rust was more of an applications language (what with the evented model and the split stack and the planned-though-never-really-implemented GC'd pointers) — which explains part of the historical confusion with / comparison to Go.

But then a critical mass of people took a look at this early rust and figured "we've got plenty of memory-safe and type-safe (ish) languages for applications, but this thing has precise control over memory and lifetimes and shit, we could actually build reliable infrastructure with that", and it coincided with a lot of memory safety issues news (which has been continuing ever since), and the rest is history, pretty much.

Re:Maintain It with Zig by AndyKelley on Wednesday September 08, 2021 @03:24PM (#28461846)
You can find Zig's explicit goal as stated by the creator on the homepage:

> Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.

Re:Maintain It with Zig by nrclark on Thursday September 09, 2021 @02:27AM (#28466920)
Touche! I heard you on Corecursive, which is where I got that from.

Keep up the good work, I'm excited to see where Zig goes next.

Re:Maintain It with Zig by dnautics on Thursday September 09, 2021 @12:40AM (#28466265)
I believe the creator is on record on some youtube video or something stating that the intent is to replace C.
Re:Maintain It with Zig by skywal_l on Thursday September 09, 2021 @01:21AM (#28466531)
The guy you are responding to IS the creator of the language.
Re:Maintain It with Zig by dnautics on Thursday September 09, 2021 @10:08AM (#28469858)
yes, I'm aware, and he's aware of who I am too =D
Re:Maintain It with Zig by abledon on Wednesday September 08, 2021 @02:54PM (#28461518)
We already have c/c++ as low level bases, now zig/rust are coming for the throne, I really hope contenders dont keep spawning like rabbits. If everyone got behind a smaller # of initiatives the worlds codebase would be simpler going forward?

I'm imaging some poor software engineer in 2065, having to maintain an enterprise legacy stack... levels of FORTRAN/COBOL->C->C++->ZIG->RUST->PERL->PYTHON.... all the way up....JS..etc..

Re:Maintain It with Zig by roca on Wednesday September 08, 2021 @10:59PM (#28465729)
I don't want contenders to spawn like rabbits. I want the industry to coalesce around just a few contenders to maximise network effects so as to kill off C and C++ more effectively.
Re:Maintain It with Zig by IggleSniggle on Wednesday September 08, 2021 @09:53PM (#28465322)
While I would absolutely love to have that job, I’m afraid I’ll never get to do it. Language cross-compilers seem to keep getting better. It may be that case that one day, you will run a legacy program through a babelfish and get something understandable to you back out.

Of course, the complexity might explode from there…or you might just not really notice it all that often. Anybody familiar with LLVM or WASM or heck even a language that can transpile to JavaScript can probably relate to this possibility.

The thing that’s harder to fathom is going from low-level to high-level. High-level -> intermediary low-level -> high-level is fathomable though.

Re:Maintain It with Zig by flohofwoe on Thursday September 09, 2021 @04:56AM (#28467715)
> I really hope contenders dont keep spawning like rabbits

I do, because that would mean that more attention must be paid to make languages work together, instead of each language ecosystem becoming its own little island. Maintaining a project built from a dozen languages (where each language does one thing well) should be just as simple as maintaining a mono-language project.

Re:Maintain It with Zig by kaibee on Wednesday September 08, 2021 @03:23PM (#28461836)
> I'm imaging some poor software engineer in 2065, having to maintain an enterprise legacy stack... levels of FORTRAN/COBOL->C->C++->ZIG->RUST->PERL->PYTHON.... all the way up....JS..etc..

I have good news and bad news: That programmer will not know any of those languages, as they will just program in English and GPT-3000 will convert it into code.

Re:Maintain It with Zig by PaulDavisThe1st on Wednesday September 08, 2021 @04:35PM (#28462696)
The reason that we have programming languages at all is that English and all other natural languages are too ambiguous to be used for this purpose.

GPT-3000 will have no problem understanding some interpretation of your English (or Spanish or Mandarin) "program", but will it be the right one? How long will it take to get GPT-3000 to understand what you mean when you can only talk to it in English (or Spanish or Mandarin) ?

Re:Maintain It with Zig by AnIdiotOnTheNet on Wednesday September 08, 2021 @05:59PM (#28463576)
Eventually maybe only the same amount of time it takes the average programmer to understand your meaning.
Re:Maintain It with Zig by chubot on Wednesday September 08, 2021 @07:40PM (#28464398)
So like months and years? On every project I’ve worked on, the programmers conception of the requirements evolves until the minute they stop working on it. And they only understand the part they worked on, not the whole thing
Re:Maintain It with Zig by PaulDavisThe1st on Wednesday September 08, 2021 @07:48PM (#28464460)
The discussion is not about understanding "requirements".

A piece of software is a set of instructions that tell a computer how to do something. We use languages like C, Python, Haskell and Lisp to describe what to do in ways that avoid as much ambiguity as possible.

The question is: if you used a natural (human) language, how much confusion would (a) the putative GPT-3000 (b) another programmer (c) a compiler/interpreter incur when trying to understand your instructions?

Re:Maintain It with Zig by PaulDavisThe1st on Wednesday September 08, 2021 @07:50PM (#28464476)
That might be true. But the comparison is not with another programmer. Rather, it's with the essentially instantaneous understanding that a compiler/interpreter has when you feed in a programming language.
Re:Maintain It with Zig by flohofwoe on Thursday September 09, 2021 @05:09AM (#28467784)
This has been attempted many times in the last century but never happened, I think it's quite safe to say that this also won't happen in the next century.
Re:Maintain It with Zig by jhoechtl on Wednesday September 08, 2021 @01:39PM (#28460460)
> Zig's explicit goal - as stated by the creator - is to replace C. Nothing more, nothing less.

The ZIG compiler requires a C compiler to compile to a native executable though.

Re:Maintain It with Zig by Twisol on Wednesday September 08, 2021 @01:44PM (#28460552)
To be fair, the C compiler also requires a C compiler. Bootstrapping is a common milestone in language development (Rust can bootstrap itself too), so while the current state of affairs for Zig might require a C compiler, that's not necessarily written in stone.
Re:Maintain It with Zig by wyldfire on Wednesday September 08, 2021 @01:49PM (#28460626)
> The ZIG compiler requires a C compiler to compile to a native executable though.

Do you mean compiling the zig compiler or zig programs?

I think neither is quite the case. zig itself can build both Zig programs and C/C++ ones. Zig doesn't need to use a C compiler to build native Zig executables. It does need a linker, as does Rust, as do C/C++ programs and AFAIK zld is not yet ready.

However it's accurate to say that it's only able to compile the C/C++ code by leveraging libclang, the C/C++ compiler underneath.

Re:Maintain It with Zig by AndyKelley on Wednesday September 08, 2021 @03:49PM (#28462134)
Here's the info on zld status: https://ziglang.org/download/0.8.0/release-notes.html#Self-H...

By the way, check out this project by Zig core team member, Vexu: https://github.com/Vexu/arocc

Re:Maintain It with Zig by messe on Wednesday September 08, 2021 @02:42PM (#28461364)
> The ZIG compiler requires a C compiler to compile to a native executable though.

No it doesn't? Not unless you want to also compile C, which the Zig compiler is capable of doing because it bundles clang.