* [Caml-list] Seeking feedback on a project
@ 2003-07-11 0:47 ` Matt Gushee
[not found] ` <001401c34788$19f1b0a0$9600a8c0@maison>
0 siblings, 1 reply; 2+ messages in thread
From: Matt Gushee @ 2003-07-11 0:47 UTC (permalink / raw)
To: caml-list
I would like to hear your opinions about a project I have been working on
over the last few days.
The project is an OCaml library intended to provide a generic framework
for constructing interactive text-based programs. I see this as being
useful for applications such as configuration editors, expert system
shells, and data entry interfaces.
The way this came about is that I have been wanting such a library for
my own personal use for some time; and lately I have also been curious
about OCaml functors, but didn't quite understand how they worked. So it
occurred to me that it might be appropriate to code this library using
functors, and decided to go ahead and try it.
Now I've developed part of the library, and in so doing have
accomplished one goal: I now have a fairly good understanding of how
functors work. Meanwhile, it turns out that completing this project,
while not a huge undertaking, will be significantly more work than I
thought at first, so I'm wondering if I should really continue it.
I'd like to ask list members' opinions on the following:
* Would you find something like this library useful, or do you know
people who would?
* Is my approach (see below for more details) a sensible one? Are there
better ways to attack this problem in OCaml?
* Does a library of this sort already exist?
To help you answer the above questions, here's a little bit more
information:
The library (tentatively called ShellKit) provides a type of low-level
component called a "shell." The shell is the basic unit of interaction,
and it has the following characteristics:
- prints some text (usually a prompt, and depending on the type of
shell, possibly a menu or a brief description), then accepts user
input on STDIN.
- has a 'run' function whose signature is:
run : ?data -> unit -> result
where
type result = signal * string option
- has an associated data type
- has a function to validate the input
- can be supplied a default value
- in addition to handling a specific type of input, can have hooks for
special global commands such as "help" and "quit."
The basic process for creating a shell looks like:
configuration -> functor -> shell driver -> functor -> shell
Here's a concrete example:
module BShell = MkShell(
MkBooleanDriver(
struct
type t = bool
let help = None
let default = None
let prompt_msg = "Do you like ShellKit?"
let common = default_shell_options
end
)
);;
When you invoke BShell.run (), it produces a prompt like this:
Do you like ShellKit? [y/n] >
... then, of course, captures the user's input.
NOTE: If I continue this work, the final product will include structures
for assembling shells into programs, but so far those exist only in
skeleton form.
Anyway, thanks in advance for your comments.
--
Matt Gushee When a nation follows the Way,
Englewood, Colorado, USA Horses bear manure through
mgushee@havenrock.com its fields;
http://www.havenrock.com/ When a nation ignores the Way,
Horses bear soldiers through
its streets.
--Lao Tzu (Peter Merel, trans.)
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 2+ messages in thread