• lime!@feddit.nu
    link
    fedilink
    English
    arrow-up
    11
    arrow-down
    1
    ·
    19 hours ago

    some of you have never programmed in tcl and it shows

    • magic_lobster_party@fedia.io
      link
      fedilink
      arrow-up
      20
      ·
      19 hours ago

      I opened a TCL script once. It’s use of uplevel scared me. I’ve never dared to return since.

      For those who don’t know: uplevel is a command that goes up one level of the stack frame, and then executes code there. A function can therefore execute code in its callers stack frame.

      • lime!@feddit.nu
        link
        fedilink
        English
        arrow-up
        12
        ·
        edit-2
        17 hours ago

        tcl is pretty fun actually, it’s like bash on steroids.

        for a preview of the insanity: anything surrounded by "" is a string, with the variable expansion you’d expect. anything surrounded by {} is also a string, but with no expansion. the equivalent in bash is the backtick string. but you don’t need to know that to write tcl. if you approach {} as “code blocks” like in other languages, it just works. reason being that tcl evals everything, constantly, attaching little tags to strings that tells the language how things are used, like “this string is an integer” or “this string is code and here is the result from last time it ran”. it’s madness and, weirdly, robust as hell. Xilinx writes all their tooling in tcl. SQLite started life as a tcl module, and it’s still the only api that is not provided by a plugin.

    • Frezik@lemmy.blahaj.zone
      link
      fedilink
      English
      arrow-up
      5
      arrow-down
      1
      ·
      18 hours ago

      I have. I quickly learned not to.

      Tk is overlooked, though. It’s not pretty, and its approach is archaic, but it’s one of the few GUI toolkits that Just Works on every platform I tried it on with minimum fuss.