[DDMD] Reasoning behind converting new Type -> Type::create

Iain Buclaw ibuclaw at gdcproject.org
Mon Jan 27 07:46:19 PST 2014


On 27 January 2014 15:00, Daniel Murphy <yebbliesnospam at gmail.com> wrote:
> "Iain Buclaw"  wrote in message news:tahhleknrghaegcdvfgz at forum.dlang.org...
>
>> Question aimed at Daniel.
>
>
>> Assuming this needs to be done for all new'ing of classes across C++ -> D,
>> it looks like you've only done half a job?  Surely you should define a
>> ::create for all Type's on the chance that the backend might *actually* need
>> it irrespective of what DMD does?
>
>
> Yeah, for now you can't new anything from C++ that's written in D.  You also
> can't stack-allocate if it has a constructor and destructor.  I'm not
> expecting these limitations to go away any time soon.  This applies to
> pretty much every struct/class except OutBuffer.
>
> I didn't want to introduce new dead code.  It should be trivial to add more
> methods if you like, or it can wait until you start building DDMD and get
> linker errors!
>

OK.  Have you tested calling C++ destructors from D?

This I ask in sincerity as there is a file with functions re-written
from the frontend to work with gdc.  Wouldn't want to hit any brick
walls here...

---
$ grep "^[a-zA-Z].* (" d-glue.cc
Global::init (void)
Global::startGagging (void)
Global::endGagging (unsigned oldGagged)
Global::isSpeculativeGagging (void)
Global::increaseErrorCount (void)
Dsymbol::ungagSpeculative (void)
Ungag::~Ungag (void)
Loc::toChars (void)
Loc::Loc (Module *mod, unsigned linnum)
Loc::equals (const Loc& loc)
error (Loc loc, const char *format, ...)
error (const char *filename, unsigned linnum, const char *format, ...)
verror (Loc loc, const char *format, va_list ap,
errorSupplemental (Loc loc, const char *format, ...)
verrorSupplemental (Loc loc, const char *format, va_list ap)
warning (Loc loc, const char *format, ...)
vwarning (Loc loc, const char *format, va_list ap)
deprecation (Loc loc, const char *format, ...)
vdeprecation (Loc loc, const char *format, va_list ap,
fatal (void)
escapePath (OutBuffer *buf, const char *fname)
readFile (Loc loc, File *f)
writeFile (Loc loc, File *f)
ensurePathToNameExists (Loc loc, const char *name)
FuncDeclaration::isBuiltin (void)
eval_builtin (Loc loc, FuncDeclaration *fd, Expressions *arguments)
---


More information about the Digitalmars-d mailing list