public/private with no indentation #1180
Labels
design needed
We need to specify precisely what we want
language
Changes or extensions to the language
parser
Issues with lexing or parsing.
Currently public and private blocks require indentation of the declarations containing them, which can be a bit annoying if one has a lot of
private
declarations. With the changes in #1179 one could put all private declarations at the end of the file, but that's still a bit awkward.It doesn't really make sense to nest public and private blocks, so here are a few ways to make code like this work:
One option would be to treat
public
/private
not as a layout starting construct, but as a top-level declaration, with the meaning that the following declarations are public or private. This is simple, but unfortunately is not backward compatible, as if one did indent the declarations (as it is done in current code), things would break---now there is no layout block, so no semis will be added in the right places.Another way would be to keep
public
andprivate
as layout starting constructs, but modify the parser to allow nesting them. The idea is that after parsing we'd flatten the nested declarations into a list, which would match the order of declarations of the file. This (assuming the fix suggested in #1179) is, I think, a backward compatible way to support piblic/pribate without the need for indentation.The text was updated successfully, but these errors were encountered: