[#3861] super — ts <decoux@...>
[#3862] Marshal.dump'ing OpenStruct objects — Mauricio Fern疣dez <batsman.geo@...>
Hi,
[#3881] mkdir, mkdir_p in FileUtils and mode — Florian Frank <flori@...>
Hello,
[#3907] Obtaining mode information on an IO object — Jos Backus <jos@...>
The attached patch implements IO#mode. This method returns the mode the IO
Hi,
On Tue, Dec 07, 2004 at 09:25:13AM +0900, nobu.nokada@softhome.net wrote:
Jos Backus wrote:
Hi,
On Thu, Dec 09, 2004 at 10:47:48AM +0900, nobu.nokada@softhome.net wrote:
On Thu, Dec 09, 2004 at 02:40:33PM +0900, James Britt wrote:
[#3914] Pathname needs a makeover — "Berger, Daniel" <Daniel.Berger@...>
Hi all,
[#3922] Incorrect escaping in strings produced by String::inspect — noreply@...
Bugs item #1173, was opened at 2004-12-08 17:35
[#3966] unknown node type 0 — Andrew Walrond <andrew@...>
I still get this happening a lot with my Rubyx linux ruby script.
This is a long standing bug in Ruby, and has been reported hundreds of times
Hi,
[#3975] Patches to test/unit — Ryan Davis <ryand-ruby@...>
I believe these are the minimal patches needed to make it possible to
[#3982] Win32: rb_sys_fail() - errno == 0 — Florian Gro<florgro@...>
Moin!
[#4000] 1.8.2 preview4 — Yukihiro Matsumoto <matz@...>
Hello,
[#4009] cgi.rb -- more GET/POST stuff — mde@...26.com
First of all, I think it would be great, as Eustaquio suggests, to
GETs and POSTs are defined to be fairly different actions. I'd read
-----BEGIN PGP SIGNED MESSAGE-----
Francis Hwang wrote:
-----BEGIN PGP SIGNED MESSAGE-----
First of all, the entire discussion of when GET is appropriate
mde@state26.com wrote:
[#4027] Allowing custom number literal suffixes? — Florian Gro<florgro@...>
Moin!
Hi,
Mathieu Bouchard wrote:
Mathieu Bouchard wrote:
I'm not sure I would advocate making Ruby's grammar even more
>
Brent Roman wrote:
> Brent Roman wrote:
Brent Roman wrote:
> Florian Gross wrote:
Mathieu Bouchard wrote:
Mathieu Bouchard wrote:
[#4033] Garbage collection trouble — Christian Neukirchen <chneukirchen@...>
Hello,
>>>>> "C" == Christian Neukirchen <chneukirchen@gmail.com> writes:
ts <decoux@moulon.inra.fr> writes:
>>>>> "C" == Christian Neukirchen <chneukirchen@gmail.com> writes:
[#4040] Extensions, Internal — Jgen Mangler <juergen.mangler@...>
Hi,
Re: Pathname needs a makeover
On Wednesday, December 8, 2004, 10:47:49 AM, Daniel wrote:
> Hm...to me a pathname is just a string that happens to
> be in a specific format (i.e. it represents a
> theoretical path on a file system). I suppose you
> could make Pathname a subclass of Array. I'd be
> interested to see an implementation of that, if even
> for experimentation.
I'm not suggesting that it _should_ be based on Array, but that
actually makes about as much sense as String. For example,
Pathname#+. A pathname is conceptually a list of entries in a
hierarchy.
> As for some methods not making sense for a pathname,
> well, I'm not sure what to say to that other than it
> might make sense for that particular user, knowing
> that it was a subclass of String up front. But, I see
> your point.
Further, if it subclassed String, you have to explain to your users
that #each and #+ don't work as they (probably) expect. Unless you
propose to change the meaning of Pathname#+, which would kind of
undermine the whole class :)
>> > - It should not implement methods that raise
>> errors if the pathname does
>> > not exist.
>>
>> Not sure what you mean here.
> The various File and Dir class methods, such as
> File.mtime, etc. Isn't the presumption that our
> pathname may our may not exist? If so, why include
> methods that may not work?
They work fine, just like
File.mtime?('/usr/bin/fahslkgjherlkshfekhflas')
works fine. In fact,
Pathname.new('/usr/bin/fahslkgjherlkshfekhflas').mtime
will have exactly the same result.
>> > - Many methods are implemented manually that could
>> be avoided by
>> > subclassing the String class and mixing in the
>> Enumerable module.
>>
>> That's not a problem. Delegation is a useful
>> technique. Any specific
>> examples that bug you?
> By subclassing String, we could eliminate the need for
> ==, <=>, to_s, inspect, and +.
See above about the + method.
>> * You implementation is missing many methods from the existing
>> Pathname (like the Directory, IO, and Utility methods, as marked in
>> the documentation). Is this intentional?
> Yes (see my point above).
> And now for the warm, fuzzy argument - as it stands
> now the Pathname class feels like a kitchen soup of
> methods - a bunch of stuff slapped together from other
> classes, with a few methods of its own sprinkled in
> for good measure. It just feels clunky and haphazard.
I'm the opposite. I really like the kitchen sink of methods in
Pathname. For example:
path = Pathname.new('/tmp')
path += 'example-123'
unless path.exists?
path.open('w') do |file|
file.puts "What a nice OO interface!"
end
end
I know my feeling is not universal (PragDave expressed a certain
ambivalence about it in Pickaxe II), but to me, this is the way file
access _should_ be done in an OO language. I cringe when I see code
like
File.open(File.join(File.basename(path), rel_path)) {...}
and unfortunately, I see code like that quite often. Compare:
path = Pathname.new(path).basename + relpath
path.open {...}
> But, if folks would prefer delegation to subclassing,
> then I guess much of this is moot. :/
The issue of inheritance vs. delegation is separate from what kind of
methods Pathname should include. Related though, I guess.
Gavin