> -----Original Message-----
> From: Frykholm, Niklas [mailto:nfrykholm / rsasecurity.com]
> Sent: Monday, October 15, 2001 3:53 AM
> To: ruby-talk ML
> Subject: [ruby-talk:22554] Re: OSSL opinion
> 
> 
> >And,
> >please, avoid the pitfall, common in Java APIs, of obscuring the 
> starting 
> >point to support the plug-in model.  One thing I hate about Java APIs is 
> >having to get a base class of something through some obtuse factory.  I 
> >want to be able to say:
> >
> >   crypt = Blowfish.new
> >
> >not
> >
> >   crypt = Crypto.lookup( "Blowfish" ).new_instance

I agree about plugable cryptographic service providers!

What about the syntax:

	crypt = Crypto["Blowfish"].new

where you define method "[ ]" as:

class Crypto

  def [](algorithm, provider="default") 
    # provider can be optionally specified
    ...lookup provider, get algorithm class, and return it
  end
  
  def each(provider="default") 
    #iterate over the algorithms in the (optionally) supplied provider
  end

  def each_provider
    #iterate over the available providers and return Provider class
  end

  ...lots of other stuff here!

end

Using this index oriented "[ ]" lookup seems right in this situation.

-Rich