[REBOL] Leo => #@-others
From: jason::cunliffe::verizon::net at: 20-Sep-2002 9:21
These past couple days I am exploring an incredible meta-programming called
'Leo'. Meta-programming because it lets you program how programs are built. It
lets you have different views onto the same content and its easy to combine
source code with any other kind of information, such as notes, docs,
correspondence, ideas..
Its written in Python and is free, openSource like most Python packages.
It's based on Donald Knuth's 'Literate Programming' ideas.
Leo is aimed at improving the organization and control of complex software
programming projects. It does this via a deceptively simple idea-outliner tree
structure interface. Leo uses special embedded symbols to connect and assign the
import and export of its contents. Meta-publishing via meta-tags. It also
exposes the entire engine underneath to a Python API. You can pop open shell and
hack away. Leo files are structure trees saved as XML. I have just been poking
around Leo's XML files with Gavin's xml-object. [thanks!]
and also writing rebol inside of Leo.
Leo is fascinating and makes one think of all kinds of other uses too. I think
many of you here would enjoy to experiment with it, if/when you find time.
There's also intriguing potential for a rather different rebolutionary version,
as well as using Leo with Rebol. Leo embeds special tags which ordinarily might
get in the way, but rebol is forgiving as you know. Thus Leo's header tags a
ignored because of Rebol's outermost wrapper block. yay!
and then curiously the magical in-line inserts Leo uses to place content from
elsewhere in its tree also proves harmless..
What am I talking about you ask//?
Within the main Leo tree outline is a node for my rebol script:
-overview
@file leotest.r
notes
story
ideas
etc
The contents of my rebol node looks like this:
@file leotest2.r
[
REBOL[]
print ["hello from leotest.r"]
@others
]
The 'notes' node contains:
notes: {What are the rule for where these have to be?}
and the 'story' node contains:
story: {This is a story about love and truth and beauty}
@file means when I 'save' the whole structure, Leo writes to the file named
leotest.r
@others means include the contents of any nodes below here.
Saving produces the final "leotest.r" script
--------------------------------------------
#@+leo
#@+node:0::@file leotest2.r
#@+body
#@@file leotest2.r
[
REBOL[]
print ["hello from leotest2.r"]
#@+others
#@+node:1:C=1:notes
#@+body
notes: {What are the rule for where these have to be?}
#@-body
#@-node:1:C=1:notes
#@+node:2::story
#@+body
story: {This is a story about love and truth and beauty}
#@-body
#@-node:2::story
#@-others
]
#@-body
#@-node:0::@file leotest2.r
#@-leo
This an extremely trivial example. But it demonstrates how one can organize
content in a completely different way and then merge them very easily. Lo, when
I open REBOL to run my script I get this:
>> do %leotest2.r
hello from leotest2.r
== #@-others
>> notes
== "What are the rule for where these have to be?"
>> story
== "This is a story about love and truth and beauty"
REBOL just ignores all Leo's meta-junk. Firstly because it's outside the main
block, then because of this:
>> type? #@-others
== email!
That's good news. Leo lets you import and export in clever ways. In many
respects REBOL does not need such as tool because REBOL code is so much shorted
and easier to understand.. or is it. I only know about very small utilities.
I've not built anything big yet. Though I'd like too.
I hope some of you do get a chance to pay with this. There is a very remarkable
set of ideas here, some of which may find their own rebolistic uses. Especially
if one combines implicit rebol messaging, and retunes the application towards
collaborative business scenarios, workflow needs etc.
HOME PAGE
http://personalpages.tds.net/~edream/front.html
RAVES
http://personalpages.tds.net/~edream/testimonials.html#anchor104391
TUTORIAL
http://www.evisa.com/e/sbooks/leo/sbframetoc_ie.htm
USERS GUIDE
http://personalpages.tds.net/~edream/leo_TOC.html#anchor964914
API
http://personalpages.tds.net/~edream/scripting.html#anchor612831
./Jason