We have a number of different conventions for Alloc() methods on
types, here are some of them:

public static Type *Allocate ();
public static Type *CREATE ();
public static Type *Allocate (Type *inst);

The first two will usually allocate and initialize a
dynamically-allocated blob, whereas the third can initialize
stackalloc'ed blobs too.... We should unify these so that there is
only one, but which should we use?

My vote would be to have the first and also a

public void Init (Type *inst);

which does the initialization. The Init() is also called by Allocate
(). One reason is that CREATE is all uppercase, and also that Allocate
is more precise about what is happening.

We could have a third option as well, using three of them, Allocate
(), Init (), and Create (). Create () is basically:

public static Type *Create ()
{
  Type *inst = Allocate ();
  Init (inst);
  return inst;
}

-- 
fury

long name: William Lahti
handle :: fury
freenode :: xfury
blog :: http://xfurious.blogspot.com/

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
SharpOS-Developers mailing list
SharpOS-Developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sharpos-developers

Reply via email to