#99 More convenient Updoc self-reference

feature_request
open
Updoc (25)
1
2005-06-01
2005-06-01
Steve Jenson
No

At
http://www.eros-os.org/pipermail/e-lang/2004-August/009967.html
Kevin Reid writes:

Proposal: In updoc execution, the name 'updoc' is bound
to an object
which (perhaps among other things) allows loading of
the non-Updoc
source of the file being examined:

def demo() {
return "Hi!"
}

? def demo := updoc.importThis()
# value: <demo>

? demo()
# value: "Hi!"

This would allow individual .emakers to include tests
for themselves
without needing to know their package.

Importing adjacent .emakers might also be useful. Assuming
'demo2.emaker' is in the same directory:

? def demo2 := updoc.importSibling("demo2")
# value: <demo2>

? demo2(demo)
# ...

Or perhaps:

? def demo2 := <import: updoc::thisPackage + ".demo2">

Discussion