FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Singletons
Goto page Previous  1, 2
 
Post new topic   Reply to topic     Forum Index -> Sinbad
View previous topic :: View next topic  
Author Message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Sun Jan 30, 2005 12:45 pm    Post subject: Reply with quote

I do agree. The primary reasons why I even dreamt up the idea of translating the OGRE library were A) its an OO 3d lib for gosh sakes! and B) it seems very solidly designed. So naturally I don't want to deviate much from the original OGRE team's design. However... Sinbad already deviates, which is partly why I think starting over might be a good idea.

I also agree on "filtering" the event system through D. You're experiments using paired interfaces and mixins sounds like it was gaining successes, so that's probably the way to go. If nothing else, using interfaces may make Sinbad a little more extendable than the original OGRE, or at least more easily so. (I'm a dreamer.)
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Sun Jan 30, 2005 2:06 pm    Post subject: Reply with quote

csauls wrote:
I do agree. The primary reasons why I even dreamt up the idea of translating the OGRE library were A) its an OO 3d lib for gosh sakes! and B) it seems very solidly designed. So naturally I don't want to deviate much from the original OGRE team's design. However... Sinbad already deviates, which is partly why I think starting over might be a good idea.


I don't think there is enough to say that it deviates Smile What I've actually done is to start with the exampleapplication, copying the code from OGRE, translating it to D and adding the API to Sinbad as needed. What this means is that we need *exactly* the same API as in OGRE and probably makes it a silly way to do it. When coding up something, whether there is a design at the bottom or not, I like starting with a fairly simple demo to make something work, then flesh it out. Anyway, I find it difficult to both use a existing design (OGRE) and make it 'better', because changes to one part most likely will have a deep impact on the rest. I would love to start over and I once did (2 years ago, just after I discovered D), but I lost everything in a diskcrash. I lost faith and forgot many of my ideas, which were really good Wink.

casuls wrote:

I also agree on "filtering" the event system through D. You're experiments using paired interfaces and mixins sounds like it was gaining successes, so that's probably the way to go. If nothing else, using interfaces may make Sinbad a little more extendable than the original OGRE, or at least more easily so. (I'm a dreamer.)


Well, I think it will work, but it will make the API more or less the same as the one in OGRE. To get it properly D-ified, I think we need use-cases describing all aspects, then designing it from the bottom, using one or more of delegates, interfaces, templates/mixins, etc.

I think I need a couple of days to contemplate Sinbad's future (for my part of it), unless you have some revolutionary new insights Smile Your thoughts/doubts(?) have given me something to think about.
Back to top
View user's profile Send private message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Sun Jan 30, 2005 10:10 pm    Post subject: Reply with quote

Revolutionary new insights I have not, despite consulting a six pack of Killian's and my favorite pipe. Smile So do your contemplation/experimenting and see how you feel, and we'll go from there.
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Mon Apr 04, 2005 3:23 pm    Post subject: Reply with quote

After a couple of days (or was it months?) of contemplating, I'm inclined to continiue on the path we've started. I'm not experienced enough with the actual design of a 3D library to start all over. You're in?
Back to top
View user's profile Send private message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Tue Apr 19, 2005 10:58 am    Post subject: Reply with quote

I know this is such an ancient topic... but I'm thinking that if we come across any Singletons that don't need inheritance capabilities, we should use the abstract-static style as mentioned on the newsgroups. I might do a little experimenting though, to see if abstract-static can be used with inheritance, which is doubtful, but interesting to note if possible.
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Tue Apr 19, 2005 12:27 pm    Post subject: Reply with quote

I don't think I've read that thread in the NG. Could you enlighten me?
Back to top
View user's profile Send private message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Tue Apr 19, 2005 9:14 pm    Post subject: Reply with quote

Okie... basically a singleton written using abstract-static looks like this:
Code:

public abstract class MySingleton {
  // SINGLETON
  static:

  // ... everything else ...
}


This essentially just creates something like a namespace. If inheritance does somehow work with this (highly doubted) it would make for an interesting paradigm.
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
BabaLi



Joined: 15 Jun 2007
Posts: 5
Location: France, Paris

PostPosted: Tue Jul 24, 2007 5:53 pm    Post subject: Reply with quote

In dazel we have this singleton:
Code:
module dazel.templates.singleton;

template Singleton()
{
  static private typeof(this) instance_ = null;

  static public typeof(this) getInstance()
  {
    if (typeof(this).instance_ is null)
      typeof(this).instance_ = new typeof(this)();
    return instance_;
  }
}


You just need to mix it.
_________________
Alexandre Bique
Epita promotion 2009
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Sinbad All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group