A couple reasons:
- There is a distinct usage difference between apply and new in many
classes which have both.
- That doesn't achieve the goal of making it easy to move code which
is already using new to factory methods. If your intent is "no one
should ever use new" then that means everyone basically has to create
an additional factory methods for all their classes. People aren't
doing that now, and I don't see any reason to force them to do it.
- That doesn't achieve the goal of making this work properly with arrays.
On Sat, Mar 14, 2009 at 2:53 PM, Stepan Koltsov
<
stepan.koltsov@...> wrote:
> Why not just call apply method of companion object, without "new"?
>
> S.
>
> On Sat, Mar 14, 2009 at 17:05, David MacIver <
david.maciver@...> wrote:
>> Summary: Make it easy to switch from constructors to factories after
>> the fact by adding a mechanism where "new Foo(stuff)" can translate to
>> an invocation of a user defined method on the companion object.
>>
>>
http://www.drmaciver.com/factories-sip.xhtml>