[Yum] Future feature request...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 13, 2003 at 02:23:51PM +0000, Carwyn Edwards wrote:
> 
> <quote>
> 
> I know you were just joking (the smiley gave it away) but there is a
> tidy solution to the "endless if" problem.
> 
> Make a dict[] of names->functions.  This makes the whole thing rather
> modular and tidy.
> 
> </quote>
> 
> I don't see why you need a huge "if block" or a dict map to do this? 

I never said "need".  In fact, I said quite explicitly that there were
many ways to do it.  Including...

> The best way to do this is with a plugin system that uses a dynamic
> class/module loader. See:

Quoting myself:  

   "Define the functions wherever you want, including 'plugins' if you
   like."

As it turns out, I have a little experience with python plugins and
dynamic command lists.  I like the concept.  It's good for some
things.

> <quote>
> 
> GIVEN A LONG LIST of name->function pairs, how do we more cleanly
>  deal with them?
> 
> </quote>
> 
> Answer: you don't have a long list. You use introspection/reflection. 
> Why build a mapping when you can derive it at runtime?

Perhaps you should read again the text you quoted.  I write "GIVEN A
LONG LIST" (in caps, I might add), and you immediately say "you don't
have a long list".

I agree, there are many other solutions.  I tried (and apparently
failed) to express that I was addressing the situation where you DO
have a long list.

Now, the answer to YOUR question "Why build a mapping when you can
derive it at runtime?": it's a design tradeoff.  Do you want to pull
in hundreds of lines of code to manage "plugins" when you only have 3
options and you will never have more?  No.  You hardcode it in 6 lines
and be done.  Hundreds of commands that may change?  Absolutely, it's
a no-brainer.  In the middle, it's a harder decision.

Now, back to yum, as my little side comment has dragged us far far far
away....    the limiting issue here is not internal implementation,
exciting as I may find it.  The limiting issue is human interface and
Seth's (laudable) desire to keep it clean and simple.

					-Michael
-- 
  Michael Stenner                       Office Phone: 919-660-2513
  Duke University, Dept. of Physics       mstenner@xxxxxxxxxxxx
  Box 90305, Durham N.C. 27708-0305

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux