Live data from Hacker News

Tcl 9.0

tcl-lang.org

131–140 of 247 posts

Re: Tcl 9.0

#131
post #124

Great to see all the love for TCL here :) Too bad it's not more popular really but even I struggle to find cases where I'd prefer it. Usually it come down to bash for simple stuff and python everything else.

Not those scenarios, but I think it still has potential to take place of embedded scripting languages like Lua, if it can keep up of course.

Re: Tcl 9.0

#132

Earlier quoted context omitted.

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.

I know what you mean, I do the same. I agree, but at the same time, it's difficult to start building in protections for the user. Where do you start and where do you stop? I have been forced to do the extreme to protect the user, and then you are asked why things are so difficult to use. I think to make something for someone that concentrates in the technology, as well as a beginner, means you've got to give up so mu…

It's completely Optional safeguards. Add long as it's optional, I advocate for having as many of those as people can imagine

Re: Tcl 9.0

#133
post #6

Earlier quoted context omitted.

Tcl Improvement Proposal (TIP) 602[0]. [0] https://core.tcl-lang.org/tips/doc/trunk/tip/602.md

One example from the document: > Consider the naive attempt to clean out the /tmp directory. > cd /tmp > foreach f [glob *] {file delete -force $f} > A file ~ or ~user maliciously placed in /tmp will have rather unfortunate consequences.

I once created a file named *. Sweats were sweated that day.

Re: Tcl 9.0

#134
post #8

The only time I’ve dealt with Tcl in recent memory was for some MacPorts portfile stuff. Anybody using it for something else and can speak to why you’d use it today? Genuinely curious; I don’t hate the language but can never bring myself to enjoy it either.

Some time ago i was playing with a Raspberry Pi and wanted to write some code in there. The Gtk3-powered Geany was WAY too slow (like, type and wait for the letter to appear slow). I recompiled it to use Gtk2, it was much faster but also it was buggy (the code display was getting messed up).

Nedit (based on Motif) on the other hand was both very fast (faster than the Gtk2 Geany) and bug-free - it worked perfectly. But i wanted Geany because of the file browser sidebar.

So i wrote a small Tcl/Tk script to display a list of files using a filter in a directory and call Nedit to edit them when you doubleclicked. Also added a few buttons to call make, make clean, open a terminal, make a new file, etc and worked perfectly.

A few years since then i made a few improvements and modifications to this script and use it on my main PC whenever i want to work on C source code - though i use Krita instead of Nedit here (Krita has its own file browser sidebar but i find the way it works annoying - and doesn't have all the extra stuff i've added over time to the script).

The neat bit is that it reads a Tcl file from the home directory for "global" configuration (e.g. which editor to use, how to run terminal commands, etc) and then a Tcl file from the current directory for project-specific stuff, all of which having access to the main script's own procs for things like calling terminal commands, showing a few dialogs, etc.

I've uploaded the latest version of the script to my website a few days ago[0]. I've been mainly using it with Linux but a couple of years ago i also used it a bit with Windows using MSYS2 (with Notepad++ for the editor) and worked fine.

There is a screenshot on the site.

[0] http://runtimeterror.com/tools/projfiles/

Re: Tcl 9.0

#135
Why are they still on SourceForge? To me, SourceForge feels like one of those scammy download sites that installs spyware.

Re: Tcl 9.0

#136
It would be nice if the releases were cryptographically signed. I've never used Tcl/Tk before but I just downloaded the 9.0 release and I'll give it a go.

Re: Tcl 9.0

#137
post #122
post #95

Earlier quoted context omitted.

My main safety habit is to avoid slashless paths. Bad: rm * Okay: rm ./* rm /tmp/d/* rm */deadmeat rm d/* Then again, I commonly use dangerous things like `mv somefile{,.away}` that are easy to get wrong, so maybe don't trust my advice too much.

My safety technique is to echo the commands before I do the actual commands as a sanity check, e.g. for i in $(find something); do echo "rm -f $i"; done (bash example as my TCL is rusty)

Change your do block to `printf %q\ rm -f "$i" ; echo` and it won't lie about spaces. In case HN has "trimmed" my post in some way, as it often does, that's: percent q backslash space space. Works in bash/zsh, but not dash, probably not whatever your sh is. Can make a function of it trivially, but you have to handle the $# -eq 0 case, return whatever printf returns, etc.

Re: Tcl 9.0

#138
post #123
post #65

Earlier quoted context omitted.

i once managed to create a directory named ~ using the mirror tool written in perl. then i naively tried to remove it using "rm -r ~" and started wondering why removing an empty directory would take so long, until it dawned on me... i learned a few new habits since then. i almost never use rm -r and i avoid "*" as a glob by itself. instead i always try to qualify "*" with a path, remove files first: "rm dir/*"; and t…

When deleting, if it is more than a few specifically named files I will use a "find ... -delete" invocation. I like it for two reasons. Find feels like it has more solidly defined patterns and recursion than shell globing and by leaving off the "-delete" it give me a chance to inspect the results before committing to my actions.

Without testing, I wonder if find follows symlinks. I’m pretty sure rm doesn’t.

Edit: Just checked and find doesn’t by default.

Re: Tcl 9.0

#140

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.

The Zip filesystem stuff is wonderful change to see: it takes a number of techniques that were common in the community (if you had the right tools and knew how to use them) for building standalone applications, and makes them part of the basic toolkit in a standard way. It's a truly excellent change, and I'm glad to see it.

Can you explain what zip filesystem is?
Post reply on HN