<- Back
Comments (51)
- ventanaTranslating a language into a different language is a popular thing to do these days, but still not a very easy one. I feel it's like peeling an infinite onion of misery. First, you write a parser of your source language, figure out the translation of the instructions, and emit the code in the target language, and you're very happy when your translated Hello world compiles.Then, a user (like me) tries writing something like package main func main() { register := 42 println(register) } well, oops. /tmp/solod_build3904763637/main.c: In function 'main': /tmp/solod_build3904763637/main.c:6:21: error: expected identifier or '(' before '=' token 6 | so_int register = 42; | ^ /tmp/solod_build3904763637/main.c:7:29: error: expected expression before 'register' 7 | so_println("%" PRIdINT, register); | ^~~~~~~~ (exit status 1) OK, now you grab the list of reserved words of the target language, which is not always an easy thing to do, and rename type names and variables as needed.The next bad thing is when you step on your own toes and see that the new names you invented, like `so_int` or `so_println`, will inevitably pollute the global namespace. We'll either cross our fingers and hope that no one will create a variable named `so_int`, or we'll need to add all our new kind-of-reserved words to our already big list of exceptions.I'm sure there are multiple levels of complexity beyond this.Not trying to say that seeing a bunch of new translators from language A to language B is bad: not at all! It really seems that this is one of the popular usages of the agents, and a rewarding one. But doing it without hidden bugs is kinda hard.
- kitdThe idea of using a subset of an existing popular language is very wise IMHO. We can (and apparently are) debating the merits of the language runtime, but what a subset gives you is immediate access to a large pile of existing tooling that you'd have to write yourself, eg linters, formatters, lsps, etc. Stuff that is purely source-oriented.That hadn't really occurred to me before.
- RossBencinaThe "a better C" meme needs to die. It's ill defined. Everyone wants something different. For me, GC disqualifies any language as a better C. Bjarne Stroustrup promoted C++ as a better C. But C++ killed off some of C's killer low-level features like type-punning via unions. Indeed it's only in recent years that low-level memory manipulation, such as std::start_lifetime_as and the implicit lifetime rules were standardised. The whole strict aliasing fiasco made C and C++ permenantly worse. Some people say Zig is a better C, but it is certainly not a minimal language, if that's how you define better. For me a better C would have an abstract model that matched machine-level memory access (i.e. no type-based alias analysis) would be as minimal as C in terms of feature set, would clean up C warts like operator precedence, and would be as deterministic as possible (e.g. deterministic memory layout, including bit fields, would be possible without hacks)...
- pjmlpGo is a better C already, designed by C authors themselves, with other UNIX key figures.Which while some of the design decisions might be debatable, they actually knew what C is all about, informed by their own experience with what worked in C, Alef and Limbo, across UNIX, Plan 9 and Inferno.
- aarvin_roshinThe author's original blog post, which goes into some more detail: https://antonz.org/solod
- gnull> So is for Go developers who want systems-level control without learning a new language. And for C programmers who like Go's safety, structure, and tooling.Wut?Also, how do you preserve garbage collector semantics without garbage collector?
- bb88How does it deal with pointers if everything is stack based? You can't really return a pointer to something on the stack because it could get overwritten between when you return it and when you access it.
- pillmillipedesI doubt that it can. so in addition to C's quirks (which I know about), I have to care about go's quirks and solod's quirks as well? and for what? there's no solod-to-regular-go interop aiui, so just some tooling and the standard library?
- rao-vArn't goroutines the killer feature of go? Don't see how you'd get them with this approach.
- ralukAt first glance looks like stipped C++ with minor differences. For example go have row polimorphism compared to OOP in C++. What else is there that C++ does not have?
- leecommamichaelI really like this idea. I was reading a post earlier about how Go generics are implemented, and how they're sort of leveraging root GC-types in the "runtime" to avoid the same bloat as monomorphization causes in, say, C++. I wonder how Solod will do that? I guess plain monomorphization? I guess that's fine since C compilers are so speedy.
- jay_kyburzI've been using Go and Raylib to make a game lately and I really don't have a problem with garbage collection. It's so fast that it's not having an impact on my frame rate.I was a little worried at the start because nobody would normally consider Go for games, but I did a bunch of tests and found it's just no big deal.(I'm focused on game play and not interested in pushing hardware to its limits.)
- djha-skinIt cannot be a better C. You cannot implement exceptions in it using set jump for example, but the biggest problem is memory management. You can't implement your own arena allocator in golang.
- faangguyindiai've been using Go on backend now all the time.Wish something like this existed instead i am stuck with flutter and react native on Mobile.When will a time come when i can use some functional languages like Haskell or a plain boring language like Go for making apps with OTA ability for mobiles.As vibe coding takes over, app store approval will become slowerer and OTA is really great when you need to make quick changes!You can OTA each day and do base app release to store once each week.i think this maybe the space where very little work is being done.
- heyitsdaadInsert Look What They Need To Mimic A Fraction Of Our Power meme here.
- ghthorThis is a very exciting project; love writing go with the tooling, but I miss writing C from my getting started days
- anonundefined
- PanzerschrekYet another attempt to reinvent a better C. Curious, but unpractical. If one need a better C, C++ should be used instead.
- smalljelly2018[dead]
- thot_experimentIt cannot. C is a wonderful language that makes me smile every time I pick it up. A truly universal tool that lets you go wherever your heart desires. Go is a prison designed to enforce a bleak uniformity on all of it's users. For only by painting everything a uniform gray can we ensure we are all equal.