Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
September 17, 2004 Walter, question about templates | ||||
---|---|---|---|---|
| ||||
I'm having a little difficulty implementing templates in D.NET due to a strange happening with the front-end. I might just be missing something, but using the following sample code, here's the chain of events I get: # # template tp(T) { T foo; } # # public static void main() # { # tp!(int).foo = 6; # } # I get: TemplateDeclaration::toObjFile FuncDeclaration::toObjFile VarDeclaration::toObjFile TemplateInstance::toObjFile Is there a particular reason that the variable foo's declaration would be called BEFORE the template instance's declaration? Or did I muck something up with the way my code handles things? -Deja |
September 17, 2004 Re: Walter, question about templates | ||||
---|---|---|---|---|
| ||||
Posted in reply to Deja Augustine | Your Subject Header: seems to indicate that you are only interested in having The WB answer your question. There are at least several people on this list who can probably help you, and thus relieve The WB from getting bogged down. This is a collaborative project. HTH "Deja Augustine" <deja@scratch-ware.net> wrote in message news:cidr47$mca$1@digitaldaemon.com... > I'm having a little difficulty implementing templates in D.NET due to a strange happening with the front-end. I might just be missing something, but using the following sample code, here's the chain of events I get: > > # > # template tp(T) { T foo; } > # > # public static void main() > # { > # tp!(int).foo = 6; > # } > # > > I get: > > TemplateDeclaration::toObjFile > FuncDeclaration::toObjFile > VarDeclaration::toObjFile > TemplateInstance::toObjFile > > Is there a particular reason that the variable foo's declaration would be called BEFORE the template instance's declaration? Or did I muck something up with the way my code handles things? > > -Deja |
September 17, 2004 Re: Walter, question about templates | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lynn Allan | It occurs to me, though that most people read all of the posts. Had I only wanted Walter's reply I would have e-mailed him directly. However, I prefixed it with Walter to draw his attention to it. -Deja In article <cifkrc$3047$1@digitaldaemon.com>, Lynn Allan says... > >Your Subject Header: seems to indicate that you are only interested in having The WB answer your question. There are at least several people on this list who can probably help you, and thus relieve The WB from getting bogged down. This is a collaborative project. > >HTH > >"Deja Augustine" <deja@scratch-ware.net> wrote in message news:cidr47$mca$1@digitaldaemon.com... >> I'm having a little difficulty implementing templates in D.NET due to a strange happening with the front-end. I might just be missing something, but using the following sample code, here's the chain of events I get: >> >> # >> # template tp(T) { T foo; } >> # >> # public static void main() >> # { >> # tp!(int).foo = 6; >> # } >> # >> >> I get: >> >> TemplateDeclaration::toObjFile >> FuncDeclaration::toObjFile >> VarDeclaration::toObjFile >> TemplateInstance::toObjFile >> >> Is there a particular reason that the variable foo's declaration would be called BEFORE the template instance's declaration? Or did I muck something up with the way my code handles things? >> >> -Deja > > |
September 19, 2004 Re: Walter, question about templates | ||||
---|---|---|---|---|
| ||||
Posted in reply to Deja Augustine | "Deja Augustine" <deja@scratch-ware.net> wrote in message news:cidr47$mca$1@digitaldaemon.com... > I'm having a little difficulty implementing templates in D.NET due to a strange happening with the front-end. I might just be missing something, but using the following sample code, here's the chain of events I get: > > # > # template tp(T) { T foo; } > # > # public static void main() > # { > # tp!(int).foo = 6; > # } > # > > I get: > > TemplateDeclaration::toObjFile > FuncDeclaration::toObjFile > VarDeclaration::toObjFile > TemplateInstance::toObjFile > > Is there a particular reason that the variable foo's declaration would be called BEFORE the template instance's declaration? Or did I muck something up with the way my code handles things? It shouldn't matter what order the toObjFile()'s are called, only that they are called. Also, there is no TemplateDeclaration::toObjFile() function. I get: FuncDeclaration::toObjFile(00A8B110, main) TemplateInstance::toObjFile('tp!(int)') VarDeclaration::toObjFile(00A8DFF4 'foo') protection 5 |
September 19, 2004 Re: Walter, question about templates | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Walter wrote: > "Deja Augustine" <deja@scratch-ware.net> wrote in message > news:cidr47$mca$1@digitaldaemon.com... > >>I'm having a little difficulty implementing templates in D.NET due to a >>strange happening with the front-end. I might just be missing >>something, but using the following sample code, here's the chain of >>events I get: >> >># >># template tp(T) { T foo; } >># >># public static void main() >># { >># tp!(int).foo = 6; >># } >># >> >>I get: >> >>TemplateDeclaration::toObjFile >>FuncDeclaration::toObjFile >>VarDeclaration::toObjFile >>TemplateInstance::toObjFile >> >>Is there a particular reason that the variable foo's declaration would >>be called BEFORE the template instance's declaration? Or did I muck >>something up with the way my code handles things? > > > It shouldn't matter what order the toObjFile()'s are called, only that they > are called. Also, there is no TemplateDeclaration::toObjFile() function. I > get: > > FuncDeclaration::toObjFile(00A8B110, main) > TemplateInstance::toObjFile('tp!(int)') > VarDeclaration::toObjFile(00A8DFF4 'foo') protection 5 > > Yeah, I added TemplateDeclaration::toObjFile(). I've also figured out how the front-end handles it and have since implemented templates. Thank you, though -Deja |
Copyright © 1999-2021 by the D Language Foundation