comp.lang.ada
 help / color / mirror / Atom feed
* thick Tcl binding, am I being logical ?
@ 2014-01-13 23:03 Patrick
  2014-01-14 17:43 ` Simon Wright
  0 siblings, 1 reply; 5+ messages in thread
From: Patrick @ 2014-01-13 23:03 UTC (permalink / raw)


Hi Everyone

I was tinkering with Tash again today. 

It has code like this:
Tcl.Tk.Ada.Pack (Counter, "-side bottom -fill both");

This calls the geometry manger to control the layout of the widget Counter.

In pure Tcl it is:
pack .counter -side bottom -fill both

Tash is about 20K lines of code(in the src dir). There are some examples and it's not a bad project or anything. It's just that since Tcl/Tk changed it's API, it's a pretty thin binding.

I was wondering if it would be logical to create a thick binding to Tcl only and feed in Tcl strings to display Tk widgets rather then trying to bind the Tk code as well.

I frequently go on coding suicide missions, Am I on another? Does this sound logical?

Thanks-Patrick


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: thick Tcl binding, am I being logical ?
  2014-01-13 23:03 thick Tcl binding, am I being logical ? Patrick
@ 2014-01-14 17:43 ` Simon Wright
  2014-01-16  1:33   ` Patrick
  2014-01-16 12:30   ` Simon Wright
  0 siblings, 2 replies; 5+ messages in thread
From: Simon Wright @ 2014-01-14 17:43 UTC (permalink / raw)


Patrick <patrick@spellingbeewinnars.org> writes:

> I was tinkering with Tash again today. 

That's http://sourceforge.net/projects/tcladashell/. Thanks for your
interest.

> It has code like this:
> Tcl.Tk.Ada.Pack (Counter, "-side bottom -fill both");
>
> This calls the geometry manger to control the layout of the widget
> Counter.
>
> In pure Tcl it is:
> pack .counter -side bottom -fill both
>
> Tash is about 20K lines of code(in the src dir). There are some
> examples and it's not a bad project or anything. It's just that since
> Tcl/Tk changed it's API, it's a pretty thin binding.

But don't you think that most of the facilities lost with the API change
are things that (for an Ada program) are better got via Ada.Containers,
Ada.Directories etc?

> I was wondering if it would be logical to create a thick binding to
> Tcl only and feed in Tcl strings to display Tk widgets rather then
> trying to bind the Tk code as well.
>
> I frequently go on coding suicide missions, Am I on another? Does this
> sound logical?

I'm not quite sure what your intention is. To quote from my response to
bug #5,

   "Personally I've always thought the best reason for using TASH is to
   allow a Tcl interface to an Ada program; especially since Ada2005,
   why bother to use imported Tcl facilities in Ada? Of course, you'd
   only need a tiny subset of TASH to do that, and TASH is what it is."

so I'd write the graphical part of the application (view, controller) in
Tcl/Tk and do the model in Ada.

The only problem I've come across with this style is how to manage
changes in the model that need to be reflected in the view; polling
certainly works but seems less than ideal. Maybe Tcl_Eval and variable
tracing would do the trick.

Of course, Rapid (http://savannah.nongnu.org/projects/rapid/) is a
counter-example!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: thick Tcl binding, am I being logical ?
  2014-01-14 17:43 ` Simon Wright
@ 2014-01-16  1:33   ` Patrick
  2014-01-16 12:30   ` Simon Wright
  1 sibling, 0 replies; 5+ messages in thread
From: Patrick @ 2014-01-16  1:33 UTC (permalink / raw)


Hi Simon

I was hoping you would respond, you have been very helpful in the past.

Thanks for the MVC tips :)

Have a great day-Patrick

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: thick Tcl binding, am I being logical ?
  2014-01-14 17:43 ` Simon Wright
  2014-01-16  1:33   ` Patrick
@ 2014-01-16 12:30   ` Simon Wright
  2014-01-19 17:56     ` Simon Wright
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Wright @ 2014-01-16 12:30 UTC (permalink / raw)


Simon Wright <simon@pushface.org> writes:

> The only problem I've come across with this style is how to manage
> changes in the model that need to be reflected in the view; polling
> certainly works but seems less than ideal. Maybe Tcl_Eval and variable
> tracing would do the trick.

Variable tracing works fine, with Tcl_SetVar(). I've added a demo to
Tash at r162, see also at Dropbox[1].

Note, this demo is syntactically correct, but I'm concerned that it's
synchronous, whereas the only sensible use case is asynchronous (the Ada
model generates a new value in response to an input of which Tcl is
unaware). More thought needed.

[1] https://www.dropbox.com/s/nn8qkcbp3z30zcj/watching.tar.gz


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: thick Tcl binding, am I being logical ?
  2014-01-16 12:30   ` Simon Wright
@ 2014-01-19 17:56     ` Simon Wright
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Wright @ 2014-01-19 17:56 UTC (permalink / raw)


Simon Wright <simon@pushface.org> writes:

> Simon Wright <simon@pushface.org> writes:
>
>> The only problem I've come across with this style is how to manage
>> changes in the model that need to be reflected in the view; polling
>> certainly works but seems less than ideal. Maybe Tcl_Eval and variable
>> tracing would do the trick.
>
> Variable tracing works fine, with Tcl_SetVar(). I've added a demo to
> Tash at r162, see also at Dropbox[1].
>
> Note, this demo is syntactically correct, but I'm concerned that it's
> synchronous, whereas the only sensible use case is asynchronous (the Ada
> model generates a new value in response to an input of which Tcl is
> unaware). More thought needed.

Yes, it was much more complicated than I'd thought.

> [1] https://www.dropbox.com/s/nn8qkcbp3z30zcj/watching.tar.gz

I've deleted this, in favour of tash-8.6-1-20140118.zip at Sourceforge.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-19 17:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-13 23:03 thick Tcl binding, am I being logical ? Patrick
2014-01-14 17:43 ` Simon Wright
2014-01-16  1:33   ` Patrick
2014-01-16 12:30   ` Simon Wright
2014-01-19 17:56     ` Simon Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox