I've seen this type of function generation in other packages, and wanted to try it for myself. This file in Twitter.jl has 5 functions with the same overall structure:
https://github.com/randyzwitch/Twitter.jl/blob/master/src/help.jl Here's what I ended up doing, which works, but I've got no idea why I had to write the string interpolation the way I did. I went through many permutations here, so if someone could explain why the `:($(string("https://api.twitter.com/1.1/", $endp))` line needs to be written that way for string interpolation, it would be appreciated. And any improvements in general are welcome. funcname = (:get_help_configuration, :get_help_languages, :get_help_privacy, :get_help_tos, :get_application_rate_limit_status) endpoint = ("help/configuration.json", "help/languages.json", "help/privacy.json", "help/tos.json", "application/rate_limit_status.json") for (func, endp) in Dict(funcname, endpoint) @eval begin function ($func)(; options=Dict{String, String}()) r = get_oauth(:($(string("https://api.twitter.com/1.1/", $endp))), options) return r.status == 200 ? JSON.parse(r.data) : r end end end Thanks!
