Jarrett Billingsley Wrote: > On Sun, Mar 29, 2009 at 1:46 PM, Steve Teale > <[email protected]> wrote: > > The documentation says: > > > > TemplateDeclaration: > > template TemplateIdentifier ( TemplateParameterList ) Constraint(opt) > > { DeclDefs } > > > > DeclDefs as defined where? > > http://www.digitalmars.com/d/2.0/module.html > > > What should be the effect of the following? > > > > import std.stdio; > > > > template gnomeSaying(T, U, V, string s) > > { > > writefln(s ~ " motherfucker"); > > } > > An error, since a function call is not a DeclDef.
OK, I didn't look there - perhaps a definition in 'Decalrations' would make thing easier. But then I wonder, since a plain old string is acceptable as a template parameter, why I can't use a statement that does not involve any of the other template arguments. Also, would it be reasonable for the compiler to issue a warning or error message to the effect that T, U, and V were never mentioned in the template body. What is the basic difference between Templates and Macros - the declarations thing is obviously crucial, but why?
