Tcl/Tk (31)

1 Name: #!/usr/bin/anonymous : 2008-08-24 01:33 ID:LD6S4lTz This thread was merged from the former /code/ board. You can view the archive here.

Tcl is one of the most underrated computer languages today.

It has a weird syntax, but on the other hand the syntax makes it more extensible than any other language besides the Lisp family.

Tk is reputed for it's antique-looking widgets. However with the latest 8.5 releast TTk, Themeable Tk is the default which means native look on Vista, XP, OSX. (Not Linux though, but what can you call native there anyway?)

So if you don't know Tcl yet, go and learn it. It's extremely simple, has an interactive shell, and will expand your mind... much more than learning most other languages!!

Tcl/Tk rocks!

See http://www.tcl.tk/

2 Name: #!/usr/bin/anonymous : 2008-08-24 01:40 ID:Heaven

>>1

Most of us call gtk native. At least some of us would wall qt native.

Native is meaningless anyway; TTk doesn't "work" like Windows, like MacOSX, nor like modern Linux desktops.

3 Name: #!/usr/bin/anonymous : 2008-08-24 02:14 ID:LD6S4lTz

>>2
It would be great to have Gtk+ and Qt auto-detection and runtime Tk theme switch for them too. I think something is in the works.

And a portable GUI toolkit can never work exactly like a single OS's native toolkit because then it won't be portable.

But what do you mean specifically it doesn't "work" like X or Y?

4 Name: #!/usr/bin/anonymous : 2008-08-24 03:54 ID:Heaven

>>3
Real GUI platforms have lots of intricate and useful behaviors that are consistent across all apps. Deviating from this degrades the user experience and greatly impacts productivity. A few copied graphics aren't going to convince anyone that it's more than a third-rate hack job.

5 Name: #!/usr/bin/anonymous : 2008-08-24 06:33 ID:LD6S4lTz

It's not copied graphics but the widgets are painted with the native APIs, and why is Tk a hack job?

What are these behaviours where Tk actually deviates from native toolkits?

6 Name: #!/usr/bin/anonymous : 2008-08-24 14:26 ID:JyEMoolk

>>5

Extensible file open dialogs, with preview box- say for an image editor, won't work the same.

On a Mac, you can't stack a window between two windows of another application.

Mac dialog and window sizing is based on some scaling element so higher resolution has windows being the same size.

There are lots of differences between systems that there's no way Tk could wrap them up...

7 Name: #!/usr/bin/anonymous : 2008-08-25 05:31 ID:Heaven

Tcl is a joke.

8 Name: #!/usr/bin/anonymous : 2008-08-25 14:08 ID:LD6S4lTz

>>7 Doesn't know Tcl

9 Name: #!/usr/bin/anonymous : 2008-08-25 14:23 ID:Heaven

Tcl is the punchline, the joke goes: "What has four legs and flies?"

11 Name: #!/usr/bin/anonymous : 2008-08-25 18:44 ID:Heaven

>>10

Wow.

Stallman is sensible sometimes?

12 Name: #!/usr/bin/anonymous : 2008-08-28 01:43 ID:Heaven

Python has a peculiar syntax that appeals to hackers because of its
simplicity. But Python syntax seems strange to most users. If Python does
become the "standard scripting language", users will curse it for
years--the way people curse Fortran, MSDOS, Unix shell syntax, and
other de facto standards they feel stuck with.

13 Name: #!/usr/bin/anonymous : 2008-08-28 11:48 ID:Heaven

>>12

What syntax do you think appeals to users?

14 Name: #!/usr/bin/anonymous : 2008-08-28 13:03 ID:Heaven

> But Python syntax seems strange to most users.

Who are these "most users"? C programmers? Unix sysadmins who end up writing a few lines of code every once in a while? Or the casual computer users who occasionally dabble in some sort of programming (e.g. as an extension language to some game) solely for entertainment purposes? Whether or not Python, and any language, for that matter, seems "strange" is fully dependent on the languages that person is already familiar with -- if any. For someone who hasn't ever programmed before, of course any programming language will seem a bit difficult to get the hang of, but the ones that translate easiest from English (such as BASIC, Python, Applescript, Lua, perhaps Tcl) will generally be easiest to pick up on, and those with a less immediately readable syntax (for example, C, Haskell, Lisp, or god forbid, APL) will be somewhat more difficult.

The only people I see cursing Python's syntax are those who seem to think lambdas are restricted because they can't have statements (get over it, you can do anything with lambda that you can do with a def, trust me) or who have some hangup about the indentation (because they don't indent?)
People criticize Tcl mostly because it's slow as molasses -- although I must admit it has greatly improved in the last several years -- and that it is a particularly restrictive and difficult language for creating anything with any level of complexity. Projects using Tcl quickly become unpleasant and needlessly complicated.

15 Name: #!/usr/bin/anonymous : 2008-08-28 14:26 ID:Heaven

>>14

> The only people I see cursing Python's syntax are those who seem to think lambdas are restricted because they can't have statements (get over it, you can do anything with lambda that you can do with a def, trust me)

Why should I trust you?

You think the only complaint about Python's syntax is having two different languages (one of statements and one of expressions), and having to know each one in order to write code a certain way.

Why should I trust you?

You've never seen anyone complain about connecting assignment and lexical scope. You've never seen anyone complain about extra [0] and creating extra references, making many algorithms ugly.

Why should I trust you?

You've never heard of someone complaining that using newline as a statement terminator means you have extra parenthesis! You've never heard of someone complaining that Python has too many parenthesis.

Why should I trust you?

You clearly don't get out very much, and think there are no legitimate complaints about Python. You think Python has the most perfect syntax, for every occasion.

Why should I trust you?

16 Name: dmpk2k!hinhT6kz2E : 2008-08-28 19:17 ID:Heaven

> Python has a peculiar syntax that appeals to hackers because of its simplicity.

Compared to what?

http://svn.python.org/view/*checkout*/python/trunk/Grammar/Grammar?rev=65872

That's not particularly simple.

17 Name: #!/usr/bin/anonymous : 2008-08-29 11:27 ID:Heaven

>>15
Jeez, you're bitchy. I take back my previous statement. Take some Midol.

18 Name: #!/usr/bin/anonymous : 2008-08-29 21:18 ID:Heaven

>>17

Well fuck you too.

You want to dump on my favorite language? I'll dump on yours.

Lisp is more readable than python. It has fewer parenthesis, and is easier to post/copy/paste into forums with fewer mistakes.

19 Name: #!/usr/bin/anonymous : 2008-08-30 00:08 ID:Heaven

>>18
Who the hell said it was my favorite language, and where did you ever read in my post that I didn't like lisp?

Get off the internet.

20 Name: #!/usr/bin/anonymous : 2008-08-30 23:51 ID:Heaven

> those with a less immediately readable syntax (for example, C, Haskell, Lisp, or god forbid, APL)

Lisp's syntax is far more readable than Python.

21 Name: #!/usr/bin/anonymous : 2008-08-31 03:58 ID:Heaven

>>20
I said immediately. Try explaining a cdr or progn to a non-programmer, both which are very prevalent in lisp. What common Python idioms are likely to pose a problem for a new programmer?
Serious question. I've tried teaching people Python and Lisp both. Of those, Python is far, far easier for the average person to grasp. Not to mention it forces good indentation habits, but that's again a different story.

Once again trying to bring this thread back on topic, Tcl is kind of in the middle. It's fairly easy to teach to people that have at least a basic understanding of programming, but I imagine the complete non-coder would have a difficult time understanding the idiosyncrasies (e.g. the -switches for commands)

22 Name: #!/usr/bin/anonymous : 2008-08-31 20:36 ID:Heaven

> Try explaining a cdr or progn to a non-programmer, both which are very prevalent in lisp.

They're just words. All the words that are in lisp, are in this book: http://l1sp.org/cl/ or you can learn about them by typing:

(describe 'WORD)
> What common Python idioms are likely to pose a problem for a new programmer?

It all seems problematic for a new programmer. Explaining why sometimes you use [] lists and sometimes you use () tuples. Explaining why print isn't a method is also problematic. Explaining why they check __name__ also seems to cause problems. Operator-order is also difficult; explaining why they sometimes read a statement right-to-left, and other times from left-to-right seems problematic.

Someone who is familiar with some algol-like syntax such as is seen in a shell or in another language will have a completely different set of problems- the if, postfix-if, yield, self, and so on.

Nevertheless, this is a point of readability; Lisp has fewer rules and corner-cases, so we tend to have an easier time teaching people how to read it.

> Serious question. I've tried teaching people Python and Lisp both. Of those, Python is far, far easier for the average person to grasp.

So if I teach then Python and Lisp, and I say they learn Lisp easier, does that make me a better teacher? I think it's probably more likely you're trying to measure something other than readability.

I've noticed that users and programmers who have some background with something algol-like seem to have an easy time reading Python. I've noticed people with no programming experience, and little to no background with anything algol-like have an easier time reading Lisp. Writing Lisp too.

We make an application that uses Lisp as it's data structure. We have advertising executives write these data files- they're really Lisp code, we just don't tell them they're programming. I cannot imagine them writing Python as easily...

My daughter can read and write Lisp, but cannot use Python. She's six, and is delighted when the computer tells her jokes back to her.

> Once again trying to bring this thread back on topic, Tcl is kind of in the middle. It's fairly easy to teach to people that have at least a basic understanding of programming, but I imagine the complete non-coder would have a difficult time understanding the idiosyncrasies (e.g. the -switches for commands)

TCL is horrible to read. It has even more corner cases and a confusing syntax than even Python. It's almost as hard to read as Perl, but without any of the Power.

I suppose if you're wearing the Algol helmet and blinders, TCL seems like it is a reasonable choice. TCL is shit. The worst kind of shit: The kind other people swear they like to eat.

23 Post deleted.

24 Name: #!/usr/bin/anonymous : 2008-09-01 18:16 ID:Heaven

>>23
Caution: Pyfag.

25 Post deleted.

26 Name: #!/usr/bin/anonymous : 2015-06-09 19:01 ID:jS+wSCdP

It seems Tk is considered less-harmful by the cat-v folks (http://harmful.cat-v.org/software)

27 Name: #!/usr/bin/anonymous : 2015-06-12 12:42 ID:4ddVi+vB

Hmm, I did some Perl/Tk stuff back in 2004 or so, and the widgets seemed pretty damn close to Win95/NT/2000 style on those platforms. Not exactly identical to straight Win32, but close enough. Now, the X11 widgets (same exact Perl/Tk program running in Linux or BSD) had that unique "Tk" look - kind of frugal/archaic, and kind of charming at the same time, IMO (mind you, I actually *like plain, flat Athena widgets also).

Never really got into Tcl itself though, except for tweaking some ircII scripts back in the day (mostly bots). Seemed like the Tcl/Tk stuff is less buggy than the Tk stuff ported to Perl though. Also writing Tcl/Tk code seems less verbose than Perl equivalent.

I don't know why there is always so much Python comparisons everywhere. Do they have something to prove? Those guys used to invade the comp.lang.perl.misc and related newsgroups a decade ago and constantly talk trash. If that language is was great, it would stand up on its own and not need all this stupid in-your-face advocacy. Because of those incessant antics, Python will always turn me off.

28 Post deleted.

29 Post deleted.

30 Name: #!/usr/bin/anonymous : 2015-06-18 13:13 ID:4ddVi+vB

Hey I totally forgot that sometimes I use Expect to automate stuff (like logging into remote shell accounts that require a password rather than SSH key). And well, it's all based on Tcl...

31 Post deleted.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification: