Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
lerno
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
21 ms
·
271.
▲
by
lerno
4y ago
Variants... that's a bug in the documentation. Thanks for finding it! I agree about strings. There are basically two strings we use: the string builder and the "string data" which is any sort of slice of bytes that can be int
272.
▲
by
lerno
4y ago
It simplifies the parser somewhat, but C3 restricts the grammar somewhat from C, so it's possible to unambiguously parse it. However, for people writing tools using `fn` is much easier to parse for. Say you want to write a program that
273.
▲
by
lerno
4y ago
You shouldn't use C3 on any larger project, but it could be an option for doing gamejams (with raylib or something else with a C API). For vkDoom it's not a port to C3. What it demonstrates is instead C <=> C3 interop. I rem
274.
▲
by
lerno
4y ago
C3 doesn't have declaration of structs/unions in variable declarations. So both are equivalent and are syntax errors.
275.
▲
by
lerno
4y ago
You can't name the inner struct. So here are the options: Say that you want this from C: struct Foo { struct Bar { int x; int y; } bar; }; struct Foo f; f.bar = (struct Bar) { .x = 123
276.
▲
by
lerno
4y ago
No, you misunderstand. There is no `struct Foo foo`. Unlike C `struct Foo` would only ever be valid at the top level. Neither `struct Foo foo` nor `struct bar Bar` works. The reason why `Bar` is a type and `bar` is a variable or function is
277.
▲
by
lerno
4y ago
Interestingly removing `fn` was something I've considered more than once, but I had people ask me to keep it. Even though you can get searchability in C by adhering to certain conventions, that's not the same as being able to sear
278.
▲
by
lerno
4y ago
The first part about the name is just like C++: you use the name without `struct` unlike C where structs has its own namespace. That's what it's meant to illustrate. The second question is more subtle. In C, the syntax is `struct
279.
▲
Show HN: C3 – A C alternative that looks like C
182 points
by
lerno
4y ago
|
136 comments
280.
▲
The Development of the C Language (1993)
(bell-labs.com)
3 points
by
lerno
5y ago
|
0 comments
281.
▲
Are modules without imports “considered harmful”?
(c3.handmade.network)
59 points
by
lerno
5y ago
|
41 comments
282.
▲
by
lerno
5y ago
Getting productive easily is the pretty much the definition of not having a steep learning curve. So I have difficulties making sense of your argument.
283.
▲
by
lerno
5y ago
How does a short learning curve necessarily correlate to a "nearly empty" toolbox? That seems like a fallacy to me. Ruby is fairly easy to learn. Does that mean it has a nearly empty toolbox? No it doesn't. A language with a
284.
▲
by
lerno
5y ago
I don't mind a sane defer in C, that is something which follows scope in the same way stack allocated destructors are invoked. This follows the behaviour in other languages like Swift. Why "on function exit" style defers - al
285.
▲
by
lerno
5y ago
I believe the kernel design is inspired by the original NT design.
286.
▲
Your users will do what you make easy
(c3.handmade.network)
160 points
by
lerno
5y ago
|
108 comments
287.
▲
How to break a and b and C (PL design failures)
(c3.handmade.network)
1 points
by
lerno
5y ago
|
0 comments
288.
▲
Promotion strategies with typed literals (PL Design)
(c3.handmade.network)
2 points
by
lerno
5y ago
|
0 comments
289.
▲
The Problem with Untyped Literals
(c3.handmade.network)
1 points
by
lerno
5y ago
|
0 comments
290.
▲
by
lerno
5y ago
I feel quite the opposite - this is would be like a mistake like VLA * 100000.
291.
▲
by
lerno
5y ago
And if the idea is to extend C in some direction, that is what the language I’m working on does: C3 ( http://www.c3-lang.org )
292.
▲
by
lerno
5y ago
Well, except for Zig has the dubious distinction of actually having more UB than C.
293.
▲
by
lerno
5y ago
What I mean by saying "it's a binding" is that it is a property of the variable (or return channel of a function) rather than a real sum type. Consequently it does not participate in any type conversions and you cannot pass s
294.
▲
by
lerno
5y ago
No I'm quite aware of this. It's a restricted, implicit variant of it. But not also that it's not the type but the binding, which makes it slightly different from using a `Result`.
295.
▲
by
lerno
5y ago
I'm experimenting with a solution in C3 that has this behaviour. I don't have a sum type as such, but the binding acts as one. I call the binding a "failable". int! a = getMayError(); // a is now eith
296.
▲
by
lerno
5y ago
BTW there's a discord for people working on low level programming languages: https://discord.gg/tgmUz9cFyv Maybe you find it interesting?
297.
▲
by
lerno
5y ago
Regarding dynamic arrays. Right now it looks like I have a way to do nicely namespaced (macro based!) operator overloading for types (it was unclear whether it would be possible with the feature set or not), so with this actually being in t
298.
▲
by
lerno
5y ago
To me this says that C got a lot of things right. I've noticed that even things people complain about, like the somewhat arcane promotion rules to "int" makes perfect sense given the constraints and the expected type sizes. I
299.
▲
by
lerno
5y ago
A "module system" should be something beyond a name spacing scheme. So that's the difference. Re: strings I had a stronger idea of that initially but I wasn't sure, so I kept postponing it, and due to features I added la
300.
▲
by
lerno
5y ago
I would say C3 is closer to Odin than Zig. Given that C3 isn't done yet, I'd personally recommend using Odin over Zig. So there is a clear philosophical difference between the two. Aside of course from Zig departing from C syntax
More ›