Julia Community

Discussion on: Oxygen.jl: A breath of fresh air for programming web apps in Julia

Collapse
melonedo profile image
melonedo • Edited on

I am so exited to see that Julia finally have a web server that does not heavily rely on global states! It feels much more "Julian" than existing frameworks.

By the way, I am very interested in how you implement the @route macro, because it does not seem obvious to me how to manipulate a function by its signature. In python it is done with a special annotation system, how do you do that in Julia?

Collapse
ndortega profile image
Nathan Ortega Author

That's a great question! And one that was difficult for me to figure out as well. It involved a lot of googling and reading into the Base library documentation

Essentially, there's a low-level api just for methods that's pretty good at extracting useful information. I was able to extract the number of function arguments and their types, but was unable to get the name of each variable.

I found a snippet in the julia forums that did exactly what I needed and modified it a bit to return strings instead of symbols.

(get parameter names)
github.com/ndortega/Oxygen.jl/blob...

(get parameter types & count)
github.com/ndortega/Oxygen.jl/blob...

(low-level api)
docs.julialang.org/en/v1/base/base...