Its Me
11/13/2004 11:39:00 PM
I'm curious what the experts on this list might think of this.
My code falls into chunks. Some of those chunks correspond to methods,
classes, or modules. Many do not. For the ones that do not, I do something
like this (literally, or in my head)
module A
# classes about foo
class C1
# methods about bar
def m1 ...
def m2
def m3
# do stuff about baz
baz1
baz2
# do other stuff
other
end
end
end
The Leo editor, which supports outline-based programming with a tree of
nested sections + cross-tree references + some literate programming
features, got me thinking: Could Ruby help me with this chunking? Something
like this
module A
section foo
class C1
section bar begin
def m1
def m2
def m3
section baz begin
baz1
baz2
end
other
end
end
end
end
(note: the section "foo" within module A would be somewhat like a nested
module with an auto-include)
The names on sections could be optional. Even without names, and with
absolutely minimal language processing, my number of comments would be
reduced, scope would be language-demarcated, folding etc. would be simpler.
The cost would be some extra begin-ends or {}.
I could then easily see an outline-styled editor for writing my ruby code.
The names on sections, if provided, could be used for various things as
well. For example, you might simply reference a section on one place, but
define it elsewhere. This would extend a tree-based outline-style editor
into one more like Leo, allowing any sub-tree to be referenced from
elsewhere.
interesting?