Live data from Hacker News

The C3 Programming Language

c3-lang.org

31–40 of 270 posts

Re: The C3 Programming Language

#32

I keep thinking about perhaps LLMs would make writing code in these lower-level-but-far-better-performing languages in vogue. Why have claude generate a python service when you could write a rust or C3 service with compiler doing a lot of heavy lifting around memory bugs?

It seems cynically fitting that the future we're getting and deserve is one where we've automated the creation of memory bugs with AI.

Re: The C3 Programming Language

#33

This looks like Zig. What problems does this solve that Zig doesn't? Potato - potaato?

C3 is more comparable to Odin or the Better C mode in D in that it tries to be a pragmatic evolution not revolution of C.

Here is a comparison to Zig in terms of features: https://c3-lang.org/faq/compare-languages/#zig

And yes, they are all system programming languages with a similar level of abstraction that are suited for similar problem. It is good to have choice. It is like asking what do you need Ruby for when you have Python.

Re: The C3 Programming Language

#34

Earlier quoted context omitted.

NOTE: I'm a fan of value semantics, mostly devil's advocate here. Those implicit copies have downsides that make them a bad fit for various reasons. Swift doesn't enforce value semantics, but most types in the standard library do follow them (even dictionaries and such), and those types go out of their way to use copy-on-write to try and avoid unnecessary copying as much as possible. Even with that optimization there…

And so the size of your data structures matters. I'm processing lots of data frames, but each represents a few dozen kilobytes and, in the worst case, a large composite of data might add up to a couple dozen megabytes. It's running on a server with tons processing and memory to spare. I could force my worst case copying scenario in parallel on each core, and our bottleneck would still be the database hits before it a…

It's not just the size of the data but also the amount of copies. Consider a huge tree structure: even if each node is small, doing individual "malloc-style" allocations for millions of nodes would cause a huge performance hit.

Obviously for your use case it's not a problem but other use cases are a different story. Games in particular are very sensitive to performance spikes. Even a naive tracing GC would do better than hitting such an implicit copy every few frames.

Re: The C3 Programming Language

#35
Just browsed the doc to get the answers to two burning questions, which I will dump here in case it saves some time to others:

  - uses LLVM (so: as portable as LLVM)
  - sadly, does not support tagged enums
Apart from that it adds a few very desirable things, such as introspection and macros.

Re: The C3 Programming Language

#37

We have solved the better C issue, but nobody seems keen on solving the better compiler issue Why do we still have to recompile the whole program everytime we make a change, the only project i am aware of who wants to tackle this is Zig with binary patching, and that's imo where we should focus our effort on.. C3 does look interesting tho, the idea of ABI compatibility with C is pretty ingenious, you get to tap into…

> Why do we still have to recompile the whole program everytime we make a change

That problem was solved decades ago via object files and linkers. Zig needs a different approach because its language features depend on compiling the entire source code as a single compilation unit, but I don't think that C3 has that same "restriction" (not sure though).

Re: The C3 Programming Language

#38
post #24

I think the switch statement design is a foot gun: defaults to fall-through when empty and break when there is a body. https://c3-lang.org/language-overview/examples/#enum-and-swi...

This feels very natural though, in a "principle of least surprise" kinda way. This is what you'd expect a properly designed switch statement to do.

Re: The C3 Programming Language

#40
post #39

Honestly if your programming language does not compile to wasm I don't care for it. That's my new rule.

> We do want WASM to be working really well, so if you’re interested in writing something in WASM please reach out to the C3 development team and we’ll help you get things working.
Post reply on HN