POV-Ray : Newsgroups : povray.unix : X Windows display: disabled : Re: X Windows display: disabled Server Time
26 Apr 2024 01:36:35 EDT (-0400)
  Re: X Windows display: disabled  
From: clipka
Date: 13 Oct 2018 15:19:11
Message: <5bc2452f$1@news.povray.org>
Am 13.10.2018 um 19:01 schrieb jr:

>> The Tcl syntax is /very/ different from common C/C++, and to achieve
>> this feat they used some features of the C++ language in manners that
>> would make every sane C++ programmer's skin crawl.
> 
> and it does not make sense (to me, at any rate).  the whole "idea" is either of
> two deployment scenarios:
> a) you have some kind of interpreter/shell and provide applications as scripts,
> perhaps supported by custom shared libs.
> b) you integrate one or more interpreters in your own, usually C, code, and
> provide part(s) of the application functionality as scripts (built-ins or user
> supplied, whatever).

Well, interfacing C++ to Tk (the library providing the GUI widgets)
isn't so stupid. Might be an easy way to create a portable GUI. (Though
I guess more modern frameworks like Qt make it even easier.)

Shoehorning the Tcl syntax into C++, now that's pure madness of
Lovecraftian proportions, as we apparently both agree.

But it's fascinating that they get away without a parser. Presumably,
stuff like

    button(".b") -text("Say Hello") -command(hello);
    pack(".b") -padx(20) -pady(6);

works because they co-opt the arithmetic operator `-` for a totally
different purpose that has nothing to do with arithmetics at all.

>> I didn't even know C bindings for Tk existed; maybe they are more
>> faithful to the target language.
> 
> it's how it (Tcl) started.  as a C library to provide a "tool control language",
> to drive other command-line apps.  Tk was (so I read) an effort to build on
> Apple's HyperCard concept(s) but constrained by need to be modular.

Don't confuse the two. Tcl is an iterpreted language. Tk is a library
originally written for Tcl.

When I say C bindings for Tk, I mean a direct interface from C to the Tk
library, without having to use the Tcl interpreter as an intermediate layer.


>> I'm not sure how Tcl as a component in a C program would look like.
>> After all, last time I checked, Tcl is a language, not a library.
> 
> a really sharp language lawyer might argue it isn't even a language - as such,
> more a set of (12) rules for parsing + substituting strings (EIAS =="everything
> is a string").  Tcl has no reserved "keywords", any and all commands can be
> renamed (or deleted).
> 
> (as an analogy, think of each Tcl command as a separate "program", each taking
> one or more argument "words" and returning one result (perhaps empty))

That's what I always do. To me, Tcl is a shell-ish scripting language.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.