From: Joel VanderWerf Date: 2010-07-08T02:11:56+09:00 Subject: Re: Global method usage in standard libs Alexander E. Fischer wrote: > Pathname['/home/someone'] I like this pattern. Note that there is some precedent in the core: Array, Hash, and Struct classes all have a [] class method (not necessarily equivalent to #new). It's also fairly well used in the stdlib and the gems I happen to have installed: $ ri '[]' | grep -oP '\S+::\[\]\S+' WEBrick::HTTPStatus::[], Dir::[], Array::[], Hash::[], Set::[], Matrix::[], Vector::[], Generators::AllReferences::[], Net::SSH::Version::[], YAML::Pairs::[], YAML::Omap::[], Webby::Filters::[], Webby::Filters::[], CodeRay::FileType::[], Pure::[], Rake::Task::[], Rake::FileList::[], JSON::[], JSON::[], MIME::Types::[], OrderedHash::[], NArray::[], Nokogiri::EncodingHandler::[], Nokogiri::HTML::ElementDescription::[], Nokogiri::CSS::Parser::[]=, Nokogiri::CSS::Parser::[], MultiRBTree::[], But note that some of these, like Dir#[], are not the same as #new. But I don't know how easy it will be to convince people to live with the deprecation warning for Pathname et al. I wouldn't mind it.