From: Ryan Davis Date: 2009-08-30T17:11:56+09:00 Subject: [ruby-core:25194] Re: [Feature #1961] Kernel#__dir__ On Aug 30, 2009, at 00:14 , NARUSE, Yui wrote: > You should see solutions in the original post: >> (1) add a toplevel constant __DIR__ >> pros: looks like __FILE__ >> cons: adding new keyword >> >> (2) add Kernel#__DIR__ >> pros: no new keyword >> cons: it should have a lower-case name (like 1.9's __method__), >> because it is not a constant but a method. >> >> (3) add Kernel#__dir__ >> pros: no new keyword, and it is clearer than (4) that it has >> some associations with __FILE__. >> >> (4) make __FILE__ to the default argument of File.dirname >> pros: no new keyword nor new method >> cons: it is not clear that 'File.dirname' is expanded to >> the path of directory of __FILE__. > > And you can add cons to (3) add Kernel#__dir__ > cons: lacking consistency for __FILE__ > > I think so too and I like (1). If we have to have this (I'm against it in general) then I think #1 makes more sense wrt consistency. I don't see any real reason why it shouldn't be a parse-time constant like __FILE__ is and I think that is what most people would expect.