Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
manual: ellipses in examples #1765
As suggested in #1209, this PR proposes to add the ability to elide some of the content in the
module M = struct [@@@ellipsis.start] type t = T let x = 0 [@@@ellipsis.stop] end let f = fun (type t) (foo : t list) -> assert false[@ellipsis]
module M = struct … end let f = fun (type t) (foo : t list) -> …
in the manual text.
As an illustration, I translated the locally abstract type section of the extension chapter to
This PR also adds a notion of textual transformation to
gasche left a comment
The code looks very reasonable to me.
Do I correctly understand that the current handling of "transform intersection" forbids having a warning/error location that contains an ellipsis? Isn't that something that we could want to have in the future? If yes, and you see a way to enable it that is not too much work, maybe that could be nice.
(I regret not trying to merge #1209 earlier because we are giving ourselves more rebase work by having one giant PR instead of merging whatever is ready when it's ready.)
I added the possibility of eliding strict subset of underlined interval. The complextity increase seems moderate.
May 7, 2018
added a commit
this pull request
May 7, 2018
referenced this pull request
May 7, 2018
I still think that using extension points would be better here. Even with we fix a handful of cases of the iterator, we still have the problem that some attributes are not located, so the technology cannot be correct without parsetree changes, and I don't really like that. (Although we can fix the attribute locability in trunk later.)
Another point to put in the balance, that I forgot before starting the extension node implementation, is that some extension nodes do not have a corresponding payload: typically node extension can replace class expression, class field or module types; but payloads are either structure, signature or patterns.
class c = object [%ellipsis method m = ( ) ] end
is invalid due to the payload, and the closest valid option would be
class c = object [%ellipsis object method m = ( ) end ] end