dmerrio:
> import main; //class definition of rng
> import std.math; //trig functions
> import std.conv; //to!double
> import std.string; //toupper
>
> double transFunc(alias transedentalFunc)(rng aRng){
> try{return(transedentalFunc(aRng.getCellValue().coerce!
> (double)));} //cellValue stored as a Variant
> catch{return(transedentalFunc(to!double(aRng.getCellValue
> ().coerce!(string))));} //replicate spreadsheet behavior and
> convert to a number
> }
>
> //Example 1 of boilerplate code
> double SIN(double aReal){return(sin(aReal));}
> double SIN(string aStr){return(sin(to!double(aStr)));}
> double SIN(rng aRng){return(transFunc!(sin)(aRng));}
Mine is not an answer that directly helps you solve your problem. Experience
shows that messy code doesn't help you see your problems, and sometimes it even
hides bugs. So I suggest you to reformat your code in a more human way, use
more normal naming conventions, and use named imports if you want to import
just some names.
This means writing:
import std.conv: to;
Instead of:
import std.conv; //to!double
To put a newline before the closing brace, to add spaces and newlines where
they are belong, and so on. This helps a lot.
Bye,
bearophile