Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > Re: How to retu...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 12 of 20 Topic 5632 of 5800
Post > Topic >>

Re: How to return an empty aggregate

by george.priv@[EMAIL PROTECTED] Apr 4, 2008 at 04:58 PM

On Apr 4, 4:35 pm, Maciej Sobczak <see.my.homep...@[EMAIL PROTECTED]
> wrote:
> On 4 Kwi, 17:38, george.p...@[EMAIL PROTECTED]
 wrote:
>
> > Good example is a factory.  Should it have a
> > mechanism to register-unregister itself?
>
> Not necessarily. I might be as well selected at startup time by some
> other entity (in which case it is also a strategy).
>
> > In addition such
> > objects make sense in singleton form
>
> Yes and no.
> Yes, because it does not make any sense to destroy them and create
> again.
> No, because it is *not harmful* to destroy and create them again (see
> also the monostate pattern):
>
> F : Factory'Class := Make_Funny_Factory;
> Obj : Object := F.Make_Object;
>
> Above, factory F is a transient entity that is used just to create one
> object. It might be a singleton as well, but does not have to.

To me it seems that simple callback will be much more simple and clear
way to achieve the same result.

type Make_Object is access function(Context: Contect_Type) return
Object;

Obj : object := Make_My_Object(Some_Context_Selector);


>
> > and likely involve some sort of
> > guarding mutexes or be implemented as protected or tasks.
>
> If it's stateless, then it does not need any protection - there is
> nothing to protect.

except for reenterance that in most of cases matter for that type of
objects.

>
> > BTW in C++
> > empty factory class will be fine due to implied constructor/
> > destructor.
>
> The empty factory class will be fine in Ada as well.
>
> --
> Maciej Sobczak *www.msobczak.com*www.inspirel.com
 




 20 Posts in Topic:
How to return an empty aggregate
Maciej Sobczak <see.my  2008-04-01 04:58:06 
Re: How to return an empty aggregate
Anh Vo <anhvofrcaus@[E  2008-04-01 05:54:00 
Re: How to return an empty aggregate
"Dmitry A. Kazakov&q  2008-04-01 15:34:04 
Re: How to return an empty aggregate
Robert A Duff <bobduff  2008-04-01 11:00:19 
Re: How to return an empty aggregate
Adam Beneschan <adam@[  2008-04-01 10:18:23 
Re: How to return an empty aggregate
Maciej Sobczak <see.my  2008-04-02 00:16:40 
Re: How to return an empty aggregate
Maciej Sobczak <see.my  2008-04-02 00:19:00 
Re: How to return an empty aggregate
george.priv@[EMAIL PROTEC  2008-04-02 22:02:37 
Re: How to return an empty aggregate
Maciej Sobczak <see.my  2008-04-03 02:09:11 
Re: How to return an empty aggregate
george.priv@[EMAIL PROTEC  2008-04-04 08:38:52 
Re: How to return an empty aggregate
Maciej Sobczak <see.my  2008-04-04 13:35:19 
Re: How to return an empty aggregate
george.priv@[EMAIL PROTEC  2008-04-04 16:58:36 
Re: How to return an empty aggregate
Maciej Sobczak <see.my  2008-04-05 06:48:36 
Re: How to return an empty aggregate
george.priv@[EMAIL PROTEC  2008-04-05 09:04:29 
Re: How to return an empty aggregate
Maciej Sobczak <see.my  2008-04-05 14:14:04 
Re: How to return an empty aggregate
george.priv@[EMAIL PROTEC  2008-04-05 15:36:36 
Re: How to return an empty aggregate
george.priv@[EMAIL PROTEC  2008-04-06 00:00:18 
Re: How to return an empty aggregate
Maciej Sobczak <see.my  2008-04-06 12:53:11 
Re: How to return an empty aggregate
Maciej Sobczak <see.my  2008-04-06 13:04:55 
Re: How to return an empty aggregate
george.priv@[EMAIL PROTEC  2008-04-07 13:23:35 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 6 19:32:22 CDT 2008.