On Sunday, 8 April 2012 at 05:41:11 UTC, Andrei Alexandrescu
wrote:
3) "benchmark_relative_file read" should be replaced with a
language
construct. E.g. a function call like relativeBenchmark("file
read"), or
an enum value like getopt's.
No can do. Need a function name-based convention so we can
automate scheduleForBenchmarking.
Hmm, maybe there's a misunderstanding, but what I meant was:
The "benchmark_relative_" prefix makes sense for function names
(for scheduleForBenchmarking), but not so much for string
literals for benchmark names. The string literal
"benchmark_relative_file read" looks like the words "benchmark
relative file" are grouped together, with "read" added on. So, my
suggestion would be to wrap the "benchmark_relative_" prefix -
when used with benchmark name strings - into a semantical
function / enum / etc. In my example above, relativeBenchmark
would be:
string relativeBenchmark(string s) { return "benchmark_relative_"
~ s; }
I suppose it can be summed up as a tradeoff between complexity
(you need to explain both the function name usage and the
relativeBenchmark wrapper usage) vs. code prettiness.