[Opensim-dev] Organization and naming patterns of commands on the console

Justin Clark-Casey jjustincc at googlemail.com
Thu Feb 5 17:14:04 UTC 2009


Dalien Talbot wrote:
> 
> 
> On Wed, Feb 4, 2009 at 9:50 PM, Justin Clark-Casey 
> <jjustincc at googlemail.com <mailto:jjustincc at googlemail.com>> wrote:
> 
>     Any thoughts on this?  Just kind of thinking about it at this stage
>     - part of me prefers typing things like "show users"
>     or "help terrain" while another part of my mind likes the 'tidiness'
>     of prefixing every module command with the same
>     word (e.g. terrain fill or region oar load).
> 
> 
> I think it depends on what kinds of evils to choose :)
> 
> using the first keyword to select the handler to throw the remainder of 
> the string to, is a very nice decoupled approach from the code 
> perspective, and is the most flexible and simple (the analogy is 
> argc/argv passing from the shell, the first token being the executable 
> int the path). The obvious downsides, that the standardization ends 
> immediately beyond the first level :-)
> 
> the standardization "by action" is more convenient at least to some part 
> of the users. will require some more code indeed, also.

Yeah, I agree.  However, I'm coming to the opinion that the only keyword really worth any formal code-based 
standardization is help (so that you can reliably get help on topics and then individual commands in modules).  All the 
rest I'd be happy to see as just guidelines (e.g. show, create, delete keywords) which can be consistent in the core 
modules.

Thinking about it a bit more, the initial keyword approach works well for some modules (e.g. terrain) and not so well 
for other stuff.  So I'm tending to favour an approach where modules register whatever commands they like without any 
leading keyword.  Interpretation of the arguments to those commands could be left to the module or perhaps there could 
be some standard core mechanism using some external project (http://sourceforge.net/projects/csharpoptparse/ perhaps).

Despite talking about this, I don't have any personal intention of implementing/changing lots of stuff any time soon - 
I'm probably just going to do what I need to do to achieve my own immediate selfish aims without committing too much of 
a code atrocity :).  I was more interested in the discussion and seeing the direction in which we could go as modules 
get more popular and we start to factor out more stuff into them.

> 
> the "embedded standard" solution would be a full-blown parser with 
> contextual "?"-help - then the modules can use the benefits of grouping 
> by action without scattering the code too much - as they'd register the 
> callbacks from the parser tree. As well then the token 
> representation/quoting/escaping/etc. could be standard and uniform. But 
> that's the most code-heavy approach and my guess is you're not really 
> looking forward to that at all :)

You're most preceptive :)  I'm hoping that we can keep things as simple as possible and largely offload parsing to 
something like csharpoptparse.

-- 
justincc
Justin Clark-Casey
http://justincc.wordpress.com



More information about the Opensim-dev mailing list