[mercury-users] partial instantiation?

Tomas By tomas at basun.net
Tue Apr 20 16:31:50 AEST 2010


On Mon, April 19, 2010 23:24, Mark Brown wrote:
> Ah, I think I see what you are getting at.  Aside from picking the right
> cmdproc for the given arguments, you also want to be able to check whether
> there exists any implementation of the command at all (so you know whether
> the error is "unknown command" or "funny command line").  It wasn't clear
> that's what you wanted.

Well that's just a side effect of using nondet. You would need to handle
undefined commands somehow in your approach also.

> I usually do something along the following lines:

This is what Ralph suggested. If I want the types of the arguments to
be a factor when picking the right command, and to be able to accept
strings consisting of only digits for some commands, then this doesn't
work.

> This perhaps isn't as short as you might like, but is very maintainable --
> the detism ensures that help messages will always be added whenever a new
> command is added, for example.

It means you will have to change things in several places, though. That
was one thing that annoyed me with using getopt. I'd like to have just
a single list of name/parameters-command bindings, and then the commands.

/Tomas


--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list