Live data from Hacker News

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

github.com

111–120 of 159 posts

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

#111
post #101

Earlier quoted context omitted.

Mutability is distinct from variability. In Javascript only because it's a pretty widely known syntax: const f = (x) => { const y = x + 1; return y + 1; } y is an immutable variable. In f(3), y is 4, and in f(7), y is 8. I've only glanced at this Zen-C thing but I presume it's the same story.

"immutable variable" is an oxymoron. Just because Javascript did it does not mean every new language has to do it the same way.

“Immutable” and “variable” generally refers to two different aspects of a variable’s lifetime, and they’re compatible with each other.

In a function f(x), x is a variable because each time f is invoked, a different value can be provided for x. But that variable can be immutable within the body of the function. That’s what’s usually being referred to by “immutable variable”.

This terminology is used across many different languages, and has nothing to do with Javascript specifically. For example, it’s common to describe pure functional languages by saying something like “all variables are immutable” (https://wiki.haskell.org/A_brief_introduction_to_Haskell).

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

#114

Earlier quoted context omitted.

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.

That's not how it works. My publication with (subjectively) better language barely had a couple of comments and github stars.

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

#116

> 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…

Yes, sadly, the one billion dollar mistake… I don’t know why the author took this path. it’s so confusing and immediately raised an issue: https://github.com/z-libs/Zen-C/issues/19 And of course, confusion: https://github.com/z-libs/Zen-C/pull/13#issuecomment-3739722... Life is already hard, but apparently not for developers, as I see

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

#117
post #101

Earlier quoted context omitted.

Mutability is distinct from variability. In Javascript only because it's a pretty widely known syntax: const f = (x) => { const y = x + 1; return y + 1; } y is an immutable variable. In f(3), y is 4, and in f(7), y is 8. I've only glanced at this Zen-C thing but I presume it's the same story.

"immutable variable" is an oxymoron. Just because Javascript did it does not mean every new language has to do it the same way.

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;"

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

#119
post #95
post #17

Earlier quoted context omitted.

So it re-adds manual lifetime checking. Got it.

It might or might not be a toy project, I'm not sure, but one advantage of subtracting the borrow checking is that the compiler avoids a lot of complex machinery. Borrow checking in Rust isn't sound AFAIK, even after all these years, so some of the problems with designing and implementing lifetimes, region checking, and borrow checking algorithms, aren't trivial.

> 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.

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

#120

> 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…

[dead]
Post reply on HN