Subject: Re: More SWI questions

From: Jan Wielemaker <[email-masked]>
Date: Mon, 4 Feb 2002 21:56:31 +0100

Christophe,

> zoals verzocht voortaan in het Engels:

Mooi.

> Minor issue: would you consider adding the command proper_subset? SWI has
> list/1 and proper_list/1, after all.

If it complies to any standard, no problem.  Searching for
"proper_subset prolog" didn't give any answers though.  

> By mistake I recently created a list_browser with an uninstantiated dict
> as argument, SWI hung up on me. I could reproduce this.
> Shouldn't SWI (or PCE) raise an error in this case?

In theory yes.  I did the trivial test and it reported correctly, so
please send me something to reproduce.

> Is there or will there be support for tabs in PCE?

There is.  Have a look at the classes tab_stack and tab.  There should be
examples in the default applications.  It is quite simple though: tabs
behave as dialog windows, you add multiple to a tab_stack and the result
is a graphical you can display on a dialog or any other window.

> In case multiple objects of the same name are created and attached to, say, a
> frame: to get the reference for one of these objects, is setting
> current_no for its chain and get(Chain, current, Element)
> good style? In other words, is the chain guaranteed to contain elements
> in the same order as they were created in the initialise method?

Not really.  chains have methods to manipulate the order.  Frames don't
use this, but graphical devices manipulate this order to play with the
stacking-order (foreground...background).  Best way to locate windows
and graphicals in a device or frame is to give them unique names.

> Re unifying w/o occurs check: I'm just curious, how is the
> resulting term represented internally? How is printing of infinite objects
> implemented? It seems to me there must be a check for cyclicity somewhere

It isn't.  There is a depth-limit to printed terms (see the
option-list in write_term/[2,3]).  The toplevel uses this limit.

> in the printing routine(s). Doesn't that slow things down?
> Is it possible to have SWI raise errors for this kind of thing (other
> than using unify with occurs check)?

At the moment, no.  Cyclic terms can be created and to a certain extend
manipulated.  Some routines however run out of (stack-) space, others go
into an infinite loop as most internal term-manipulation does `last-argument'
optimisation, allowing it to handle terms extremely deeply nested on the
last argument.

	Cheers --- Jan