[#5737] returning strings from methods/instance_methods — TRANS <transfire@...>

I was just wondering why with #methods and #instance_methods, it was

11 messages 2005/09/08

[#5796] proposed attr writer patch — Daniel Berger <Daniel.Berger@...>

Hi all,

18 messages 2005/09/16

[#5798] Makefile error in OpenSLL extension (on Windows) — noreply@...

Bugs item #2472, was opened at 2005-09-16 18:56

11 messages 2005/09/17
[#5800] Re: [ ruby-Bugs-2472 ] Makefile error in OpenSLL extension (on Windows) — nobu.nokada@... 2005/09/17

Hi,

[#5851] Re: RubyGems in Ruby HEAD — Paul van Tilburg <paul@...>

Hi all,

34 messages 2005/09/21
[#5867] Re: RubyGems in Ruby HEAD — mathew <meta@...> 2005/09/21

Paul van Tilburg wrote:

[#5870] Re: RubyGems in Ruby HEAD — Marc Dequènes (Duck) <Duck@...> 2005/09/21

[#5920] Re: RubyGems in Ruby HEAD — mathew <meta@...> 2005/09/22

Marc Dequ竪nes (Duck) wrote:

[#5926] Re: RubyGems in Ruby HEAD — Pascal Terjan <pterjan@...> 2005/09/23

On 9/22/05, mathew <meta@pobox.com> wrote:

[#5931] Re: RubyGems in Ruby HEAD — Austin Ziegler <halostatue@...> 2005/09/23

On 9/23/05, Pascal Terjan <pterjan@gmail.com> wrote:

[#5898] Delegate and Forwardable Documentation — James Edward Gray II <james@...>

I've tried to send these files through a couple of times now with

17 messages 2005/09/22
[#5911] Re: Delegate and Forwardable Documentation — James Edward Gray II <james@...> 2005/09/22

On Sep 22, 2005, at 9:02 AM, James Edward Gray II wrote:

[#5924] Re: Delegate and Forwardable Documentation — James Edward Gray II <james@...> 2005/09/23

On Sep 22, 2005, at 11:53 AM, James Edward Gray II wrote:

[#5941] Re: Delegate and Forwardable Documentation — Yukihiro Matsumoto <matz@...> 2005/09/23

Hi,

[#5942] Re: Delegate and Forwardable Documentation — James Edward Gray II <james@...> 2005/09/23

On Sep 23, 2005, at 10:54 AM, Yukihiro Matsumoto wrote:

[#5947] Re: Delegate and Forwardable Documentation — Yukihiro Matsumoto <matz@...> 2005/09/23

Hi,

[#5921] Mutually dependent libs double loading. — TRANS <transfire@...>

I'm on Ruby 1.8.2.

14 messages 2005/09/23
[#5923] Re: Mutually dependent libs double loading. — Florian Gro<florgro@...> 2005/09/23

TRANS wrote:

[#5985] Finally an answer to my RubyGems question and some small suggestions — TRANS <transfire@...>

I appreciate those that attempted to offer me some info on this issue.

9 messages 2005/09/26

[#6001] Require Namepaces and RubyGems' effect on LoadPath problem — TRANS <transfire@...>

I've added namespaces to require. Works like this:

94 messages 2005/09/26
[#6002] Re: Require Namepaces and RubyGems' effect on LoadPath problem — Austin Ziegler <halostatue@...> 2005/09/26

On 9/26/05, TRANS <transfire@gmail.com> wrote:

[#6003] Re: Require Namepaces and RubyGems' effect on LoadPath problem — TRANS <transfire@...> 2005/09/26

On 9/26/05, Austin Ziegler <halostatue@gmail.com> wrote:

[#6005] Re: Require Namepaces and RubyGems' effect on LoadPath problem — Austin Ziegler <halostatue@...> 2005/09/26

On 9/26/05, TRANS <transfire@gmail.com> wrote:

[#6007] gems is a language change, not a pkging system (Re: Require Namepaces and RubyGems' effect on LoadPath problem) — Sam Roberts <sroberts@...> 2005/09/26

Quoting halostatue@gmail.com, on Tue, Sep 27, 2005 at 06:02:07AM +0900:

[#6013] Re: gems is a language change, not a pkging system (Re: Require Namepaces and RubyGems' effect on LoadPath problem) — Austin Ziegler <halostatue@...> 2005/09/27

On 9/26/05, Sam Roberts <sroberts@uniserve.com> wrote:

[#6014] Re: gems is a language change, not a pkging system — Sam Roberts <sroberts@...> 2005/09/27

Quoting halostatue@gmail.com, on Tue, Sep 27, 2005 at 10:29:17AM +0900:

[#6015] Re: gems is a language change, not a pkging system — James Edward Gray II <james@...> 2005/09/27

On Sep 26, 2005, at 8:54 PM, Sam Roberts wrote:

[#6016] Re: gems is a language change, not a pkging system — Sam Roberts <sroberts@...> 2005/09/27

Quoting james@grayproductions.net, on Tue, Sep 27, 2005 at 11:06:01AM +0900:

[#6018] Re: gems is a language change, not a pkging system — Austin Ziegler <halostatue@...> 2005/09/27

On 9/26/05, Sam Roberts <sroberts@uniserve.com> wrote:

[#6019] Re: gems is a language change, not a pkging system — Sam Roberts <sroberts@...> 2005/09/27

Quoting halostatue@gmail.com, on Tue, Sep 27, 2005 at 11:49:14AM +0900:

[#6024] Re: gems is a language change, not a pkging system — Austin Ziegler <halostatue@...> 2005/09/27

On 9/27/05, Sam Roberts <sroberts@uniserve.com> wrote:

[#6025] Re: gems is a language change, not a pkging system — Ralph Amissah <ralph.amissah@...> 2005/09/27

> Right now, they're watching people who have pretty much sat on the side

[#6026] Re: gems is a language change, not a pkging system — Austin Ziegler <halostatue@...> 2005/09/27

On 9/27/05, Ralph Amissah <ralph.amissah@gmail.com> wrote:

[#6043] Re: gems is a language change, not a pkging system — Ralph Amissah <ralph.amissah@...> 2005/09/28

I'll greatly weaken my post, and give everyone the opportunity to head me

[#6044] Re: gems is a language change, not a pkging system — Hugh Sasse <hgs@...> 2005/09/28

On Wed, 28 Sep 2005, Ralph Amissah wrote:

[#6073] Re: gems is a language change, not a pkging system — Mauricio Fern疣dez <mfp@...> 2005/09/28

Hello,

[#6074] Re: gems is a language change, not a pkging system — Jim Weirich <jim@...> 2005/09/29

On Wednesday 28 September 2005 07:35 pm, Mauricio Fern疣dez wrote:

[#6017] Re: gems is a language change, not a pkging system — Austin Ziegler <halostatue@...> 2005/09/27

On 9/26/05, Sam Roberts <sroberts@uniserve.com> wrote:

[#6046] Re: gems is a language change, not a pkging system — "Sean E. Russell" <ser@...> 2005/09/28

On Monday 26 September 2005 22:41, Austin Ziegler wrote:

[#6050] Re: gems is a language change, not a pkging system — Hugh Sasse <hgs@...> 2005/09/28

On Wed, 28 Sep 2005, Sean E. Russell wrote:

[#6207] Re: gems is a language change, not a pkging system — "Sean E. Russell" <ser@...> 2005/10/10

On Wednesday 28 September 2005 08:54, Hugh Sasse wrote:

[#6045] Re: gems is a language change, not a pkging system (Re: Require Namepaces and RubyGems' effect on LoadPath problem) — "Sean E. Russell" <ser@...> 2005/09/28

On Monday 26 September 2005 21:29, Austin Ziegler wrote:

[#6048] Re: gems is a language change, not a pkging system (Re: Require Namepaces and RubyGems' effect on LoadPath problem) — Austin Ziegler <halostatue@...> 2005/09/28

On 9/28/05, Sean E. Russell <ser@germane-software.com> wrote:

[#6059] Re: gems is a language change, not a pkging system (Re: Require Namepaces and RubyGems' effect on LoadPath problem) — Dominique Brezinski <dominique.brezinski@...> 2005/09/28

On 9/28/05, Austin Ziegler <halostatue@gmail.com> wrote:

[#6061] Re: gems is a language change, not a pkging system (Re: Require Namepaces and RubyGems' effect on LoadPath problem) — Austin Ziegler <halostatue@...> 2005/09/28

On 9/28/05, Dominique Brezinski <dominique.brezinski@gmail.com> wrote:

[#6062] Re: gems is a language change, not a pkging system (Re: Require Namepaces and RubyGems' effect on LoadPath problem) — Dominique Brezinski <dominique.brezinski@...> 2005/09/28

For what it is worth, I live life behind an authenticated proxy, so I

[#6099] Re: gems is a language change, not a pkging system (Re: Require Namepaces and RubyGems' effect on LoadPath problem) — "Sean E. Russell" <ser@...> 2005/09/30

On Wednesday 28 September 2005 08:43, Austin Ziegler wrote:

[#6009] Re: ruby 1.8.3 (2005-09-21) [i486-linux] sisu segfault — Ralph Amissah <ralph.amissah@...>

(i) correction, segfault is with official ruby 1.8.3 (2005-09-21), not

21 messages 2005/09/27
[#6010] Fwd: ruby 1.8.3 (2005-09-21) [i486-linux] sisu segfault — Ralph Amissah <ralph.amissah@...> 2005/09/27

[sorry for duplicate post]

[#6079] Re: Fwd: ruby 1.8.3 (2005-09-21) [i486-linux] sisu segfault — ts <decoux@...> 2005/09/29

>>>>> "R" == Ralph Amissah <ralph.amissah@gmail.com> writes:

[#6081] Re: Fwd: ruby 1.8.3 (2005-09-21) [i486-linux] sisu segfault — ts <decoux@...> 2005/09/29

>>>>> "t" == ts <decoux@moulon.inra.fr> writes:

[#6082] Re: Fwd: ruby 1.8.3 (2005-09-21) [i486-linux] sisu segfault — Tanaka Akira <akr@...17n.org> 2005/09/29

In article <200509291419.j8TEJYid015419@moulon.inra.fr>,

Re: Require Namepaces and RubyGems' effect on LoadPath problem

From: TRANS <transfire@...>
Date: 2005-09-30 08:10:16 UTC
List: ruby-core #6092
On 9/30/05, Austin Ziegler <halostatue@gmail.com> wrote:

> If that's how you read me, then you're not able to read me at all.

Well, you some off poorly when you lay into a persons motives,
perceptions and popularity, etc. I'm all ears for someone to tell me
how my ideas are flawed, but I want concreteness --not high
platitudes.

> I'm
> seeing you suggest something that has *great* potential for confusion
> without benefit that isn't *better* solved in other ways. The confusion
> factor is even greater since you modified your "namespace" idea to work
> with "/" instead of just ":".

I don't know. I think you might just be seeing the surface and not the
greater potential here. Granted this is not super big deal stuff
--especially for most projects. But it is nonethless a nice
convenience. Moreover, it can help make Ruby's lib system more robust.
In fact, if you think about it Gems starts to do this already, b/c it
keeps the packages in separate dirs and redirects to them as needed --
so I haven't invented anything new here except to let the end user
affect that redirection internal to his/her lib layout too.

> (By the by, a YAML file would be better for your purposes, and you can
> modify setup.rb to install non-.rb files; see the CVS for PDF::Writer to
> see how I installed .afm files, thanks to help from Aredridel.)

Thanks! I will have a look.

> If namespaces are accessible through ns/path/to/resource, then how am I
> to tell the difference between foo/bar/baz where foo is actually a
> directory in $LOAD_PATH as opposed to foo that might be a namespace?
> With ns:path/to/resource, the situation is mildly better, but I *still*
> believe that the problem is better solved elseplace. (I also think that
> some form of clear templating namespace is better, e.g.,
> <ns>/path/to/resource. If one even bothers with something like this.)

Perhaps, but keep in mind someone can just as easily clober a lib dir
on installations too b/c the conflicting names. At leat this allows
one to use a longer name --less likely to be clobbered and offer a
short alias. In fact it is funny you bring this up, b/c I have just
finished improving this part. Now one uses a couple methods intead of
using $LOAD_SPACE, one uses #register_library and #alias_library. That
way if someone has already registered a lib or alias of the same name
it will warn you.

> I personally think that you're entirely *too* ready to change the Ruby
> core when you get an idea in your head about how something should be
> solved, even if there's a much *better* solution that doesn't involve
> changing the core.

I'm not suggesting core change. I'm just suggesting an idea --what I'm
really interested in is better was to do what I'm trying to do.

> > And how he doesn't care about there's problems.
>
> I care that there's problems. I just don't see what you're talking about
> as a problem sufficient to make a pretty drastic -- and IMO ugly --
> change to Ruby's core. Not to suggest that he agrees with me, but I find
> myself very *conservative* toward Ruby's core like David Black.

Actually, I am too. I think people get me wrong b/c I throw things out
there --not to push a specific idea, but to explore it for better ways
of doing things. If that ultimately effects Ruby, great. But that's
not the goal.

> > It's pretty sad. The real world is about HUMAN engineering problems.
> > In reality there is no such thing as a computer engineering problem
>
> Okay, let me be a bit more explicit. You're trying to make a LARGE
> language change for a TINY language problem that is *mostly* (if not
> exclusively) isolated to the collection libraries that you've created.

Okay. I understand that. You're right, I'm dealing with my problem
right now --so it is very specific in that sense. But the problem
takes on proportions beyond me when I try to find a general solution.
Sure maybe it's not something people have been clamering to have, but
it also hasn't been availabe to them before. No one was clamering to
use Ruby before it existed either --why not just use Perl?

> I've been using Ruby since 2002 and haven't seen a need for anything
> like this. For the problem mentioned in ruby-talk:21296, there seems to
> have probably been a bug related to search path order -- and no mention
> of namespace is made at all. I found one such posting, but even the
> person there seemed to think that it was a "neat" idea, not sufficient
> for inclusion in the core. Sorry, but I just spent the last fifteen
> minutes looking for it and can't find it.

I can see why there's some confusion. The post is about the other half
of what this allows, ie. to move files around in a lib directory with
out having to change requires --essentially a differnt way to do
require local.

> > --people who believe otherwise generally expect others to do all sorts
> > of arcane things and can't understand why they don't --you know, like
> > write a Rake task to rearrange your lib before distribtion while
> > substituting every require line accordingly and placing in stub files
> > for all files renamed or deleted to give warning while documenting
> > each file with endless ugly {{{ }}}'s for there clever little dev
> > tools....
>
> ...and you're saying it's better to modify the core of Ruby because you
> either cannot or will not arrange your libraries in a more user-friendly
> way or use software engineering tools to take care of it for you
> dynamically? Sorry, but I think one of us is making an unreasonable
> request -- and it isn't me.

Like I said, I wasn't suggesting modifying the core. Just opening up
an idea. I posted it here b/c how it interelated w/ Rubygems, which
was of topic at the moement.

And I am trying to arrange the libs in a user-friendly way, but also
in a developer friendly way at the same time. And also as not to
interfere with other libs. I could just dump them all straight in to
site_ruby. How would you like 50 new files there and 25 new folders?

T.


P.S. If anyone is at all interested here's the coded I have thus far:

# Please provide ascend!
#require 'facets/method/pathname/ascend'
require 'pathname'

module LibRegistry

  $LOAD_SPACE = {}
  $LOAD_STACK = []

  $reqopt = {}
  $REQUIRE_STACK = []

  class << self
    def registry ; @registry ||= {} ; end
    def [](k) registry[k] ; end
    def []=(k,v) ; registry[k] = v ; end
    def keys ; registry.keys ; end
    def empty? ; registry.empty? ; end
    def method_missing( sym, *args, &blk )
      @registry.__send__( sym, *args, &blk )
    end
  end

  # recommend taguri, though not enforced
  def register_library( taguri, *directories )
    if LibRegistry[taguri]
      warn "Overriding previsouly defined library space -- #{taguri}."
    end
    LibRegistry[taguri] = directories
  end

  def alias_library( briefname, taguri, *subdirectories )
    raise "Unregistered library -- #{taguri}." unless LibRegistry[taguri]
    warn "Overriding previsouly defined library alias -- #{briefname}."
    if subdirectories.empty?
      LibRegistry[briefname] = LibRegistry[taguri]
    else
      unless (subdirectories - LibRegistry[taguri]).empty?
        raise "Aliased directories do not belong to registers library
-- #{taguri}."
      end
      LibRegistry[briefname] = subdirectories
    end
  end

  def match( fpath )
    named_paths = []
    unless LibRegistry.empty?
      sk = LibRegistry.keys.sort.reverse
      if md = %r{^(#{sk.join('|')})\/}.match(fpath)
        fpath.replace( md.post_match )  # internal effect!
        named_paths = LibRegistry[md[1]]
      end
    end
    return named_paths
  end

  # This acends the given dir looking for _.rb,
  # if found it breaks and evals for the local space.
  # Note: this needs some refinement to prevent
  # going all the way to root dir (how?)
  def load_ns( dir )
    return $LOAD_SPACE[ dir ] if $LOAD_SPACE.key?( dir )
    pn = Pathname.new( dir )
    dirstack = []
    pn.ascend(true) { |d|
      nsfile = d + '_.rb'
      if absns = $LOAD_SPACE[d.to_s]
        until dirstack.empty?
          $LOAD_SPACE[ dirstack.pop ] = absns
        end
        break
      elsif nsfile.file?
        nsdir = nsfile.dirname
        ns = eval( File.read( nsfile ) )
        absns = ns.collect{|e| (nsfile.dirname + e).cleanpath.to_s}
        dirstack << d.to_s
        until dirstack.empty?
          $LOAD_SPACE[ dirstack.pop ] = absns
        end
        break
      else
        dirstack << d.to_s
      end
    }
    $LOAD_SPACE[ dir ]
  end
  module_function :load_ns

  # include current directory NOW
  load_ns( Dir.pwd )

  # A new #require sub-method that allows for
  # namespaces. Also added require options.
  def require( fpath, options={} )
    success = false

    dir = File.expand_path( File.dirname(caller[0]) )
    loc = File.join( dir, fpath )

    relative_paths = load_ns( loc ) || []
    named_paths = LibRegistry.match( fpath )
    paths = named_paths | relative_paths

    $REQUIRE_STACK << $reqopt
    $reqopt = options

    $LOAD_STACK << $LOAD_PATH.dup
    $LOAD_PATH.replace( paths | $LOAD_PATH )
    begin
      success = super( fpath )
    ensure
      $LOAD_PATH.replace( $LOAD_STACK.pop )
      $reqopt = $REQUIRE_STACK.pop
    end

    success
  end

#NOTES:
#     if fpath.index(':')  # explict namespace
#       fpath, space = fpath.split(':').reverse
#       #inspace(space) if space
#     end

end

class Object
  include LibRegistry
end


In This Thread