[#3228] Core support for Gems, and namespace — "Luke A. Kanies" <luke@...>

Hi all,

21 messages 2004/07/27
[#3230] Re: Core support for Gems, and namespace — Austin Ziegler <halostatue@...> 2004/07/27

On Tue, 27 Jul 2004 11:39:08 +0900, Luke A. Kanies <luke@madstop.com> wrote:

[#3234] Re: Core support for Gems, and namespace — "Luke A. Kanies" <luke@...> 2004/07/27

On Tue, 27 Jul 2004, Austin Ziegler wrote:

[#3238] Re: Core support for Gems, and namespace — Austin Ziegler <halostatue@...> 2004/07/27

On Wed, 28 Jul 2004 00:14:29 +0900, Luke A. Kanies <luke@madstop.com> wrote:

Re: Core support for Gems, and namespace

From: "Luke A. Kanies" <luke@...>
Date: 2004-07-27 15:21:03 UTC
List: ruby-core #3235
On Wed, 28 Jul 2004, Gavin Sinclair wrote:

> A good approach might be the following.  Let's assume your application
> or library is called "rfoo" and depends on the following libraries:
> redcloth, bluecloth, and madeleine.  We put the dependencies all
> together like this, in a file 'rfoo/dependencies.rb'
>
>  begin
>    require 'rubygems'
>    require_gem 'redcloth'
>    require_gem 'bluecloth'
>    require_gem 'madeleine', '>= 0.6.0'
>  rescue LoadError
>    require 'redcloth'
>    require 'bluecloth'
>    require 'madeline'
>  end
>
> Then, throughout your application/library, you can just write
>
>  require 'rfoo/dependencies'

That's exactly the behaviour I want to avoid.  It seems that that is 
confusing packaging requirements (i.e., this package should only be 
installed if these other packages are installed) and loading requirements 
(when you load this package it needs to load all of these other packages). 
The loading requirements are already easily handled, as long as developers 
don't have to care whether the packages are gems or not -- just 'require' 
the correct libraries.  As to packaging requirements, that should be a 
completely different solution, because run-time problems are completely 
different from install-time problems.

> I've just dug a hole for myself, because require_gem is not usually
> amenable to the autoload feature: it automatically loads the default
> library, if one is specified.
>
> Anyway Luke, I hope you find something of interest in this response.

Yes, but it's unfortunately mostly ammunition for my belief that gems 
complicate the picture for both users and developers, rather than 
simplifying it.

-- 
Once...in the wilds of Afghanistan, I lost my corkscrew, and we were
forced to live on nothing but food and water for days.  -- W. C. Fields
---------------------------------------------------------------------
Luke Kanies | http://abstractive.org | http://reductiveconsulting.com

In This Thread