News for hackers. Stuff that matters.
Re:Maintain It with Zig by AndyKelley on Wednesday September 08, 2021 @03:33PM (#28461930)
> Let's hope this is not vaporware.

I sincerely approve of the skepticism. I can assure you there is already a very large fire under my ass to get this shipped.

To provide some more context, here is a snippet from the latest release notes[0]:

> Having a package manager built into the Zig compiler is a long-anticipated feature. Zig 0.8.0 does not have this feature.

> If the package manager works well, people will use it, which means building Zig projects will involve compiling more lines of Zig code, which means the Zig compiler must get faster, better at incremental compilation, and better at resource management.

> Therefore, the package manager depends on finishing the Self-Hosted Compiler, since it is planned to have these improved performance characteristics, while the Bootstrap Compiler is not planned to have them.

I can't help but mention, I am incredibly excited about how well the self-hosted compiler is coming along. Progress is swift, and all the ambitious design decisions (fully incremental compilation[1], extremely fast debug builds[2], low memory usage, multi-threaded) are intact. I anticipate it to make quite a splash once it becomes generally usable.

I don't expect the package manager to take nearly as long to develop.

[0]: https://ziglang.org/download/0.8.0/release-notes.html#Packag...

[1]: https://vimeo.com/491488902

[2]: https://twitter.com/andy_kelley/status/1416485475125141504

Re:Maintain It with Zig by cs702 on Wednesday September 08, 2021 @04:07PM (#28462367)
> ...I can assure you there is already a very large fire under my ass to get this shipped ... [followed by a short, easy-to-follow explanation as to why it's taking so long]

I'm going to check out Zig because of your response.

I love coming across comments like this one on HN.

Re:Maintain It with Zig by ljm on Wednesday September 08, 2021 @05:57PM (#28463550)
Zig has been on my radar precisely because of Andrew Kelley's vision.

I wrote about cross-compiling to a raspberry-pi and writing a barebones driver for an OLED display[^1]

That was a lot of fun despite the fact the code was incredibly basic. The interop with C was effortless.

[^1] https://www.kamelasa.dev/posts/gettin-ziggy-with-it-pi-zero....

Re:Maintain It with Zig by gobookdev on Thursday September 09, 2021 @01:42AM (#28466658)
Yeah I watched a couple of his talks, enjoyed every word. There is another interesting language (won't mention the name) but the creator won't let the public in and has a superiority complex, turned me off instantly. I believe Zig will blow up just because of the strong vision but without being a dick about it. It's next on my list for sure.
Re:Maintain It with Zig by rk06 on Thursday September 09, 2021 @03:14AM (#28467150)
Ahh you mean Elm, by any chance?

I feel Elm's growth has been stunted because the creator is actively hostile with whoever disagrees with him. I remember the infamous "leaving elm" post which was handled so poorly by Elm's author.

If they had handled it well, elm would have definitely seen a large uptick in adoption

Re:Maintain It with Zig by kristoff_it on Thursday September 09, 2021 @03:40AM (#28467288)
Parent poster 99% is referring to Jai. I'm of the same general opinion: interesting language, I've spent a lot of time watching jblow talk about it on Twitch, and it would be nice if it succeeded, unfortunately I have my doubts given jblow's attitude both in terms of external communication and within the development team [0].

[0] https://www.youtube.com/watch?v=Nutcb6ao0mc&t=4508s

Re:Maintain It with Zig by earth_walker on Thursday September 09, 2021 @08:23PM (#28476353)
There really isn't any call to trash Elm and its creator like this.

There's very little evidence of ongoing hostility from Evan - I pay attention to his work and writings and find he's rarely if ever hostile. In fact he's very mild-mannered, and is painstakingly detailed about explaining the reasons for why he does things the way he does, over and over again.

Perhaps that wore thin once or twice in the face of repeated criticism and demands. We've all seen way worse.

Yes, sticking to his vision has excluded ideas and contributions, and made some people very angry. There have been several high profile blogposts and twiits painting him as some kind of despot. And when other overzealous developers swooped in to defend his work, it just fed the meme, one which people on HN like to repeat every chance they get.

Well, I for one am glad he's a 'code despot' - considering how many people keep demanding that they dilute Elm's guarantees for the sake of JS library interop or marginally less boilerplate. Any bending to these demands and Elm today would be just another framework with a slightly different syntax, with none of guarantees that allow for the innovative tooling and libraries [1] we see coming out of the community.

Whether you agree with Evan's vision or not, Elm is doing just fine meeting its stated goals and is a fantastic and delightful technology and toolchain.

So please give over with trashing other people's hard work. If you don't like it, just don't use Elm.

[1] for example, the compiler's dead code elimination capabilities, elm-review's tco detection and other amazing auto-fixes, lamdera, etc.

Re:Maintain It with Zig by rk06 on Sunday September 12, 2021 @02:45AM (#28499112)
Elm has done some great work, even the ones, who left elm for other tech, acknowledge elm's elegant design.

However, elm is not pragmatic. the issues mentioned in Luke plant's "leaving elm" [0] are valid. and Evan's response to that was far from satisfactory[1] and this has affected Elm's popularity.

The disagreement between BDFL and community has happened in many other cases as well. and there is a way to solve them amicably. Most recently, Vue faced it when community caused uproar over composition API RFC. and Vue solved it nicely and amicably[2]. If Elm has followed similar approach, Elm too would be praised for it, and gained even more popularity.

[0] https://lukeplant.me.uk/blog/posts/why-im-leaving-elm/

[1] https://www.reddit.com/r/elm/comments/g070sz/evans_response_...

[2] https://dev.to/danielelkington/vue-s-darkest-day-3fgh

Re:Maintain It with Zig by ljm on Friday September 10, 2021 @07:29AM (#28480041)
I think you're saying Evan is the BDFL (Benevolent Dictator for Life) for Elm, except it's interesting you chose the word 'despot' because many of the decisions made with Elm are far from benevolent (like preventing certain library usage and interop if the code isn't hosted on github, within the elm org).

The criticism is valid. Haskell is painfully strict and, still, it offers various ways out of its guarantees. Rust is painfully strict and gives you `unsafe`. Neither of them break your build if you don't host your code in a specific github org.

Re:Maintain It with Zig by earth_walker on Friday September 10, 2021 @06:02PM (#28487401)
I purposely avoided 'BDFL': too much precedent as to what that means!

Limiting certain kinds of js access to vetted libraries is benevolent, if that's part of the language's goals. Likewise the lack of type classes or mutability/unsafe escape hatches.

Elm's developers do not enforce constraints to be 'hostile' or 'far from benevolant'. It's a tradeoff - language power for certain guarantees, guarantees that not even Haskell can provide.

Unfortunately, this sometimes means trying to constrain access to the completely unconstrained js library ecosystem, so the solution, at least for now, is a bit of a blunt weapon.

Note that Elm doesn't 'break your build' if you don't use github - that's a constraint on linking to official libraries only. I don't use github and my code works just fine.

Re:Maintain It with Zig by gobookdev on Thursday September 09, 2021 @03:24AM (#28467189)
Nah another one, don't want to bad mouth it because I still hope the language does well. There's actually a bunch that could fit into the category.
Re:Maintain It with Zig by thechao on Wednesday September 08, 2021 @04:26PM (#28462588)
> Progress is swift ...

ahem

> Progress is zig ...

Thanks for all your work! I ported a bunch of basic data-structures from C++ to Zig very early on (right as y'all began exposing generics). Even though the code no longer compiles, still worth learning The Zig Way™.

Re:Maintain It with Zig by optymizer on Wednesday September 08, 2021 @11:52PM (#28465996)
Hi Andy, I'm really intrigued by Zig's features - you're definitely solving the right and hard problems for C developers like myself.

If I may, my only piece of feedback (as someone who looked at Zig with fresh eyes) is that the syntax has lots of special chars (@, !void, .{}, &, etc). Is there a rationale published for these and other design choices (even if it's "I like it that way"). I would have expected a language with ambitious goals like Zig to take a stab at coming up with a grammar that's even simpler and cleaner than C.

Regardless, getting a new programming language working, noticed and used is monumental effort, so I wish you best of luck with Zig!

Re:Maintain It with Zig by dnautics on Thursday September 09, 2021 @12:30AM (#28466208)
One of the things after working with zig for a bit, is that the dangerous stuff is cumbersome to write (not hard to read, though), and has lots of fiddly bits like @ signs... So your eye is drawn to it as if to say "here are the parts of the code that need careful review".

Relative to c, though there are imo fewer special chars:. Zig adds ! and ?, Which are there for really good reason, but subtracts for example <> and #.

The hardest thing is the . syntax for anonymous structs and tuples, but to be fair it is very consistent, and so many times I'd think,"hey I wonder if..." And then try it with the syntax and of course it works.

Re:Maintain It with Zig by szanni on Thursday September 09, 2021 @10:44AM (#28470238)
>If I may, my only piece of feedback (as someone who looked at Zig with fresh eyes) is that the syntax has lots of special chars (@, !void, .{}, &, etc). Is there a rationale published for these and other design choices (even if it's "I like it that way"). I would have expected a language with ambitious goals like Zig to take a stab at coming up with a grammar that's even simpler and cleaner than C.

That is sadly my gripe with a lot of the newer languages too. I have been looking for something to replace C for a long time, something that makes it easier to not shoot yourself in the foot. I just find most of them significantly less readable than C.

Rust seems to be going down the route of C++, hence I do not deem it a safe language at all, as I have an exceedingly hard time parsing the source and figuring out what is going on.

Zig is WAY better in that regard, but as OP mentions: all the special characters make things more difficult to parse. Calls like these (taken from the introduction page) contain so much visual clutter:

  try expect(@call(.{}, add, .{3, 9}) == 12);
I sadly doubt any of this is possible to change at this stage anymore. Zig definitely seems the most promising C replacement with regards to tooling, especially cross compiling and C interop are a breeze. Truly inspiring work!

The only new C-like language that really nailed it for me syntax wise would be Nim. Very clean and easy to reason about, which - from a programmer perspective - makes it exceedingly safe to program in. It just seemingly lacks most of the safety guarantees that the compilers of other, newer languages provide.

Re:Maintain It with Zig by simplify on Tuesday September 14, 2021 @08:35PM (#28533513)
Isn't the example difficult to parse only because it's unfamiliar to you? As someone who has never used zig, I feel like 5 minutes of study would make this line easy to read.
Re:Maintain It with Zig by cb321 on Thursday September 09, 2021 @02:49PM (#28473176)
You should take a closer look at Nim. I suspect it probably has all that you want, but said features may not be "by default/well advertised" (yet). Alternatively, you should be more specific about what you think it lacks.
Re:Maintain It with Zig by wizwit999 on Wednesday September 08, 2021 @10:43PM (#28465622)
Please make sure you include private repositories in the design from the start.
Re:Maintain It with Zig by gravypod on Wednesday September 08, 2021 @05:30PM (#28463302)
Will the compiler have something like go's ability to vendor code locally? I've worked on some science projects and this has been a hard requirement on some systems for tape archive storage.
Re:Maintain It with Zig by nrr on Wednesday September 08, 2021 @08:15PM (#28464643)
Zig's build system has a first-class notion of packages that satisfies exactly this requirement. The Ziglearn documentation[0] has more details.

To make things a little more interesting though, Zig's shape in this regard should be roughly congruent to C's, so you should be able to do anything with Zig that you can with C. This includes linking against shared objects for C libraries like, e.g., SDL2[1] or building mixed-language Zig+C projects[2].

0: https://ziglearn.org/chapter-3/#packages 1: https://dev.to/fabioarnold/setup-zig-for-gamedev-2bmf 2: https://tiehu.is/blog/zig1

Re:Maintain It with Zig by pryelluw on Wednesday September 08, 2021 @05:33PM (#28463340)
How can I help?
Re:Maintain It with Zig by pryelluw on Wednesday September 08, 2021 @08:45PM (#28464886)
There’s this helpful guide:

https://github.com/ziglang/zig/blob/master/CONTRIBUTING.md

Though I’m interested in hearing from the creator itself as well.

Re:Maintain It with Zig by zamadatix on Wednesday September 08, 2021 @05:09PM (#28463100)
After self hosted compiler and package manager what are the big ticket items blocking 1.0 (other than fixes for a lot of the stuff that is broken)?
Re:Maintain It with Zig by lhorie on Wednesday September 08, 2021 @07:05PM (#28464165)
IIRC nailing down stdlib and its documentation was a big one
Re:Maintain It with Zig by randyrand on Thursday September 09, 2021 @03:36AM (#28467261)
With the self hosted compiler, is there a plan to provably determine the binary remains free from viruses?

How will you verify the chain of trust?