I know that block comments in Julia is officially #= ... =#. I also know that multiline strings are """ ... """.
However, I have seen a lot of source codes use """ ... """ on the top of the file to write documentation, and Julia seems to interpret this as a comment (for instance: Flux.jl).
My question is: if I use """ ... """ for any type of lengthy, multiline comments (e.g. describing function parameters), would there be any type of downside over using #= ... =#? I would like to know any performance penalties, potential side effects during parsing, etc... Why would one use #= over """, other than personal preference?
""" in front of the function are docstrings that are later seen by Julia's help system (e.g. when you type ?funnctionname or can be used for automated documentation generation that is usually integrated into CI processes with tools such as Travis).
To understand what is going on, try this simple Julia session:
julia> """
myfoo(bar::AbstractVector)
Returns the length of `bar`
"""
myfoo(bar::AbstractVector) = length(bar)
myfoo
help?> myfoo
search: myfoo
myfoo(bar::AbstractVector)
Returns the length of bar
julia>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With