From: Benoit Daloze Date: 2010-03-25T04:15:37+09:00 Subject: [ruby-core:28951] Re: [Feature #1961] Kernel#__dir__ --00032555af2e27f500048290c1e6 Content-Type: text/plain; charset=ISO-8859-1 > > Perhaps __FILE__ should not be a raw String object, but rather a > CurrentFile object. It could have a #to_str to return the normal String so > it can be used like normal, but can provide methods like #dir, where > __FILE__.dir == File.dirname(__FILE__). > > This solves the need for __DIR__ in a very clean, object oriented way. > Sorry to not be according, but classes for one object and '__FILE__.dir' fear me. The idea behind is everything but not bad anyway. Paths simply stored in String doesn't seem very appropriate. Something like Pathname, or maybe just a Path class would be a better OO approach I think. But I'm reluctant to the syntax of '__FILE__.meth' B.D. P.S.: Is not Ruby the language where everything is an Object ? I mean if we can do -1.abs, Path("/dir/file.ext").{basedir,dirname,dir} looks like a solution --00032555af2e27f500048290c1e6 Content-Type: text/html; charset=ISO-8859-1
Perhaps __FILE__ should not be a raw String object, but rather a CurrentFile object. It could have a #to_str to return the normal String so it can be used like normal, but can provide methods like #dir, where __FILE__.dir == File.dirname(__FILE__).

This solves the need for __DIR__ in a very clean, object oriented way.

Sorry to not be according, but classes for one object and '__FILE__.dir' fear me.
The idea behind is everything but not bad anyway. Paths simply stored in String doesn't seem very appropriate.

Something like Pathname, or maybe just a Path class would be a better OO approach I think.
But I'm reluctant to the syntax of '__FILE__.meth'

B.D.

P.S.:
Is not Ruby the language where everything is an Object ?
I mean if we can do -1.abs, Path("/dir/file.ext").{basedir,dirname,dir} looks like a solution
--00032555af2e27f500048290c1e6--