Folding similar templates into one
monarch_dodra
monarchdodra at gmail.com
Fri Jun 28 06:25:53 PDT 2013
On Thursday, 27 June 2013 at 02:03:52 UTC, Meta wrote:
> I'd like to ask, however, why should this be? The arguments
> line and file will only ever be strings and ints. They don't
> vary in type, only value, and changing those values will not
> affect how the function works. You could easily substitute out
> "exception.d" with "stdio.d", and the functionality will be
> unchanged.
Just because the arguments are known 99% of the time at compile
time, doesn't mean they should be parameters. Parameters
shouldn't be used to just mean "compile time" anyways, but
*specifically* to create different versions of a function or
code, which in this case, is not the case at all.
Besides, there are scenarios where you could pass these as
runtime parameters from higher functions, if you want the
exception to "look" like it came from a higher level call. Making
these parameters would mean that *any* function that handles
lines or filenames would have to be parameterized on that.
More information about the Digitalmars-d
mailing list