‹ BackHN Continuity

Thread

Tcl/Tk 9.1

304 points · 144 comments · dmux

  1. srean · · focus · HN ↗
    I have a soft corner for TCL, because of its idiosyncracies and weird dynamic stringy playfulness. I would be wary of using it professionally but to play around for the fun of it ... it's just too much fun. Upvar and uplevels are crazy.

    Python is that kind of cool one behaves when visiting parents of your would be spouse for the first time. Tcl on the other hand is like playing one's secret exclusive and somewhat dangerous games with kid school bestie.

    Tcl/Tk pioneered the notion of a scripting language as a library. It got threading right. You can run multiple independent Tcl interpreters in the address space of your process and they can exchange messages. Entirety of interpreter state is encapsulated inside the interpreter object, no globals. To a user an it is just a pointer to an object.

    No need for GIL, no need for serialization/deserialization (pickle/unpickle) ... just within process memory copy (or no copies in case data is immutable).

    1. kevin_thibedeau · · focus · HN ↗
      > Entirety of interpreter state is encapsulated inside the interpreter object

      This was their attempt to position Tcl as an alternative to JS. The sub-interpreters were introduced as controllable sandboxes for running untrusted code with reduced privilege. Instead we got a web scripting language that allows untrusted code to interact with your USB devices. Python sub-interpreters are a joke compared to what Tcl has.

      1. srean · · focus · HN ↗
        Are you sure ? Tcl is almost a decade older than javascript although subinterpreters came later. Even before subinterpreters you could have multiple Tcl interpreter instances in your code.

        One could call Tcl_CreateInterp() multiple times in your code and each call would return an independent interpreter.

        1. bch · · focus · HN ↗
          Safe interps were designed c. 1993 by Nathaniel Borenstein and Marshall Rose to be able to safely run code received through email[0][1].

          [0] <a href="http:&#x2F;&#x2F;www.beedub.com&#x2F;book&#x2F;2nd&#x2F;interp.doc.html" rel="nofollow">http:&#x2F;&#x2F;www.beedub.com&#x2F;book&#x2F;2nd&#x2F;interp.doc.html

          [1] <a href="https:&#x2F;&#x2F;www.guppylake.com&#x2F;nsb&#x2F;pubs&#x2F;ulpaa-94.pdf" rel="nofollow">https:&#x2F;&#x2F;www.guppylake.com&#x2F;nsb&#x2F;pubs&#x2F;ulpaa-94.pdf

        2. pjmlp · · focus · HN ↗
          Back in the ActiveX days, ActiveState had IE scripting engines for Tcl, Perl and Python, allowing their use on IE instead of VBScript and JScript.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.