Live data from Hacker News

Aro – Zig's new C compiler

github.com

91–100 of 130 posts

Re: Aro – Zig's new C compiler

#91
post #84

I hope Zig adds complex numbers before it is too late. It's a pity that they did not steal array syntax and slices from Fortran/Numpy.

Why would complex numbers in particular deserve to be a native type?

What about quaternions, or vectors and matrices of sizes 2-4 at least?

Is there any real advantage over just using a struct?

Would MultiArrayList help with performance for complex numbers and vectors?

Re: Aro – Zig's new C compiler

#92
post #43

Earlier quoted context omitted.

It appears to me it could become the low level language of choice for small embedded systems in contexts where Lua or MicroPython couldn't fit the bill performance-wise and one wants something higher level than C. Ditto for Nim and Crystal.

It’s constraints on memory management basically will never allow that to happen. It lures people in with “use any allocator you want”! Which only appears as freedom of choice when reality it’s locking the user into the same paradigm of memory management that has given C a bad name to begin with.

On embedded systems you probably shouldn’t allocate at all.

Re: Aro – Zig's new C compiler

#93
post #91
post #84

I hope Zig adds complex numbers before it is too late. It's a pity that they did not steal array syntax and slices from Fortran/Numpy.

Why would complex numbers in particular deserve to be a native type? What about quaternions, or vectors and matrices of sizes 2-4 at least? Is there any real advantage over just using a struct? Would MultiArrayList help with performance for complex numbers and vectors?

Zig doesn't (and never will) have operator overloading, so using any user-defined numeric types is awkward. It also already has vector types.

Re: Aro – Zig's new C compiler

#94
post #73

One of the features missing in bun:ffi is inferring types for symbols from header files. This would let you import C libraries in JavaScript/TypeScript directly, without having to configure bindings. We embed TinyCC for FFI, but TinyCC doesn't expose a way to read the types for exported symbols. Currently, it looks like this: import { dlopen, FFIType, suffix } from "bun:ffi"; // `suffix` is either "dylib", "so", or "…

With D it is: import sqlite3; This causes sqlite3.h to be read, lexed, parsed, and semantically analyzed to convert (where possible) C symbols to D symbols, and makes them available to the importer. I've been sometimes pressured to instead use various more complicated syntaxes, but have held the line :-)

What i like to use is to isolate the imports from C, since they usually come with other definitions wich might clash (already defined error thingy):

    import c = sqlite3;
On that topic, i wish it was possible to group named imports, perhaps this way:

    import c = sqlite3, miniz;

Re: Aro – Zig's new C compiler

#95
post #51

Wait, so you still need zig, and zig still needs LLVM. If you have LLVM, you have clang. What is the value proposition of this compiler, then?

clang (just the C frontend, not talking about the backend, not clang++) is an old code base. It's become very complicated to understand, maintain and extend.

Zig helps a lot, but in comparison, Aro is small, and simple to understand and maintain.

Re: Aro – Zig's new C compiler

#97
post #84

I hope Zig adds complex numbers before it is too late. It's a pity that they did not steal array syntax and slices from Fortran/Numpy.

I'm curious, what use cases do you have for complex numbers that couldn't be provided in a 3rd party library or maybe even the stdlib?

You are essentially necromancing the ISO C99 discussion that happened already. Here is an answer that, after 25 years, is still wrong https://learn.microsoft.com/en-us/cpp/c-runtime-library/comp...

Re: Aro – Zig's new C compiler

#98
post #72

Earlier quoted context omitted.

Let me just say, your comments have not been the most constructive I’ve read.

Sure, I will let you say it :) Let me say that I think the same about this comment of yours upthread: >>D would deserve attention too, in a separate post, or here if it was explained how it relates to Aro. In case you cannot or don't want to google for some reason, here are the Wikipedia articles about D, Walter and Andrei, and important related topics (all on Wikipedia, which implies notability) that I suggested you…

Sorry, but what does this have to do with Aro?

Re: Aro – Zig's new C compiler

#99
post #91
post #84

I hope Zig adds complex numbers before it is too late. It's a pity that they did not steal array syntax and slices from Fortran/Numpy.

Why would complex numbers in particular deserve to be a native type? What about quaternions, or vectors and matrices of sizes 2-4 at least? Is there any real advantage over just using a struct? Would MultiArrayList help with performance for complex numbers and vectors?

I don’t think it’s more complicated than people want an abstraction for the complex number instructions you find on processors like the TMS320 series or Qualcomm Hexagon.

Re: Aro – Zig's new C compiler

#100
post #91
post #84

I hope Zig adds complex numbers before it is too late. It's a pity that they did not steal array syntax and slices from Fortran/Numpy.

Why would complex numbers in particular deserve to be a native type? What about quaternions, or vectors and matrices of sizes 2-4 at least? Is there any real advantage over just using a struct? Would MultiArrayList help with performance for complex numbers and vectors?

[deleted]
Post reply on HN