Top
Best
New

Posted by TheWiggles 10 hours ago

Solod – A subset of Go that translates to C(github.com)
137 points | 34 commentspage 2
jimgill 5 hours ago|
Might this help in memory leaks in go ... what will happen to the code that translated to pointers ....wrong conversation...CODE CRASH??
numlock86 6 hours ago||
> So supports structs, methods, interfaces, slices, multiple returns, and defer.

> To keep things simple, there are no channels, goroutines, closures, or generics.

Sure, slices and multiple return values are nice, but it's not what makes Go good. When people think about Go they usually think about channels and goroutines. YMMV

While I do kind of get what the appeal and target audience is supposed to be, I absolutely don't get why you'd choose a subset and still have it behave differently than the Go counterpart. For me that destroys the whole purpose of the project.

Surac 4 hours ago||
I seem too stupid. Why not use C11 in the first place? Can anyone explain?
matthewmueller 5 hours ago||
Love the design considerations here!
vaughan 6 hours ago||
We need this for TypeScript.
WalterBright 5 hours ago||
Translating code to C usually results in some nearly unreadable code. I submit the C++ to C translator, cfront, as evidence. I've looked into using C as a target backend now and then, but always "noped" out of it.

I was pleasantly surprised to discover, however, that C code can be readily translated to D.

Someone 3 hours ago|
I don’t think that’s a valid comparison. It compares two entirely different cases.

In general, if the guts of Foo are similar to those of Bar, translating Foo to Bar is fairly easy.

If Foo has additional guts, as in the C++-to-ℂ translator, translating those parts can lead to hard to read code.

In the C-to-D translator case, it’s not Foo that has additional guts, though, but Bar.

Then, a reasonable 1:1 transaction is easy. Doing it in idiomatic style can still be hard, though. For example D has garbage collection, classes and inheritance. I doubt the readily translation of C to D will replace C equivalents (e.g. a garbage collector written in C that’s part of the code) by those where possible.

Onavo 9 hours ago||
Does it work with the preprocessor?
MegagramEnjoyer 8 hours ago||
This is a bit too barebones. At least bring goroutines dude
whateveracct 7 hours ago|
way too hard
lukaslalinsky 3 hours ago||
stackful coroutines are not hard to implement
Sarthakofficial 6 hours ago||
[flagged]
melodyogonna 3 hours ago|
[dead]