Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #19517

Re: Tcl Forth + TclForth !

From mhx@iae.nl (Marcel Hendrix)
Subject Re: Tcl Forth + TclForth !
Newsgroups comp.lang.forth
Message-ID <17831597018434@frunobulax.edu> (permalink)
Date 2013-02-06 20:52 +0200
References <02899101018434@frunobulax.edu>
Organization Wanadoo

Show all headers | View raw


Wolf Wejgaard <wejgaard@gmail.com> writes Re: Tcl Forth + TclForth !

> Am Samstag, 2. Februar 2013 11:14:01 UTC+1 schrieb Marcel Hendrix:

>> Wolf Wejgaard <wejg...@gmail.com> write Re: Tcl Forth + TclForth !
[..]
>> But Tcl is so terribly verbose!
[..] 
> Ok, good idea! Let's me test TclForth on a foreign project and maybe clarify a few points.
>
> I first started with comments to your code and how I would do it in TclForth, but then saw
> that this needs a full working version in order to make sense. 

> So here is a TclForth version of your program. Please copy it to a file with extension .fth 
> in the TclForth source directory and load it via the File menu in the TclForth console. 

> I add comments below. Only one point is needed now: The Forth words coexist with Tcl in 
> the codespace, therefore the pipe mechanism reduces to a call.

I have to say that the communication became a lot simpler!

However, I see now that I can temporarily revector TYPE to get rid of converting everything 
to strings explicitly. TYPE can then type to a send/receive loop in a background task.
Old Tcl's did not like this, they (or Windows) somehow got confused when a thread manipulates
stdio via pipes.

I would still miss the variables that are visible to both Tcl and Forth. However, I can
CREATE DOES> a tcl-var that accepts any object using TO etc.

Looking at your translation of the WISH script: It is slightly simpler because of code words. 
But your code words simply send strings to TCL and I can fake that easily by redirecting ."  
(Of course, this is automatic when TYPE is revectored).

code .%e ( x -- ) printnl [format %e $x]

  then becomes

tcl: .%e ( x -- ) ." printnl [format %e $x]" ;tcl

Hmm, no I would need a "$-parser" in ." to handle $x. Not so simple, but also no rocket 
science.

From then on there isn't much difference anymore. Wish stays as verbose as ever.
OTOH, that is probably exactly what you wanted. (But not what I was hoping for.)

Thank you for this thought-provoking posting.

-marcel

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Tcl Forth + TclForth ! Wolf Wejgaard <wejgaard@gmail.com> - 2013-02-02 00:32 -0800
  Re: Tcl Forth + TclForth ! "A. K." <akk@nospam.org> - 2013-02-02 10:26 +0100
  Re: Tcl Forth + TclForth ! mhx@iae.nl (Marcel Hendrix) - 2013-02-02 12:14 +0200
    Re: Tcl Forth + TclForth ! Wolf Wejgaard <wejgaard@gmail.com> - 2013-02-05 02:15 -0800
    Re: Tcl Forth + TclForth ! mhx@iae.nl (Marcel Hendrix) - 2013-02-06 20:52 +0200
    Re: Tcl Forth + TclForth ! "WJ" <w_a_x_man@yahoo.com> - 2013-04-11 06:39 +0000
      Re: Tcl Forth + TclForth ! Richard Owlett <rowlett@pcnetinc.com> - 2013-04-11 05:12 -0500
  Re: Tcl Forth + TclForth ! "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2013-02-05 06:24 -0500
    Re: Tcl Forth + TclForth ! Brad Eckert <hwfwguy@gmail.com> - 2013-02-06 09:28 -0800
    Re: Tcl Forth + TclForth ! Wolf Wejgaard <wejgaard@gmail.com> - 2013-02-10 04:37 -0800
  Re: Tcl Forth + TclForth ! Eduardo Costa <edu500ac@gmail.com> - 2013-02-10 07:52 -0800

csiph-web