Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicit "end" for file-wide modules. #16402

Closed
manor opened this issue May 17, 2016 · 3 comments
Closed

Implicit "end" for file-wide modules. #16402

manor opened this issue May 17, 2016 · 3 comments

Comments

@manor
Copy link

manor commented May 17, 2016

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?

@StefanKarpinski
Copy link
Sponsor Member

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

@JeffBezanson
Copy link
Sponsor Member

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?

@vtjnash vtjnash closed this as completed May 17, 2016
@StefanKarpinski
Copy link
Sponsor Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants