Oh.
I thought one of the major reasons for clones was to be able to
"boiler plate" common content across many files. Examples might
include copyright notices, written by _____, code functions that get
re-used a lot and so on.
Is this an incorrect, or at least inadvisable, use of clones?
--
-matt
> I thought one of the major reasons for clones was to be able to
> "boiler plate" common content across many files. Examples might
> include copyright notices, written by _____, code functions that get
> re-used a lot and so on.
>
> Is this an incorrect, or at least inadvisable, use of clones?
I think it's a use of clones that forces you to deal with rules about
what's safe and what's not safe which are easy to forget or get wrong.
This is the same point Edward hit on recently:
http://groups.google.com/group/leo-editor/msg/12b9531a9b3025bb
Most programming languages have import / include mechanisms for
referencing common code. Ditto document generation systems like LaTeX,
DocBook, and rst. There are numerous templating systems for handling
repetition in HTML and similar outputs. Those are safe, DRY compliant
ways of addressing these needs.
*But* they all require specific knowledge - by appearing to offer a
generic solution to these needs which works for multiple output types
(code, HTML, rst, etc.) Leo's clones are very appealing. However I
don't think (Edward?) that was what they were designed / intended for.
Rather, they're intended to provide views / collections / bookmarks of
currently interesting parts of files. Personally I think UNLs are a
safer way of doing that, but clones do it very nicely, as long as you
don't break the rules.
That's where I think these issues about what clones do is coming from.
Perhaps Leo could offer some kind of generic solution by providing some
sort of templating system which could be applied to any text file
output. But it would still require a distinction between source files
and output, or built, files. Kind of cross-file section references.
Cheers -Terry
> P.S. In your particular situation, I would suggest, if at all possible, that you make complete external files, rather than clones, to be the "units of sharing". That way there is only one copy of the data, so if you change that data outside of Leo all clones of (parts of) that data will be in synch the next time you open Leo.
Oh.
I thought one of the major reasons for clones was to be able to
"boiler plate" common content across many files. Examples might
include copyright notices, written by _____, code functions that get
re-used a lot and so on.Is this an incorrect, or at least inadvisable, use of clones?
> I honestly think the lack of a clear statement on this topic in the docs is
> dangerous for relative newcomers to Leo and threatens its acceptance as a
> data-safe working environment.
Yes, some more words in the docs would be helpful, but the bottom line
is that we can't assume that people will read documentation. There is
no substitute for being aware of the multiple-update problem. I think
it's fair to assume that programmers are aware of that problem.
Edward
>> > I honestly think the lack of a clear statement on this topic in the docs dangerous for relative newcomers to Leo and threatens its acceptance as a data-safe working environment.
The post "All about clone conflicts" is my response. Imo, the only
thing dangerous about Leo is deliberately ignoring Leo's warnings.
> IMO a better solution would be some type of mechanism in Leo that allowed the user to specify explicitly which branch of the outline should be considered the canonical one.
As I said in "All about clone conflicts", this is never going to
happen. Leo's read code is already too complex. Trying to guess what
the user wants will make it much more complex, and therefore less
reliable and more difficult to explain.
Put it another way, there *already is* a way to specify explicitly
which branch of the outline is the "canonical" branch: it's the last
branch in the outline that contains the clone.
Edward