Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
lerno
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
24 ms
·
301.
▲
by
lerno
5y ago
I deliberately removed the "static" methods, so that above would not be allowed. Why I found that to be a good idea is a longer discussion. The main motivation why it is nice to have it this way is that it's straightforward t
302.
▲
by
lerno
5y ago
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 mirro
303.
▲
by
lerno
5y ago
Some things are hard to get rid of due to LLVM, but I'm doing my best to reduce them.
304.
▲
by
lerno
5y ago
- Format strings, are you thinking about string interpolation or? - A module isn't a file in C3 but that's a deep subject to get into. - Automatic C header file import is something Zig is also touting as a feature. This was someth
305.
▲
by
lerno
5y ago
`ptr = array` vs `ptr = &array` (no [0] needed) is also part of being able to capture array sizes during compile time for macros, and also being able to copy arrays by value in an easy way. I don't think there would have been a way
306.
▲
by
lerno
5y ago
For the docs, have a look here: http://www.c3-lang.org With a primer for C programmers: http://www.c3-lang.org/primer/ It should compile fine on MacOS and Linux. There is CI for Windows but the readme is mi
307.
▲
Show HN: C3 – A C alternative that looks like C
(github.com)
120 points
by
lerno
5y ago
|
86 comments
308.
▲
by
lerno
5y ago
Agreed, haven’t heard of that until I read about it (I’m 48, living and working in Sweden)
309.
▲
by
lerno
5y ago
Could another approach be taken, where local variables are considered implicitly “register”? In that case this simple example has no problem whatsoever. It does arise unnecessarily if the address of a local is taken but does not escape, but
310.
▲
by
lerno
5y ago
There are many ways to approach macros. Zig’s approach with compile time evaluation handles many of them. Esp since types can be created on the fly. Another approach, which is strongly inspired by the ASTEC project for C, is what I use for
311.
▲
by
lerno
5y ago
It should be noted that Zig’s int promotion rules are currently broken though.
312.
▲
by
lerno
5y ago
On the other hand, leave out “pub” and Zig won’t compile it…
313.
▲
by
lerno
5y ago
So, consider passing a struct A stored in the global variable “foo” to the function “bar” in the parameter “baz”. This function makes a modification to the global “foo”. The compiler cannot know this happens and so the value of “baz” is now
314.
▲
by
lerno
5y ago
UML died because while people were buying UML to live the dream that programming could now be reduced to charting classes, real programming doesn’t work like that. All it added was some meaningless documentation that looked impressive but g
315.
▲
by
lerno
6y ago
Would have liked comparisons with Nim, Crystal, Odin, D.
316.
▲
Overflow trapping in practice – some strategies for low level languages
(c3.handmade.network)
1 points
by
lerno
6y ago
|
0 comments
317.
▲
by
lerno
6y ago
No, I'm aware of it. GCC also has a similar feature as a C extension. I picked those languages because they very clearly use the same keyword.
318.
▲
by
lerno
6y ago
If I may venture a guess, it is because this way there is no limit in regard to jumps within or out of a function. Since Go retains `goto`, function based is easier to implement. In addition, non-local jumps, such ones constructed by setjmp
319.
▲
Implementing "defer"
(c3.handmade.network)
48 points
by
lerno
6y ago
|
48 comments
320.
▲
On Arithmetics and Overflow
(dev.to)
2 points
by
lerno
6y ago
|
0 comments
321.
▲
by
lerno
6y ago
I’ll buy it so that my kids can grow up learning basic in the old school way. The Spectrum basic was one of the best back in the day. I’ve been teaching them using a C64 emulator but that Basic is pretty lacking.
322.
▲
by
lerno
6y ago
Having a full size C64 that’s based on emulation I would respectfully like to disagree. First of all the emulations all end up with minor glitches. Second, a machine like the Spectrum Next outclasses most emulator based machines by running
323.
▲
by
lerno
6y ago
As alternative, I introduced “failables” into my programming language C3. It has the benefits of Go error handling but none of the downsides. I wrote two blog posts as I developed the idea: https://dev.to/lerno/a-new-er
324.
▲
by
lerno
6y ago
Yeah you should totally do like Sweden where dead remains at a constant high level and where reduction to a low number of cases per day is very very far away. This “almost lockdown” strategy is almost equally hurtful for the economy but wil
325.
▲
by
lerno
7y ago
Oh, looks like they have a partly completed compiler with a c transpiler backend: https://cforall.uwaterloo.ca/trac/browser
326.
▲
by
lerno
7y ago
I wonder how they propose to solve exceptions, destructors, constructors and overloading while being more compatible with C than D. Apparently a beta was promised for "early 2019" according this: https://github.com/
327.
▲
by
lerno
7y ago
It’s interesting how “evolutionary approach” is used. Compare with C2: http://www.c2lang.org/ I think that in the case of C2 it’s still a language that will rely on the same paradigms as C, whereas C-for-all is more of a “k
328.
▲
by
lerno
7y ago
Pure desinformation. Taiwan is and remains an independent country despite the wishes of the Mainland Chinese regime.
329.
▲
by
lerno
7y ago
... and then the actual arguments included are basically things already convincingly refuted. But hey, repeat a lie enough times...
330.
▲
by
lerno
7y ago
My take on why OO - as usually taught and practiced - is problematic: https://link.medium.com/GEgk2vjLpZ In short: it requires a lot of up front design and abstract thinking, plus the idea to architecture a program around s
More ›