@rdeits My complete code reads the value for “nelementnodes” from an input text file. The input text file can have a different value for nelementnodes from run to run. Will this approach (value type argument) still work as intended?
As long as you create your types outside the function that do the core computation, you are fine.
Sure! As long as your code looks something like:
function main(filename) nelementnodes = read_data_from_file(filename) long_running_computation(Val(nelementnodes)) end
then you should be fine. There’s a computational cost to constructing a
Val from a run-time value, but that cost is only a few hundred nanoseconds and you’re only paying it once per call of
long_running_computation, so that should be completely negligible.