News for hackers. Stuff that matters.
Re:Show HN: C3 – A C alternative that looks like C by mhd on Tuesday July 20, 2021 @06:13AM (#27891890)
So, Objective-C #import plus some linting rules and minor syntax adjustments? I somehow doubt that this would be worth the change (especially if you have to "extern" stuff like a C++ programmer). People can live with all kinds of minor annoyances but tend to switch mostly for bigger changes.

But hey, hope that something interesting grows out of this. I quite like almost-C languages, but then again I also liked the Bourne Shell macros ;)

One of these days I have to write a Oberon-in-sheeps-brackets.

For an interesting "C++ that doesn't look like C" variant, consider SPECS (Conway/Werther;1996)[1].

[1]: https://users.monash.edu/~damian/papers/HTML/ModestProposal....

Re:Show HN: C3 – A C alternative that looks like C by lerno on Tuesday July 20, 2021 @11:09AM (#27894707)
No, that's probably not a good description. I'm not saying you will appreciate the language, but it is basically C.

- "Failables" (which is somewhat like Result) offers an alternative to error handling which mostly mirrors how one commonly does it in C, but with conveniences. Since it works a bit different from all other error systems, I'd have to point to the docs for a summary. :(

- Semantic macros where the big win is that they are easier to read and write. (This is heavily inspired by the ASTEC macro system for C)

- Generic modules, which works similar to macro-based generics in C, but easier to read and work with.

- Subarrays (slices), yes they make a huge difference even though they're an obvious addition.

- A bunch of GCC extensions

- Optional design by contract

There are no objects, and certainly no dynamic OO system. There are no constructors and destructors or similar explicit code.

Calling C is straightforward, you just need to declare that it exists, like you would in C.

So `extern func int printf(char*, ...)` -> now you can do `printf("Hello %s\n", "World");` the opposite also works, so if you define a function `func void foo() @extname("c3_foo")` you can then call it from C as `c3_foo()` (or skip the `@extname` but you would have to call `my_module_foo()` instead due to namespacing.

Re:Show HN: C3 – A C alternative that looks like C by guerrilla on Tuesday July 20, 2021 @08:09AM (#27892758)
No, the list of features is

    No mandatory header files
    New semantic macro system
    Module based name spacing
    Subarrays (slices) and dynamic arrays built in
    Compile time reflection
    Enhanced compile time execution
    Generics based on generic modules
    "Result"-based zero overhead error handling
    Defer
    Value methods
    Associated enum data
    Built in strings
    No preprocessor
    Undefined behaviour trapped on debug by default
    Optional pre and post conditions
Associated enum data sounds like variant types. It has namespacing and it has generics. That alone is almost worth it to me (not that I'd use a language with no community.) If it had lambdas, that'd be the quadrivium for me.

Apparently it has struct subtyping too.