Re: Embedded Io Examination (Speed and Security)
Jan-Paul Bultmann <[email protected]>
| Newsgroups | gmane.comp.lang.io |
|---|---|
| Message-ID | <[email protected]> |
I settled on this:
Documentation := Object clone do(brief := "not provided"; usage := "not provided")
Object documentation := Documentation
Object doc := method(
documentation = Documentation clone
documentation doMessage(call message argAt(0))
getSlot("self")
)
Object getSlot("doc") doc(
brief = "The setter for the documentation, returns the Object documented."
usage = """foo := method(bar) doc("My great docu.")"""
)
Object doc(
brief = "The root of all Prototypes,provides base funcionality to build upon, like cloning and Slot management."
usage = """MyNewObject := Object clone do(foo := method(bar))"""
)
Object help := method(
docs := "About \"" .. self type .. "\"\n" .. self documentation brief .. "\n\n" .. "Slots:\n"
self foreachSlot(name, value,
desc := getSlot("value") documentation brief
docs = docs .. "\t" .. name .. ":\n\t\t" .. desc .. "\n\n"
)
docs print
) doc(
brief = "Generates information about the Object and all the Slots it owns."
usage = """MyObject help"""
)
you could implement something similar within minutes.
There was a discussion about this on the mailing list with the subject "Docstrings", which showed that embedding docs is really a matter of taste, and there are lots of ways to do it.
I choose it this way, because it has the least syntax mangling and feels (too me :)) relatively ioish.
Cheers Jan
On Jun 1, 2011, at 2:30 AM, Joshua Cearley wrote:
>
>
> On Tue, May 31, 2011 at 2:49 AM, Steve Dekorte <[email protected]> wrote:
> > - Embedding docs have become more sparse; is it still relatively
> > simple (albiet tedious) to embed? I have written a tool using Ragel
> > to scan over headers and make a tags file for methods/objects to be
> > exported, so I have quite a bit of tolerance for the needed
> > boilerplates.
>
> It's simple if you mean having a standard way of embedding docs such that you can extract them to html.
>
> Wrong kind of embedding ;) Using Io from inside another application has hit and miss docs; I know there used to be a basic page on how to do it but the last time I took a look in to using Io for scripting I ended up having to pull old documents out of the google cache and read through parts of the interpreter.
>
>