Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Honestly, sometimes I think that the best solution for fixing the security quagmire we're in would have been not by creating a new system programming language like Go, Nim, Rust, D or even reviving one of the Wirthian languages (though having them on the table is very much a good thing), but by creating a memory safe dialect of ANSI C, and perhaps standardize on a better string handling library.

In fact, such an effort was started at AT&T back in 2001. The language was named Cyclone [1]. It met its 1.0 release in 2006. It has since been abandoned. Which is a damn shame, because it looked like it had real potential.

Is C a primitive language? Yes. In fact, it's almost stupidly simple compared to most modern languages. But its greatest weakness also proves to be its greatest strength. The main cognitive overhead from using C is in its manual memory management model and certain gotchas in standard libraries. It being bare bones as it is (but not too much) also makes it surprisingly pleasant at times. I get the feeling that plenty of modern languages try too hard to be novel and, for all the freedom you get from not having to worry about anything below program logic itself, you still end up expending a lot of effort into complicated high-level patterns that are frequently interspersed with arcane PL theory.

But that's not even the main reason why something like Cyclone is much needed. No. It's that we've pretty much perfected a ton of our APIs, like POSIX, to work with C. It simply feels most natural to work with POSIX in plain C. FFIs and bindings vary, some of them like Nim's actually feel quite clumsy (otherwise Nim makes it absolutely trivial to create FFIs, which is great).

Finally, refactoring 30 years worth of code into Cyclone sounds far more realistic than rewriting the world in Rust.

[1] https://en.wikipedia.org/wiki/Cyclone_%28programming_languag...



Thanks for mentioning Nim! :-)

I can't say I agree with anything you say though... So only memory safety is C's problem? Not its type system that's very weak in every aspect (not just memory safety)? Not its missing module system? Not its ambiguous syntax?

You also confuse "simple" with "primitive" and perhaps "familiar". C surely is primitive, but how is it simple? Simple to use? No. Simple to implement? Not really. Has a simple mapping to the underlying hardware? That stopped being true three decades ago.


> Has a simple mapping to the underlying hardware? That stopped being true three decades ago.

I've seen this claim repeated a few times in the thread and I still have no idea what it means.

For medium levels of optimisation it's usually very simple to predict what assembly code will be generated by C compilers. On many platforms the operators often match directly to a instruction (e.g. arithmetic and bitwise operations) or short patterns of instructions (the control flow primitives and conditional execution, equality testing, function calling, etc). At a higher level, compiled C functions look pretty much exactly like manually written assembly language procedures and structs are just blocks of memory with clear order and offsets. It's also very simple to interface C and assembly code without any hacks on either side.


Yes, I too had high hopes for Cyclone when I saw it back then. Sad it seems to have stagnated.


Cyclone has been superceded by Rust. Rust is the new Cyclone.


I think he's right, though. It's too much to ask for all this memory unsafe code to be rewritten into Rust, which is a large leap in semantics from C. There really is a space in the market for a safe variation on C which is easy to port to.

Now, how much safety you can demand before the language turns into a unicorn is another question and would be interesting to explore.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: