caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [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

* Re: [Caml-list] Seeking feedback on a project
       [not found]   ` <001401c34788$19f1b0a0$9600a8c0@maison>
@ 2003-07-11 17:06     ` Matt Gushee
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Gushee @ 2003-07-11 17:06 UTC (permalink / raw)
  To: caml-list

Uh-oh! Scope creep! Glad I'm not obligated to do this :-)

On Fri, Jul 11, 2003 at 10:40:36AM +0200, Benoît de boursetty wrote:
> One thing you should not forget if you start with this is support for
> autocompletion on tab... which is a primordial feature of today's CLIs.

Ouch. That had occurred to me too, but I wouldn't know how to do it. As
far as I know, OCaml has no built-in mechanism for processing raw
keystrokes.

> One of the things I would be tremendously looking forward to having is
> "typed autocompletion".

Yes, that would be nice. I think the hard part is implementing
tab-completion in the first place. If I can do that, it shouldn't be
much extra work to make it type- (or context-) sensitive.


> One random thought, please make it easy to use with Ocaml yacc/lex
> and or Camlp4.  -D

That sounds like a good idea, but could you be more specific about what
you mean?

-- 
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

end of thread, other threads:[~2003-07-11 17:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <D4DBD8568F05D511A1C20002A55C008C11AC05A4@uswaumsx03medge.med.ge.com>
2003-07-11  0:47 ` [Caml-list] Seeking feedback on a project Matt Gushee
     [not found]   ` <001401c34788$19f1b0a0$9600a8c0@maison>
2003-07-11 17:06     ` Matt Gushee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).