"John D" <jd...@googling.com> wrote in message 
news:hk0mph$2dt...@digitalmars.com...
>
> "Andrei Alexandrescu" <seewebsiteforem...@erdani.org> wrote in message 
> news:hjo75f$2g3...@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?


Reply via email to