[TxMt Plugins] Dialog API improvements
Joachim Mårtensson
joachimm at etek.chalmers.se
Fri Sep 21 05:18:00 UTC 2007
> I prefer to stick with "--switch" for optional arguments, but I think
> you actually simplify the implementation slightly if you use an
> "object-oriented" syntax. The core dispatching code for a noun-verb
> ("create|show|close window") would look something like:
>
Ok I was under the impression that some nouns would go without verb,
making it non obvious when to use which, I am fine with the above.
> Parsing the remainder of the arguments would be the subcommand's
> responsibility, probably using a method provided for that purpose in
> the base class. This structure provides the property that any changes
> to a subcommand, even to accept a different set of arguments, are
> limited to that subcommand's source code. It allows new commands to be
> added without modifying any common code.
I agree with this as well.
>
> You can do the same thing with a single subcommand name ("tm_dialog
> create-window file.nib") as a part of the command name by storing a
> "command -> [class, selector]" mapping instead of the simpler "noun ->
> class" mapping. But I think I still prefer the "noun verb" syntax,
I find it a bit verbose and unfamilar (I do not think I have used many
shell commands that use
this structure), but I have no proplems accepting it if it is what people
want.
> because it enforces two desirable attributes when creating new
> commands: (a) the command is readable in source code and (b) there is
> room for future expansion.
>
> Chris
>
> _______________________________________________
> textmate-plugins mailing list
> textmate-plugins at lists.macromates.com
> http://lists.macromates.com/mailman/listinfo/textmate-plugins
>
More information about the textmate-plugins
mailing list