Live data from Hacker News

Zen-C: Write like a high-level language, run like C

github.com

21–30 of 159 posts

Re: Zen-C: Write like a high-level language, run like C

#21
So, the point of this language is to be able to write code with high productivity, but with the benefit of compiling it to a low level language? Overall it seems like the language repeats what ZIG does, including the C ABI support, manual memory management with additional ergonomics, comptime feature. The biggest difference that comes to mind quickly is that the creator of Zen-C states that it can allow for the productivity of a high level language.

Re: Zen-C: Write like a high-level language, run like C

#23

Earlier quoted context omitted.

It seems to just be Rust for people who are allergic to using Rust. It looks like a fun project, but I'm not sure what this adds to the point where people would actually use it over C or just going to Rust.

> what this adds I guess the point is what is subtracts, instead - answer being the borrow-checker.

> answer being the borrow-checker

There is an entire world in Rust where you never have to touch the borrow-checker or lifetimes at all. You can just clone or move everything, or put everything in an Arc (which is what most other languages are doing anyway). It's very easy to not fight the compiler if you don't want to.

Maybe the real fix for Rust (for people that don't want to care), is just a compiler mode where everything is Arc-by-default?

Re: Zen-C: Write like a high-level language, run like C

#24
post #14

An interesting bit to me is that it compiles to (apparently) readable C, I'm not sure how one would use that to their advantage I am not too familiar with C - is the idea that it's easier to incrementally have some parts of your codebase in this language, with other parts being in regular C?

i think so. The biggest hurdle with new languages is that you are cut off from a 3rdparty library ecosystem. Being compatible with C 3rd party libraries is a big win.

Re: Zen-C: Write like a high-level language, run like C

#25
post #21

So, the point of this language is to be able to write code with high productivity, but with the benefit of compiling it to a low level language? Overall it seems like the language repeats what ZIG does, including the C ABI support, manual memory management with additional ergonomics, comptime feature. The biggest difference that comes to mind quickly is that the creator of Zen-C states that it can allow for the produ…

Nim is a high-level language as well and compiles to C.

Re: Zen-C: Write like a high-level language, run like C

#27
That's a very nice project.

List of remarks:

> var ints: int[5] = {1, 2, 3, 4, 5};

> var zeros: [int; 5]; // Zero-initialized

The zero initialized array is not intuitive IMO.

> // Bitfields

If it's deterministically packed.

> Tagged unions

Same, is the memory layout deterministic (and optimized)?

> 2 | 3 => print("Two or Three")

Any reason not to use "2 || 3"?

> Traits

What if I want to remove or override the "trait Drawing for Circle" because the original implementation doesn't fit my constraints? As long as traits are not required to be in a totally different module than the struct I will likely never welcome them in a programming language.

Re: Zen-C: Write like a high-level language, run like C

#29
post #5

Initial commit was 24h ago, 363 stars, 20 forks already. Man, this goes fast.

Could be bots.

It’s not, it’s just how hackernews works. You’ll see new projects hit 1k-10k stars in a matter of a day. You can have the best project, best article to you but if everyone else doesn’t think so it’ll always be at the bottom. Some luck involved too. Bots upvoting a post not organically I doubt is gonna live long on first page.

Re: Zen-C: Write like a high-level language, run like C

#30
post #20

Why not compile to rust or assembly? C seems like an odd choice. In fact why not simply write rust to begin with?

[flagged]

> C is the patrician's choice.

Is this suppose to be a positive thing? I thought we all wanted to violently murder the patricians.

Regardless, C might be a valid IR. I apologize for being bigoted.

Post reply on HN