Eagle: Tcl interpreter implemented in CLR
eagle.to
eagle.to
Can we not just build cool things? Sorry, I could not help myself.
Fun fact: antirez of Redis fame started with an interest in Tcl, and he has written about it. He wrote his own minimalist Tcl implementation in C, despite the original being an exemplary C project (or so I have heard the Tcl codebase is still sometimes used, despite reservation about the resulting language here, as a very clean and easy learning object for teaching language/interpreter design) and I doubt none of his experiences or lessons learned bled into the uber-success that Redis now is, right?
Edit: If this subthread got you interested, antirez's other Tcl projects are worth checking out. They are listed on his page on the Tcler's wiki: https://tcl.wiki/9497. I particularly recommend https://tcl.wiki/Picol, the tiny predecessor to Jim Tcl, and https://tcl.wiki/Sugar, a macro system for Tcl 8.4+. Disclosure: I maintain a somewhat larger fork of the former.
Updating the copyright date is not super important, due to how the copyright laws are written; however, I'll probably update it again eventually.
1. Expert .NET 2.0 IL Assembler (ISBN 1590596463)
2. Advanced Windows Debugging (ISBN 0321374460)
3. Advanced .NET Debugging (ISBN 0321578899)
4. .NET Framework reference source code (https://referencesource.microsoft.com/)
5. CoreCLR source code (https://github.com/dotnet/coreclr)
6. MSDN documentation (it's not perfect, but it's not all bad)
Before CoreCLR was open source, I had to rely on Shared Source Common Language Infrastructure (https://en.wikipedia.org/wiki/Shared_Source_Common_Language_...).
I haven't dug into the code yet, but I'm assuming "interpreter" means no DLR shenanigans or other platform-limiting stuff? (DLR-based scripting languages are no bueno on iOS, since you can't generate bytecode at runtime.)
There are a couple platform-specific portions of code; however, they are all optional and can be easily disabled at compile-time. Also, checks are performed at runtime prior to calling into those platform-specific portions of code.
The full test suite is routinely run on both Windows and Linux platforms (using Mono).
However, to make things more confusing, it also permits dynamically loading native Tcl libraries and interacting with them, on both Windows and Unix. Of course, this feature is actually optional at compile-time because it requires using P/Invoke.
- Can you do Starkits!? With .NET and the CLR, pre-Core (since I see this goes back to 2012), that would be interesting?
- Can you run Fossil on this?
- How does type ellision work (or rather how do you handle moving between CLR/.NET primitives into a very different or minimalist Tcl type system)?
Thanks for the cool work. Sorry so many questions but that is what popped into my head!
Also, Eagle runs quite well on Mono, on both Mac OS X and Linux.
I'm not sure what you mean by "Can you run Fossil on this" since Fossil itself is written in C. However, Eagle can certainly be used with Fossil via its Tcl integration support. The Garuda package (part of Eagle) is used to load the CLR and Eagle from native Tcl.
Eagle "knows" about all the .NET primitive types, including generics, nullable value types, ByRef, multi-dimensional and nested arrays, and all delegate types. The "core marshaller" handles all translations between these types and strings. Everything is handled with full fidelity.
https://www.fossil-scm.org/index.html/doc/trunk/www/th1.md
The type situation is cool. I know little of CLR and .NET, but will definitely check out this code. This sounds wonderful, good on you and your community! Perhaps I will play.
For example, several prominent hardware companies embed Tcl in their firmware: Cisco, F5 Networks, and TiVo.
While it's true that Tcl was primarily intended to be used as an embedded scripting language, it can also be used for stand-alone application development. Also, the Tk toolkit may be used to create reasonable, cross-platform user interfaces.
Alternatively, it is possible to dynamically load and use Tcl/Tk from Eagle, including bidirectional communication with WinForms and/or WPF. This makes porting Tk applications or portions thereof relatively straightforward.