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?
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.
Most helpful comment
My "just use a pencil" solution to this is to always write the
end
that follows amodule
like this: