Live data from Hacker News

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

github.com

131–140 of 159 posts

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

#131
i really like this project. fot me its the next level to your own custom C lib.

first your write 'tutorial C'. then after enough segfaults and double frees you start every project with a custom allocator because you've become obsessed with not having that again..., then you implement a library with a custom more generic one as you learn how to implement them, and add primitives you commonly build that lean on that allocator, it will have your refcouters, maybe ctors, dtors etc etc.. (this atleast is my learning path i guess? still have a loooong way to go as always!)

i dont see myself going for a language like this, but i think its inspirational to see where your code can evolve to with enough experience and care

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

#132

Earlier quoted context omitted.

I think you are confused by terminology here and not by behavior, "immutable variable" is a normal terminology in all languages and could be says to be distinct from constants. In Rust if you define with "let x = 1;" it's an immutable variable, and same with Kotlin "val x = 1;"

Lore and custom made "immutable variable" some kind of frequent idiomatic parlance, but it’s still an oxymoron in their general accepted isolated meanings. Neither "let" nor "val[ue]" implies constancy or vacillation in themselves without further context.

Words only have the meaning we give them, and "variable" already has this meaning from mathematics in the sense of x+1=2, x is a variable.

Euler used this terminology, it's not new fangled corruption or anything. I'm not sure it makes too much sense to argue they new languages should use a different terminology than this based on a colloquial/nontechnical interpretation of the word.

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

#133
post #119

Earlier quoted context omitted.

> Borrow checking in Rust isn't sound AFAIK, even after all these years Huh? If borrow checking in Rust is unsound, that's akin to saying Rust is utterly broken. Sounds like you've been fed FUD. If Rust was that unsound, Rust haters would flood Twitter with Rust L takes.

Not just that, it would also mean that every single Rust application is riddled with very noticeable miscompilation bugs due to the fact that Rust makes heavy use of strict aliasing rules for optimization. This isn't something that can easily be sweeped under the rug without people noticing.

I'm reading it as charitably as possible as in "Maybe some lifetime in some arcane combination is unsound." I did heard that 'static lifetime shouldn't be permitted in some cases.

The premise is too ridiculous to engage seriously. Apparently Google/AWS/MSFT/C++ engineers all missed a huge gaping hole in Rust borrow checker, something that random commenter could pick up.

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

#134

Earlier quoted context omitted.

Seriously, in the discussion happening in this thread C is clearly not a high-level language in context. I get your statement and even agree with it in certain contexts. But in a discussion where high-level languages are presumed (in context) to not have memory management, looping constructs are defined over a semantics inferred range of some given types, overloading of functions (maybe even operators), algebraic dat…

glad you bring up context in this note. i find C high level too but u are right, in a comparisson you can still say its really low level. C was coined originally as high level because the alternatives were things like assembler. a term rooted in comparisson more than anything.

Thanks, my parent’s comment is almost a thought-terminating cliche in this kind of discussion. However, Chisnall’s now classic ‘C is not a low level language’ article is one of my favorite papers on language theory and potential hardware design. A discussion about the shortcomings of viewing C as a low level language can/could be profitable, deep, and interesting; but context is king.

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

#135

Earlier quoted context omitted.

Lore and custom made "immutable variable" some kind of frequent idiomatic parlance, but it’s still an oxymoron in their general accepted isolated meanings. Neither "let" nor "val[ue]" implies constancy or vacillation in themselves without further context.

Words only have the meaning we give them, and "variable" already has this meaning from mathematics in the sense of x+1=2, x is a variable. Euler used this terminology, it's not new fangled corruption or anything. I'm not sure it makes too much sense to argue they new languages should use a different terminology than this based on a colloquial/nontechnical interpretation of the word.

I get your point on how the words meanings evolves.

Also it’s fine that anyone name things as it comes to their mind — as long as the other side get what is meant at least, I guess.

On the other it doesn’t hurt much anyone to call an oxymoron thus, or exchange in vacuous manner about terminology or its evolution.

On the specific example you give, I’m not an expert, but it seems dubious to me. In x+1=2, terms like x are called unknowns. Prove me wrong, but I would rather bet that Euler used unknown (quantitas incognita) unless he was specifically discussing variable quantities (quantitas variabilis) to describe, well, quantities that change. Probably he used also French and German equivalents, but if Euler spoke any English that’s not reflected in his publications.

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

#137
post #55

Syntax aside, how does this compare to Nim? Nim does similar, I think Crystal does as well? Not entirely sure about Crystal tbh. I guess Nim and Vala, since I believe both transpile to C, so you really get "like C" output from both.

man I haven't heard anything about Vala in ages . is it still actively developed/used? how is it?

There's a surprising number of GUI apps built using Vala, if you've used Linux long enough, there's a chance you may have used a Vala based GUI and not even known you were. It's just such a nice language, it's a shame it's not more prevalent since Gnome libraries can compile basically anywhere.

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

#138

> Mutability > By default, variables are mutable. You can enable Immutable by Default mode using a directive. > //> immutable-by-default > var x = 10; > // x = 20; // Error: x is immutable > var mut y = 10; > y = 20; // OK Wait, but this means that if I’m reading somebody’s code, I won’t know if variables are mutable or not unless I read the whole file looking for such directive. Imagine if someone even defined custo…

It would be interesting to hear the motivation for it.

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

#140
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?

C2 (http://c2lang.org) similarly compiles to C, but arguably more readable C code from what I can see. The benefits are (1) easy access to pretty much any platform with little extra work (2) significantly less long term work compared to integrating with LLVM or similar (3) if it's readable enough, it might be submitted as "C code" in working environments which mandate C.
Post reply on HN