Live data from Hacker News

Ask HN: Is there a simple and minimal language like C but without its footguns?

news.ycombinator.com

11–20 of 41 posts

Re: Ask HN: Is there a simple and minimal language like C but without its footguns?

#11
Seems like Go might be able to fit your bill. AFAICT the designers of Go has gone out of their way to avoid adding cruft to the language.

Yes it has GC. What is it that you want to build though? Will GC be in the way? If so, I would consider Rust instead.

C is simple, true – but in many cases it seems like that fact pushes the complexity up to higher layers instead.

C still has it’s place in embedded. And our best kernels are currently written in C. Outside of those domains I don’t see much reasons to start a greenfield project in C.

Re: Ask HN: Is there a simple and minimal language like C but without its footguns?

#12
post #5

> Does not have the footguns of C. > Simple like C. You have to pick one, or give in on both and find a happy medium between the two. The way you get safety in a language is by abstracting over the simplicity. I personally would suggest biting the bullet and going with C++, you can stick to a reasonably sane subset of the language but it definitely won't be C.

> You have to pick one, or give in on both and find a happy medium between the two.

I'd say Pascal is simple, and has fewer foot guns than C. It might be too simple - but one can do a lot with freepascal/Lazarus.

Or go with Ada. Also somewhat simple, I'd say.

Re: Ask HN: Is there a simple and minimal language like C but without its footguns?

#13
Free Pascal is more elegant, and has runtimes everywhere. Normally you can avoid pointers, however if you need to use them, the syntax makes it easy to see what you're doing.

Strings are memory managed for you, and can even include nulls.

See the Free Pascal project[1], and the Lazarus IDE[2]

1 - https://www.freepascal.org/

2 - https://www.lazarus-ide.org/

Re: Ask HN: Is there a simple and minimal language like C but without its footguns?

#17
You don't seem to like garbage collectors, or manual memory management (with which you'll get segfaults and double-free issues) or complexity (where the intermediate ground between manual and automatic memory management comes in, with compiler hints, etc.)

This doesn't seem like a satisfiable set of constraints. I'd recommend removing "not garbage collected" from the constraints, as automatic memory management mostly got introduced to reduce footguns.

Re: Ask HN: Is there a simple and minimal language like C but without its footguns?

#18
post #3

Take a look at Zig (ziglang.org). Not sure it meets all of your requirements, but looks like it might. I haven't worked with it yet, but it's on my radar, as is FORTH, for the simplicity aspect you mention. And I should mention Tcl, but that's a scripting language so not what you asked for, but just in case, no, Tcl isn't 'dead', it's in most of the Cisco and other IT infrastructure equipment that's getting this webs…

Zig is the only lang that meets the description. Very few languages can be used to write system etc code. As OP pointed, Rust and C++ aren't minimal or simple. In such a narrow field, this leaves Zig. Maybe Ada.

Re: Ask HN: Is there a simple and minimal language like C but without its footguns?

#19
Pascal, Zig, V and possibly Crystal. Or Das C although arguably that is a subset of D.

V isn't anywhere near finish. The closest thing should be Zig. But that is far from finish as well.

Crystal is more like Go than C. But I mean someone wrote a OS [1] using Crystal in her spare time.

Or just plan old Pascal.

I mean if you are looking for simplicity like C and compiled to machine code you virtually ruled out 95% of all programming languages. Other languages like Lua is simple. But certainly dont fit the bill.

[1] https://github.com/ffwff/lilith

Re: Ask HN: Is there a simple and minimal language like C but without its footguns?

#20
C with valgrind can be relatively safe. Sort of enforcing the safety outside of the language and into the surrounding tooling.

And sticking to some common heuristics goes a long way towards safety. Some people think it's impossible to write safe C, but you can.

So the answer is C.

Post reply on HN