Pathname['abc'] instead of Pathname('abc') global method as constructor alternative #61

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
5 participants

aef commented Nov 17, 2011

ruby-core#7363

I made it possible to use Pathname.[] as an alternative to Pathname.new, as the Set class does it already. Also I did mark the global Pathname() method deprecated because I think poisoning the global namespace with methods named after classes should be considered bad style. I hope you share that opinion.

I've also written a patch for rubyspec which tests the new methods and runs at least in MRI 1.9.2 and 1.9.3. It does although not test for the deprecation warnings, because Brian Ford wouldn't accept the patch if it would do so. It is available here: https://github.com/aef/rubyspec/tree/pathname_brackets_instead_global_method

@aef aef Made it possible to use Pathname.[] as an alternative to Pathname.new…
…. Deprecated the global Pathname() method, because I consider it bad style to poison the global namespace with things like this.
3a4dee9

trans commented Nov 17, 2011

+1

trans commented Nov 18, 2011

Even if Pathname() sticks around, Pathname[] is a good addition.

Personally I'd like to see the library optimized, renamed to just Path and added to core.

aef commented Nov 18, 2011

I would like that too.

On Fr, 2011-11-18 at 09:46 -0800, 7rans wrote:

Even if Pathname() sticks around, Pathname[] is a good addition.

Personally I like to see the library optimized, renamed to just Path and added to core.


Reply to this email directly or view it on GitHub:
#61 (comment)

Member

ayumin commented Aug 18, 2012

If you really want to let ruby-core accept patch, you should put this onto bugs.ruby-lang.org.
This opinion is new feature, so it probably doesn't be accepted in 2.0.
But it's possible on version if you got success matz's acceptance.

Good luck.

Member

zzak commented Nov 15, 2012

I've added reference to the ruby-core ticket in the description.

Member

zzak commented Nov 18, 2012

Closing this as there is already an open ticket on redmine

zzak closed this Nov 18, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment