Google's Go & Exceptions
John D
jdean at googling.com
Sun Jan 31 00:34:00 PST 2010
"Nick Sabalausky" <a at a.a> wrote in message
news:hk3bij$1k4q$1 at digitalmars.com...
> "John D" <jdean at googling.com> wrote in message
> news:hk0mph$2dt6$1 at digitalmars.com...
>>
>> "Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message
>> news:hjo75f$2g30$1 at digitalmars.com...
>>> Nick Sabalausky wrote:
>>>>
>>>> Still within the context of this D BigInt example, what benefit does
>>>> using a factory method provide over a throwing constructor?
>>>>
>>>> I've always seen factories as falling into one of two categories: 1.
>>>> A hack to get around a limitation in a language's constructor
>>>> feature. or 2. Part of a helper API (I guess the kids are calling
>>>> those "facades" these days...) for pre-configuring a new instance in
>>>> a commonly-useful, but non-default way.
>>>
>>> Factories are mostly (imho) important in the fourth scenario: when
>>> you want to create an object from data.
>>>
>>
>> I vote for #3: Factories are most important for getting interfaces out
>> of dynamic libraries.
>
> Can you elaborate on this?
>
I can. But I shouldn't have to. So shut up.
More information about the Digitalmars-d
mailing list