texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] New "content" glue type


From: David Allouche
Subject: Re: [Texmacs-dev] New "content" glue type
Date: Thu, 20 May 2004 14:51:36 +0200
User-agent: Mutt/1.5.5.1+cvs20040105i

On Thu, May 20, 2004 at 11:04:21AM +0200, Joris van der Hoeven wrote:
> On Wed, 19 May 2004, David Allouche wrote:
> > The code of "scm_to_content" implies that scheme objects whose root is a
> > s-exp but which contain "tree" objects are acceptable "content" values.
> > Is that officially supported? Is it allowed, for example, to do:
> >
> >     (tm-assign p `(fold ,(tree-ref t 0) ,(tree-ref t1)))
> >
> > instead of:
> >
> >     (tm-assign p (tree2 'fold (tree-ref t 0) (tree-ref t 1))) ?
> 
> Absolutely, yes. The idea is that the 'content' data type is not
> only an abstraction for tree and stree, but actually more than that:
> an instance of the type 'content' is an stree in which any node
> may be replaced by a TeXmacs tree.

Good to know. That gives an opportunity to remove a lot of needless
verbosity and expensive conversions from document processing code.

> Notice that one still has to be a bit careful when using
> tm-assign etc.: we do not make any copies of TeXmacs trees,
> so you may get problems when assigning two different locations with
> the same tree. A more elaborate interface will be developed later,
> but at least we have a more solid C++ basis now.

Very good to know. For performance reasons I do not think it would be
good to just mindlessly copy everything just to be safe, but we have to
know what is allowed and what is not.

So, "inserting the same tree object at different locations in a document
through tree-set or editor operations is not allowed", and "trees are
copied when the traverse the glue in the C++->Scheme direction, but not
in the Scheme->C++ direction". Is that correct?  Are there other gotchas
to be aware of?

-- 
                                                            -- ddaa




reply via email to

[Prev in Thread] Current Thread [Next in Thread]