From: Dave Thomas Date: 2003-09-09T23:16:51+09:00 Subject: Re: ANN: MetaTags 1.0 On Tuesday, September 9, 2003, at 08:59 AM, Ben Giddings wrote: > On Monday, September 8, 2003, at 11:59 PM, Dave Thomas wrote: >> Then I could get the effect of literals using: >> >> c = Caml "one hump or two" > > Ack. I really don't like this. It is 4 keystrokes away from what > looks like a standard constructor: > > c = Caml.new "one hump or two" > In some cases, yes But say we're looking at a date (ignoring current implementations in the library). The class constructor might be def initialize(year, month, day) ... end It expects three integers. We could still define the global method Date "date string" Which parsed the string, reporting errors for incorrect strings, and then called the constructor with the three integers. This approach also allows for memoizing the returned values, which in general you probably shouldn't do with raw constructors. Cheers Dave