Thank you, both. Combined with your suggestions and some more fiddling I
got it to work; see below. This doesn't use all the ideas you suggested, so
it probably not the most elegant solution. I'll try to understand your
other suggestions and incorporate them. Many thanks again,
Christoph
module Test
using Docile, Lexicon, Compat
export ffun
macro protofun(fname, argtypes...)
docstr = argtypes[end]
argtypes = argtypes[1:end-1]
str = "@doc doc\"$(docstr)\"->\nfunction $(fname)("
for n = 1:length(argtypes)
str *= string("arg", n, "::", argtypes[n], ", ")
end
str = str[1:end-2]
str *= ") \n"
str *= " error(string(\"AtomsInterface: `$(string(fname))(\", "
for n = 1:length(argtypes)
str *= string("\"::\", typeof(arg", n, ")")
if n < length(argtypes)
str *= ", \", \", "
end
end
println(str)
eval(parse(str))
end
@protofun(ffun, Number, String, "yads")
end