On 05/14 04:01, Magnus Holm wrote:
> On Sat, May 11, 2013 at 7:11 PM, jeremyevans0 (Jeremy Evans) <
> > I'm against removing it, since I think there are places where the syntax
> > looks nicer with :: (constructors such as Sequel::Model() and
> > Nokogiri::XML()).  Having only one way to do something for its own sake is
> > not the ruby way, and I think the loss of backwards compatibility and nicer
> > syntax outweighs the reduced confusion.  I don't train new ruby
> > programmers, though, so maybe I underestimate the confusion this causes.
> 
> Can't you use use #[] for this?
> 
>   class Quuz < Foo::Bar["Howdy"]
>   end
> 
>   class User < Sequel::Model[:User]
>   end
> 
>   doc = Nokogiri::XML[data]

In the case of Sequel::Model, no, since Sequel::Model.[] is already
defined and does something different than creating a subclass.

Usage of [] for constructors seems fairly uncommon (Hash.[] is the
exception that comes to mind), so from a syntax level it is more likely
to be confusing.  Using capitalized methods for constructors is much
more common in ruby (e.g. Kernel::{String,Array,Integer,Float,...}).

Jeremy