Hacker News new | past | comments | ask | show | jobs | submit login

Rebol (where Rye took this from) is many times associated with Tcl. I've heard good things about it, but haven't really tried it yet.



TCL is kinda similar to Rebol in some ways but in other ways it's the opposite of Rebol, because in TCL everything is a string (although it can ALSO have another type, thanks to clever shenanigans). (You probably knew this!)


I heard this "everything is a string" line many times abot Tcl and it sounded a little unusual, but I havent delved deep enogh in tcl to see what it really meant and brought. I will.


everything has a string rep available. It used to be that every thing was also represented literally by a string. So, for pedagogical purposes, a value 1 would be "1", and to do math, Tcl would do a strtol(val_storage), with the obvious performance implications.

The way things are done now (and have been for a long time), is that values are stored in a

    struct Tcl_Obj{
      int refCount; // objs can be shared
      int myType; // indicates whether currently a long, double, etc
      long longVal;
      double dblVal;
      [...]
      char *stringRep;
      int len;
    }
...in fact, the Tcl_Obj is more sophisticated than this, but for demonstration purposes this is fine.

So "native" (eg: longVal) values are used when appropriate, no marshalling back/forth between strings, but the string rep is always available (can be generated), because that's what Tcl promises: everything is representable as a string. This is what brings the homoiconicity to Tcl - logically it's just passing text tokens around, and emitting text tokens. Internally, again, more sophisticated, but you get the point.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: