zserge / partcl

ParTcl - a micro Tcl implementation

Home Page:https://zserge.com/posts/tcl-interpreter/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tcl on steroids (i.e. merge between Tcl and REBOL)

dumblob opened this issue · comments

I like Tcl a lot and would want to have it more widespread. The only thing which I find rather unfortunate is that Tcl treats everything as string by default.

This property has one side-effect - the amount of generic optimization (i.e. not by implementing some commands in native code instead of Tcl itself) has a limit which is unfortunately quite low considering current HW (even "embedded" one).

After I read your blog post https://zserge.com/posts/tcl-interpreter/ where you @zserge encourage readers to come over here with contributions I decided to express an idea I have in my head for quite some time already.

I envision a Tcl-like language which doesn't build upon strings, but directly AST (abstract syntax tree). The ideal is merging Tcl with REBOL. Why not REBOL directly? Because REBOL (and its current successor Red) tries to get it to an extreme leading to some very very opinionated (in contrast to practical & fair-minded) decisions.

There is also Spry trying to get away from those opinionated decisions of REBOL/Red, but it lacks development force for many years 😢 (and thus suffers from some long-standing issues as well as the "missing delimiter issue" (where all functions/methods/commands/... have always fixed number of arguments which one has to remember because there is nothing like a delimiter in the language at all)).

I actually think that one could make "something like Spry", but even smaller by merging in some cool ideas from Tcl languages. Using some clever mutable tree structure which is cache oblivious could make such language really fast (currently the state of the art seems to be MinWEP ; naive pointer-based trees or the good old B-trees are by far insufficient nowadays and here is why).

Thoughts?

Hello,
great idea! I like Tcl as well. Especially this library, which can be used in embedded applications. it is bit hard to find scripting language that can be easily included into small memory footprint. There are other version of small Tcl, like Picol. But unfortunately they miss one important feature, and that is use of memory management functions, like this library. I think it is very important to use separated heap for scripts, I use umm_malloc.
I'm not able to evaluate about AST, I think stings is good for simplicity, but bad for performance. Similarly I agree with you that threes would be faster then linked lists.
My use case is obviously embedded application. I guess if you go ahead, you should define primary target of use, libraries required, RAM and ROM constraints.
My observation for example, a simple while loop with 10 iteration of adding x++ call tcl_next() about 1000 times, which takes 7ms ( edited (200ms), I had trace printout on) in low prio thread on my STM32F407.