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

yurivish picture yurivish  路  3Comments

ararslan picture ararslan  路  3Comments

helgee picture helgee  路  3Comments

felixrehren picture felixrehren  路  3Comments

wilburtownsend picture wilburtownsend  路  3Comments