|
 |
hi,
clipka <ano### [at] anonymous org> wrote:
> 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.
replace the parentheses with whitespace and you have two complete (well-formed,
I'd say) commands. still, weird.
> >> 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.
s/is/was/ :-)
byte-compiles. quite a number of years now.
> Tk is a library
> originally written for Tcl.
yes.
> 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.
have not done this myself but expect it to be a straightforward as using Tcl.
(after all, developed by the same people)
> >> 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.
nor an uncommon view, I guess. the simple syntax certainly leads some to
equate that with simple language.
regards, jr.
Post a reply to this message
|
 |