著者: Hendrik Boom 日付: To: dng 題目: Re: [DNG] Tcl as a scripting language: 4/2/2025 7pm Eastern
Standard time
On Wed, Apr 02, 2025 at 11:32:07AM +0200, Didier Kryn wrote: > Le 01/04/2025 à 22:11, Steve Litt a écrit :
> > Didier Kryn said on Mon, 31 Mar 2025 14:41:37 +0200
> >
> >
> > > Instead, it is possible to invoque Tcl from within any program,
> > > for
> > > example an application written in C, while providing it with functions
> > > it can call to execute commands which belong to the application
> > > proper, making it a high-level steering function of the application.
> > > Of course it can also launch processes like the shell, but I don't
> > > think this is the most interesting.
> > This sounds very interesting. Could you please elaborate? Are you
> > talking about having C do a system("myprogram.tcl"), or something more
> > profound?
>
> AFAIR (this was long ago), the very Tcl intrepreter is a function
> your C program can call with, through the calling arguments, an access
> to C functions belonging to your application. There is, of course a
> specific Tcl API these C functions must match to, but this is all
> documented. The Tcl command you can invoque from the command-line is
> just a main program which calls this function.
>
> This very simple but extremely powerfull idea is the very strength
> of Tcl in my opinion, the weak point being the primitive and boring
> Basic-like syntax of the Tcl language. I just wonder why not all other
> interpreters offer the same feature -- IBM's Rexx was doing so.
This is also hoe Guile interacts with C programs.
And Guile is an implementation of Scheme -- a richer programming language.