Semicolons inside function declaration

I am picking up a stale package that reads a specific type of text file (IGC file if anyone out there flies gliders).

I have seen a few instances of including a semi-colon inside the function declaration, like

function read(fname::AbstractString, ::Type{IGCDocument}; parsing_mode=ParsingMode.DEFAULT, store_all_records=DEFAULT_STORE_ALL_RECORDS)
    stream = open(fname)
    return parse(IGCDocument, stream, parsing_mode=parsing_mode, store_all_records=store_all_records)

I can’t find any reason for that documented. The code base is about 4 years old. Is this an obsolete syntax?

I appreciate the help, I tried to separate to independent questions. One question was the “type annotation with no name”, the other was “semi colon in the function declaration”. I am seeing how the first works. Can you clue me in on the semi colon?

This separates positional arguments from keyword arguments


Sorry about that - I think I was biased by the previous one :slight_smile:

@gdalle provided the answer.

julia> f(a, b) = a + b
f (generic function with 1 method)

julia> g(a; b) = a + b
g (generic function with 1 method)

julia> f(1, 2)

julia> g(1, 2)
ERROR: MethodError: no method matching g(::Int64, ::Int64)

Closest candidates are:
  g(::Any; b)
   @ Main REPL[2]:1

 [1] top-level scope
   @ REPL[4]:1

julia> g(1; b=2)

@algunion I appreciate the help, the “Holy Trait” was new to me and didn’t come up in any of the searching I did.

1 Like

@gdalle Tricky, thank you that explains something else i saw in that code base.

1 Like

You can find documentation for this syntax here: Functions · The Julia Language

1 Like

@dylanxyz. Thank you.