Julia: Implicit "end" for file-wide modules.

Created on 17 May 2016  ·  3Comments  ·  Source: JuliaLang/julia

Having two consecutive "end" keywords with the same indentation level looks like an error, but in order to avoid this at the end of a module containing e.g. function definitions one needs to indent the entire content of the module (which typically means the entire file). If a file starts with a module declaration, could we not consider that the matching "end" as implicitly provided at the end of the file?

Most helpful comment

My "just use a pencil" solution to this is to always write the end that follows a module like this:

module Foo

function bar()
    # do stuff
end

end # module

All 3 comments

My "just use a pencil" solution to this is to always write the end that follows a module like this:

module Foo

function bar()
    # do stuff
end

end # module

Yes, I'm not sure this is worth a special case. It also gets more confusing with nested modules --- should end-of-file close all open modules, or only the outermost one?

At some point in the future, we may want to consider a module loading mechanism where you don't have to write module Foo ... end in the file, which could have other benefits as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wilburtownsend picture wilburtownsend  ·  3Comments

ararslan picture ararslan  ·  3Comments

thofma picture thofma  ·  3Comments

helgee picture helgee  ·  3Comments

omus picture omus  ·  3Comments