Jim Weirich wrote:
> On Sunday 22 May 2005 11:11 pm, Jeremy Hinegardner wrote:
> 
>>Possibly something like:
>>
>>    spec = Gem::Specification.new do |s|
>>        s.add_optional_dependency('SampleGem','>= 0.42.0')
>>        s.add_optional_dependency('OptionalGem','>= 0.10.2')
>>    end
>>
>>Then during the gem install phase rubygems would check and make sure
>>that either SampleGem or OptionalGem were installed.  If neither were
>>Thoughts anyone ?
> 
> The problem is that once you get beyond simple dependencies, the requirements 
> could become quite complicated.  What one really needs is a full constraint
 > language to handle the arbitrary combinations.

Jim, I don't want to make this sound simpler than it is, but I'd guess 
we have quite good turing complete constraint language at our disposal, 
namely Ruby.

 > The next person might need either gem A or gems B and C.

   if s.gem('A').available?
     s.add_dependency('A', '>= 0.42.0')
   else
     s.add_dependency('B', '>= 0.42.0')
     s.add_dependency('C', '>= 0.42.0')
   end

 > Someone else needs Gem X on platform Y but Gem W on
 > other platforms.

   if s.platform == "Y"
     s.add_dependency("X")
   else
     s.add_dependency("W")
   end

I'm sure we all agree that dependency logic can get complicated, but 
then it's time to start simplifying. And if that's not possible, I'm 
sure someone writes dependency logic resolver in prolog, or at least 
provides yet another dependency to one :).

       - Aleksi