5 ms·
Here's a way to love go, write a language in it https://github.com/grubby/grubby https://github.com/grubby/grubby
by andrewfromx 10y ago
Here's a way to love go, write a language in it https://github.com/grubby/grubby https://github.com/grubby/grubby
- the_duke 10y agowhatevs...
- pjmlp 10y agoYeah what were/are Xerox PARC, ETHZ, Microsoft, Apple, Google thinking in their language departments!
- millstone 10y agoWhat interpreters did these orgs write in GCed languages?
- pjmlp 10y agoA few examples from Oracle/Sun using the Graal VM engine, written in Java: https://github.com/graalvm https://github.com/graalvm From Microsoft: http://ironpython.net/ http://ironpython.net/ http://ironruby.net/ http://ironruby.net/ https://msdn.microsoft.com/en-us/library/dd233052%28v=vs.110%29.aspx https://msdn.microsoft.com/en-us/library/dd233052%28v=vs.110... https://msdn.microsoft.com/powershell https://msdn.microsoft.com/powershell Xerox PARC used Cedar for the software implemented on Xerox 1132 (Dorado) and Xerox 1108 (Dandelion) systems, including interpreters delivered on the system: http://dl.acm.org/citation.cfm?id=17919.806844 http://dl.acm.org/citation.cfm?id=17919.806844
- millstone 10y agoThese are just experiments on the margins. In each case, the flagship languages are not implemented on top of GC'd runtimes or interpreters. Apple's Objective-C and Swift runtimes are both C++. Microsoft's C# CoreCLR is C++. Google's V8 and Dart have runtimes written in C++. Oracle's HotSpot is C++. Go's core runtime is in a Go-minus-GC subset. It didn't have to be this way - Swift could have been written atop the JVM, v8 could have been implemented via Boehm, etc. For whatever reason, when it counts, the stuff under the hood doesn't use garbage collection.
- pjmlp 10y agoThe question was "What interpreters did these orgs write in GCed languages?". It doesn't matter where those interpreters are being used, the fact is that they exist. > Microsoft's C# CoreCLR is C++. Yes, but they have moved their compilers to C# with the Rosylin project with MDIL and .NET Native moving more code to C# side. Also check the Phoenix compiler framework, a LLVM like project from MSR using C#. > Go's core runtime is in a Go-minus-GC subset. Of course, there needs to exist a Genesis for the GC, but once it is there, 99% of the remaining infrastructure makes use of it. If you take Nashorn engine running on Jikes, it is an 100% Java stack running a JavaScript interpreter. > For whatever reason, when it counts, the stuff under the hood doesn't use garbage collection. Most of the time it is just building on top of whatever already exists instead of starting from scratch. Taking Swift as an example bootstraping the language would increase the burden designing it, as they are still far from fully stable design. If they would throw away in man years invested into the LLVM, which happens to be written in C++, it would take ages before pure Swift compilers would ever manage to catch up. However these shortcuts open the door for those not savvy in compiler design to use as ammunition against secure languages.
- millstone 10y ago> Yes, but they have moved their compilers to C# A compiler is a different matter. GCed languages are very compelling for static compilers. Even gcc uses GC internally. The claim is that GCed languages make for poor interpreters - and also poor JIT compilers and runtimes. > If you take Nashorn engine running on Jikes, it is an 100% Java stack running a JavaScript interpreter Nashorn gets participation points, but it's not competitive with any of the major JS engines, all of which have C++ runtimes. > Taking Swift as an example bootstraping the language would increase the burden designing it, as they are still far from fully stable design. If they would throw away in man years invested into the LLVM, which happens to be written in C++, This still confuses the compiler with the runtime. The Swift compiler is indeed written in C++ using LLVM, but it could have easily been written in a GCed language without affecting much of anything. But the runtime is separate, and it also happens to be written in C++. It's possible to imagine the Swift runtime written in a GCed language, but that is not what Apple chose to do.
- skj 10y agoWhich interpreters are you thinking about that are written in a GC'd language?
- pjmlp 10y agoSee https://news.ycombinator.com/item?id=12208320 https://news.ycombinator.com/item?id=12208320
- _ak 10y agoDo you even know Go's GC guarantees?
- millstone 10y agoI don't! What are they?
- _ak 10y ago40 ms mutator time per 50 ms time window. That means that your program will never be interrupted for longer than 10 ms within 50 ms. In practice, the STW mark and sweep phases are in the sub-millisecond range, and the GC runs not nearly as often as 20 times a second, so 10 ms of interruptions per 50 ms is the absolute worst case.
- fauigerzigerk 10y agoI think these are goals, not guarantees, and the numbers are predicated on assumptions about extra free memory available to the GC. There is an inherent tradeoff between pauses, throughput and extra memory requirements.
- _ak 10y agoWell, the latency is capped at 10 ms, the STW phases will stop at that limit. So that guarantee can be kept as long as your memory allocation throughput is low enough so as not to trigger a GC run more than 20 times a second. Which is pretty good. There aren't that many GC implementations in production that will give you a guarantee of the same or similar quality.
- fauigerzigerk 10y agoCan you point me to an authoritative source that explains what exactly is guaranteed under what assumptions and what is done on a best effort basis only?
- _ph_ 10y agoWhy wouldn't it be? Instead of rolling out your own, bad GC, you can rely on the tested built-in. Of course you would be careful to write the interpreter loop so that it does not allocate memory just for interpreting, but that should be easy in a decent language.
- spriggan3 10y agoI would really like to see some mruby bindings for Go. It would be simpler than re-implementing ruby in Go.
- aleksi 10y agohttps://github.com/mitchellh/go-mruby https://github.com/mitchellh/go-mruby There are others, but that one looks complete.