What's Zig got that C, Rust and Go don't have? [video]
youtube.com
youtube.com
Since it was published, people pointed out two mistakes I made:
1. Go has been able for a while now to export dynamic libraries. My knowledge was from before that time and I also got confused, thinking that you could not export C ABI functions at all, while in fact you can. That said, having a runtime still makes Go not a viable C replacement in the most direct sense of the expression.
2. Zig used to only support pointer arithmetic by converting the pointer to an int, applying the operation, and then converting it back to a pointer. Since a few months ago, `[*]T` (and related) started supporting arithmetic. That’s a pointer type that you don’t touch directly often, as you normally would use a slice (ptr + len).
JS is not a serious contender in the space. OCaml and Haskell fit better, but with a much different language paradigm.
Also, rust is not a backend language, it can be used for that, but that’s definitely not its main appeal.
TamaGo, used to write the firmware used in USB armory.
https://www.withsecure.com/en/solutions/innovative-security-...
TinyGo, which even has official Arduino and ARM support, and is sponsored by Google
Ah but that isn't proper Go.
Well neither is the C code that is allowed to be used in typical kernel code, almost nothing from ISO C standard library is available, and usually plenty of compiler specific language extensions are used instead.
You are the one who always mention stuff like gcj - how is that, available at Java 1.2 times, any different than Go, in a fundamental way?
What I quote are production quality compilers for embeeded space like ExcelsiorJET (also creators of Modula-2 and Oberon compilers, now out of business), PTC, Aonix (acquired by PTC), Aicas, WebSphere Real Time (AOT technology nowadays lives on OpenJ9), and microEJ.
As for the differences they aren't, that is the point, we should open our minds to use managed systems programming languages, like Xerox PARC, ETHZ and Microsoft Research did.
Rust is interesting in being the language that brought affine types into mainstream, although with a productivity cost.
As shown by Haskell, OCaml, Swift, Chapel, D, Roc, Hylo (nee Val) efforts, the best is being able to combine automatic memory management with linear/affine types for a low level language subset, with the benefit of not having to type ".clone()" all over the place.
As for Go versus Rust, definitly Rust, only because I am not a big fan of Go's language design, and love ML derived languages since Caml Light, nevertheless better Go than C.
Which ironically, the closest we got there in modern computing, in tortuous ways, is Android.
I don't think it's likely that a presentation about Zig is stealth marketing for Go. It seems more likely that the presenter, say, didn't think as many people in the audience would be familiar with Haskell, or maybe doesn't personally care for JavaScript.
It’s obviously not coming from the presenter, but it is waay too common to see Rust and Go in the same sentence, when it is just dumb in most contexts.
Which is all to say, comparing Go to Rust makes a lot of sense to me.
How many production systems use Rust as their backends? Sure, it has 3 half-baked frameworks going on for it, but it is nothing like Spring, asp.net, python’s django, RoR, etc feature wise. It is as much a backend language as haskell is, hell, I’m quite sure there are much more haskell backends buzzing somewhere, than do rust ones, and even that is insignificant.
If Go is a low-level language, is OCaml, Haskell, C# and Java also that? They all are (or have ways to) AOT-compiled to a single binary that contains their runtime as well, there are zero differences to Go. Hell, all of them have arbitrary pointer manipulation as well, even if it doesn’t have specific syntax in every case, but it is a special library call. So there is an objective distinction in how Rust or Zig fundamentally operates compared to these.
https://ocaml.github.io/ocamlunix/
"MirageOS is a library operating system that constructs unikernels for secure, high-performance network applications across a variety of cloud computing and mobile platforms."
"Docker Desktop avoids this problem by forwarding all traffic at user-level via vpnkit, a TCP/IP stack written in OCaml on top of the network protocol libraries of the MirageOS Unikernel project. The following diagram shows the flow of packets from the helper VM, through vpnkit and to the Internet:"
https://www.docker.com/blog/how-docker-desktop-networking-wo...
Just to reiterate, I'm saying your views aren't the consensus, but I genuinely don't mean that as a criticism and do think you have a point.
"In addition to native support for standard operating environments, such as Linux distributions, the USB armory is directly supported by TamaGo, an WithSecure Foundry developed framework that provides execution of unencumbered Go applications on bare metal ARM® System-on-Chip (SoC) processors."
https://www.withsecure.com/en/solutions/innovative-security-...
For instance the three languages listed in the title were organically brought up when discussing zigs cross compilation features (~14m into the video) because it still manages its cross compilation even for cgo and rust with c or c++ ffi.
Perhaps OP remembers this like I do?
I'm aware that Go has more-or-less become a language for writing webapps, but once upon a time the team had loftier goals.
I abandoned pursuing the language when these plans were dropped. My interest in working on anything web-related died around 2003 or so.
Go is always compared to Rust for some godforsaken reason.
I didn't make this claim.¹
With that being said, high(er)-levels languages can be used for OS development and the like. There's considerable work in providing the underpinnings necessary for the abstractions, but it's doable and has been done.
There are plenty of archived discussions from the nascent-Go days on this topic. Using Go in the places C is used was discussed and, given that a directory named "freestanding" exists in the source tree from that time, I'm inclined to believe it was seriously considered.
[1] Also, FWIW, C is not a low-level language. As with any other systems language, a generous amount of work has to be done in order to make its abstractions map to the computer architecture. A macro assembler is a low-level language.