Google's Go & Exceptions

Nick Sabalausky a at a.a
Sat Jan 30 23:28:49 PST 2010


"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?





More information about the Digitalmars-d mailing list