Live data from Hacker News

Tcl 9.0

tcl-lang.org

111–120 of 247 posts

Re: Tcl 9.0

#111

It’s not exactly encouraging when a website for a UI tool contains absolutely no visual examples of UI on any of its main pages.

That tcl wiki is actually a fossil instance iirc - the VCS the Richard hipp evangelizes.

Re: Tcl 9.0

#112

Really enjoy the language, even if I don't use it much these days. Does it still produce GUIs from 1995 on Linux? I'd still be using it today if it had halfway reasonable support for building GUIs on Linux, like they've had for ages on other platforms.

Reminds me of using Tkinter with Python, while learning Python. There are other GUIs available, but finding examples of working code with a newer GUI is going to be more troublesome (but not impossible). I think it's just that the documentation has been centered around Tk(inter) for so long, most people just choose it as a default. I know Python has gotten better about GUI support (probably from the popularity in machine learning/AI usage), but with Tcl being less popular, you need to do some due diligence to find up to date documentation on modern GUI usage.

Re: Tcl 9.0

#113
post #5

The first major release in 27 years. 64-bit internal structures, so data can be huge. Full unicode with all the funky new emojis. Zip filesystems, etc., etc. There's lots of new stuff, and some old cruft has been dumped, so some programs may need a few updates, but there's still a high level of compatibility. The page above links to release notes with details of what's in and what's out.

Why did they remove tilde '~' as a convenient shortcut for the Home directory?

In 99% of cases, yes - this is a pain in the backside. Long ago I adopted something from the plan9 way of doing things (when I was heavily using acme).

Just symlink /h to /home. So ~user becomes /h/user, in places where ~ is not expanded for you.

Re: Tcl 9.0

#114

Earlier quoted context omitted.

I think of Tcl as Lisp for C programmers; by which I mean, Tcl give you the metaprogramming capabilities you get with Lisp in a language that looks more like C, plays well with C, is much more straightforward than your typical shell language, and has a cross-platform GUI. A skilled Tcl programmer can do magic. I spent ten years, from 2005 to 2015, programming almost entirely in Tcl/Tk and I loved it. Since then I mos…

I should add...Tk is the easiest GUI toolkit I've ever used (and I've used a bunch of them). It's got all the basic stuff you need, either built-in or readily available. But it comes from the classic desktop GUI world, you have to work at it to make it look nice, and it's a pain to do webpage-like layouts with it. I wouldn't do an end-user GUI in Tk at this point; but for in-house tools that need a GUI and don't need…

For strictly developer tools, or for those used to older OS desktops or simplistic widgets, it's really hard to beat Tk. It's been around so long that if you've dealt with it before, it might feel dated, but it's also easy to figure out exactly what it does. I got my start using Tkinter with the O'Reilly Programming Python book (the more expanded book from Learning Python), using Python 2.x (probably 2.4 based on the 2008 or so timeframe I bought it). While at that point I had used C#.Net with their GUI builder, as well as Java's AWT and Swing, and Tkinter felt so much more natural when writing a GUI through code.

Re: Tcl 9.0

#115
post #41

Earlier quoted context omitted.

I should also note that Richard Hipp, the creator of SQLite, says that SQLite is coded in Tcl. The database engine itself is coded in C, of course; but the vastly larger test suite is mostly coded in Tcl; and it's the test suite that makes SQLite the reliable engine that it is. The test suite persists; the engine's been re-written in whole and in part.

Indeed, SQLite started life as simply a Tcl extension[0] that “escaped into the wild”. Redis was initially prototyped in Tcl too, and ‘antirez has nice things[1] to say about Tcl. [0] https://sqlite.org/tclsqlite.html [1] http://antirez.com/articoli/tclmisunderstood.html

I think he also wrote an implementation of a tcl-like language called Jim.

Re: Tcl 9.0

#116

Really enjoy the language, even if I don't use it much these days. Does it still produce GUIs from 1995 on Linux? I'd still be using it today if it had halfway reasonable support for building GUIs on Linux, like they've had for ages on other platforms.

A theming engine went in something like 15 years ago now; the default theme looks rather dated, but there are plenty of others. See https://wiki.tcl-lang.org/page/List+of+ttk+Themes (though the screenshots of core themes are from 8.5/8.6 - default in particular has changed a bit in Tk 9). The "catch" is that the theming engine has its own new widgets, and so to be themed an application has to use the new API. Code fr…

Yeah, they added that a long time ago, but it's not at all the same as built-in support. My experience was trying out fragile third-party projects with little or no documentation. The whole point of using Tcl/Tk for writing a GUI was the convenience.

Things may have changed over time. I no longer pay attention. Maybe I'll give it another try.

Re: Tcl 9.0

#117

Earlier quoted context omitted.

I've long fantasized about a tool I call "expect" that safeguards against crazy stuff like that. It has a syntax of your expectations, functionally existing as a set of boundaries, and you can hook it to always run as a wrapper for some set of commands. It essentially stages the wrapped command and if none of the boundaries are violated it goes through. Otherwise it yells at you and you need to manually override it.…

When it comes to SQL, I will often write a SELECT with very explicit search (WHERE) criteria for this very reason. Then copying that statement, commenting the original, and pasting to change into an UPDATE or DELETE statement seems to be a technique that works well for me. The SELECT tells me exactly what I'm going to UPDATE or DELETE, and once I have that, changing the syntax is very minimal. In the case of an ORM,…

I always write the where first. It's kinda like thinking in RPN or postfix. I put the parts in out of order in a way that prioritizes the minimization of error.

But this is stupid. These are computers, we can make whatever we want. Executing a delete or update should, if one desires, not have to be database knifeplay.

Re: Tcl 9.0

#118

Earlier quoted context omitted.

> most things you’d need Say you wanted to write a CAD app like https://www.onshape.com . There’s no way you could do it Tcl/Tk, is there?

Most of what I'd call the UI - all the toolbars and pseudo-floating-windows - is basic bread-and-butter Tk stuff. The 3D context and CAD kernel would be the tricky bits. There are extensions floating around to work with OpenGL (or whatever), but I don't see doing the heavy CAD-kernel lifting in Tcl - that would likely have to be in C, or whatever. (Just as it presumably is for Onshape.)

[deleted]

Re: Tcl 9.0

#119
post #88
post #41

Earlier quoted context omitted.

Indeed, SQLite started life as simply a Tcl extension[0] that “escaped into the wild”. Redis was initially prototyped in Tcl too, and ‘antirez has nice things[1] to say about Tcl. [0] https://sqlite.org/tclsqlite.html [1] http://antirez.com/articoli/tclmisunderstood.html

I'm curious about why they chose Tcl, particularly over languages like Python or Perl. Were there specific aspects of Tcl that made it appealing for SQLite and Redis, or was the choice more about familiarity with Tcl? Either way, I'd love to understand what they found interesting or advantageous about Tcl in these projects. BTW, I chose Tcl/Tk in the past because it was the easier way I found to quickly built an UI o…

Most likely for the same reason you found. Once you know it, it's very easy to use, and it's available in most distributions (if not all). So both familiarity with Tcl, while having that ability to build out quick and stable GUI tests, including the lack of churn in the GUI framework. For myself, having to readapt to a GUI framework when I'm just trying to get something visual up and running to make life slightly easier, makes something like Tk much more beneficial for just getting work done. A bit ugly, but anyone technically inclined will figure it out quickly, without constantly having to change up libraries. I only speak for myself and put my 2 cents in, I don't speak for anyone else, but for general tooling targeted at developers it seems perfect.

Re: Tcl 9.0

#120
post #86

Earlier quoted context omitted.

Super interesting, what's the rationale behind its use there?

John Ousterhout realized that every single EDA tool at Berkeley wound up implementing a crappy extension language. So, he implemented a language so that there could be a single, not-so-crappy extension language for the Berkeley EDA tools. He made C integration particularly easy (something the lisps of the time didn't really do). As his students spread out, each company they hit had a shitty extension language and the…

> It is really hard to describe just how much better Tk was than anything else in the time frame.

This[0] vs (from memory w/o a computer atm…):

  #!/bin/env wish
  button .b
  .b configure -text “push me” -action {puts “don’t push me!”}
  pack .b

[0] https://users.cs.cf.ac.uk/Dave.Marshall/X_lecture/node5.html...

======

  #include  
  #include 

  /* Prototype Callback function */

  void pushed_fn(Widget, XtPointer, XmPushButtonCallbackStruct *);


  main(int argc, char **argv) 

  {   Widget top_wid, button;
    XtAppContext  app;
   
    top_wid = XtVaAppInitialize(&app, "Push", NULL, 0, &argc, argv, NULL, NULL);

    button = XmCreatePushButton(top_wid, "Push_me", NULL, 0);
     /* tell Xt to manage button */
   XtManageChild(button);
         
  /* attach fn to widget */
    XtAddCallback(button, XmNactivateCallback, pushed_fn, NULL);

    XtRealizeWidget(top_wid);    /* display widget hierarchy */
    XtAppMainLoop(app); /* enter processing loop */ 

  }

  void pushed_fn(Widget w, XtPointer client_data, XmPushButtonCallbackStruct *cbs) 
  {   
     printf("Don't Push Me!!\n");
  }
Post reply on HN