Show HN: The C3 programming language (C alternative language)
91–100 of 192 posts
Re: Show HN: The C3 programming language (C alternative language)
#92Earlier quoted context omitted.
I prefer lack of "fun" and "fn", to me it is easier to parse C-style. :( This is one of the things (albeit minor) that put me off of C alternatives, I like to keep things as simple as possible, but I understand it has "macro" as well, so might as well have "fn", for the reasons already mentioned. That said, I will still try C3.
Also, `fn` is used to make type inference for lambdas syntactically simple. But I would lie if I said I haven’t been considering removing `fn` many times. But there are good reasons for keeping it, despite the break with C.
Re: Show HN: The C3 programming language (C alternative language)
#93Earlier quoted context omitted.
So which language do you use then? I've never seen a language that doesn't have bad things to say about other languages. Zig bdfl himself accused vlang of committing fraud a while back. Every language designer takes things they like about some languages and leaves things they don't like.
> Zig bdfl himself accused vlang of committing fraud a while back. That was truly foul. On top of that, begged readers to give their money to Zig. Clearly some have no limits on what to say and do against other languages or to sell their language. That's why whatever bad things a creator or evangelist says about another language, people shouldn't just swallow, and instead take with a grain of salt and some skepticism…
Is it because, as the leader of a language, he shouldn't be making "attacks" against other languages? Because, as far as V being a fraud, he was 100% correct.
Re: Show HN: The C3 programming language (C alternative language)
#94Any other C alternative or C-like languages that people here are using more than experimentally? Asking because my above question and this current post about C3 are related to this recent post by me, which had a good number of comments: Ask HN: What less-popular systems programming language are you using? https://news.ycombinator.com/item?id=43223162
Other than C3, there is Jai, Odin, Zig and Hare which are the ones that have any traction right now that I know of. Many interesting projects have been started but ultimately later abandoned. Going to C++ competitors there is obviously Rust, but also Nim, Crystal, Beef and a lot of others. (And Jai is a C++ competitor too)
Re: Show HN: The C3 programming language (C alternative language)
#95Earlier quoted context omitted.
Ah. The top-level lang description claims “No preprocessor”, but my definition of that word doesn’t appear to be the same as yours :/
The difference here is that a preprocessor runs before parsing and semantic analysis. In C3 compile time if runs in the analysis step, so after parsing. So the macros and compile time execution occurs after parsing in C3, but in C everything happens at lexing, before the code is parsed.
Re: Show HN: The C3 programming language (C alternative language)
#96Earlier quoted context omitted.
The difference here is that a preprocessor runs before parsing and semantic analysis. In C3 compile time if runs in the analysis step, so after parsing. So the macros and compile time execution occurs after parsing in C3, but in C everything happens at lexing, before the code is parsed.
That strategy will backfire when the grammar changes in a later release. A pre-parse step is necessary for code that targets different compiler releases.
Re: Show HN: The C3 programming language (C alternative language)
#97Earlier quoted context omitted.
Also, `fn` is used to make type inference for lambdas syntactically simple. But I would lie if I said I haven’t been considering removing `fn` many times. But there are good reasons for keeping it, despite the break with C.
Do you think it is ever going to be removed, or do the pros of having it outweigh the cons?
For example, let's say that for some reason macros were removed (this is very unlikely to happen, but as a thought experiment), then the symmetry between macro/fn definitions wouldn't be an argument anymore, and the question could be revisited.
Similar things have happened before: the optional type syntax changed from `int!` to the more mainstream `int?`. So why did I stick with `int!` for so long? Because initially it was called a "failable" and had different semantics. Revisiting this syntax after other changes to the syntax in 0.6.0, made it clear that `int?` was now fine to use.
So that's why I don't say never. But it would need for the situation to change in some way.
Re: Show HN: The C3 programming language (C alternative language)
#98Any other C alternative or C-like languages that people here are using more than experimentally? Asking because my above question and this current post about C3 are related to this recent post by me, which had a good number of comments: Ask HN: What less-popular systems programming language are you using? https://news.ycombinator.com/item?id=43223162
Other than C3, there is Jai, Odin, Zig and Hare which are the ones that have any traction right now that I know of. Many interesting projects have been started but ultimately later abandoned. Going to C++ competitors there is obviously Rust, but also Nim, Crystal, Beef and a lot of others. (And Jai is a C++ competitor too)
This is maybe more striking when comparing against C which was already very old and battle tested in 1989 when it was standardized. If you pick any of these languages you're accepting an unknowable amount of churn. It better be worth it.
Re: Show HN: The C3 programming language (C alternative language)
#99Earlier quoted context omitted.
`::` simplifies the module vs identifier resolution. In C3 there is something called "path shortening", allowing you to use `foo::bar()` in place of something like `std::baz::foo::bar()`. To do something similar with `.` is problematic, because you don't know where the path ends. Is `foo.baz.bar()` referring to `foo::baz::bar()` or `foo::baz.bar()` or `foo.baz.bar()`?
Sure, but in practice I believe most developers would find it intuitive to just type . everywhere. It feels more lightweight and consistent, and collisions aren’t super common once you adopt some conventions. It’s a tradeoff for sure, but this preference comes from having lived in both worlds.
Yeah, but in practice I try not to produce write-only code.
Code is for reading more than for writing, hence make it easier to read. If it becomes easier to write as a side-effect, then so be it.
Re: Show HN: The C3 programming language (C alternative language)
#100One thing I just can't understand is proactively using the :: syntax. It's sooo ugly with so much unnecessary line noise. Just use a single period! I think one of the best decisions D made was to get of -> and :: and just use . for everything.
I like to quickly at a glance be able to distinguish between "this is a member access on an object" and "this is referencing something in a module". I like that the compiler can distinguish those two things too, so that I can refer to things within modules even if I happen to also have a local variable with the same name. Go sometimes annoys me because I need to rename a module or a variable just because the syntax d…
zig: what's the difference?