Skip to content

Rename SCOPE_ROOT, ${@}, ${^}, etc. - #957

Merged
rgrinberg merged 10 commits into
ocaml:masterfrom
rgrinberg:rename-scope-scope-root
Jul 6, 2018
Merged

rgrinberg merged 10 commits into
ocaml:masterfrom
rgrinberg:rename-scope-scope-root

Conversation

@rgrinberg

Copy link
Copy Markdown
Member

No description provided.

@rgrinberg
rgrinberg requested review from a user and emillon July 5, 2018 17:44
@rgrinberg
rgrinberg force-pushed the rename-scope-scope-root branch from 8d34557 to 5e42bde Compare July 5, 2018 17:59
@rgrinberg

Copy link
Copy Markdown
Member Author

The code duplication is temporary as I have a plan to clean this up after this and #956 are merged.

@emillon

emillon commented Jul 5, 2018

Copy link
Copy Markdown
Collaborator

I started to work on this, but for now I only had some test cases, so I'll open a separate PR for these.

@rgrinberg

rgrinberg commented Jul 6, 2018 via email

Copy link
Copy Markdown
Member Author

@rgrinberg rgrinberg changed the title Rename scope_root to project_root Rename SCOPE_ROOT, ${@}, ${^}, etc. Jul 6, 2018
@rgrinberg rgrinberg mentioned this pull request Jul 6, 2018
@emillon

emillon commented Jul 6, 2018

Copy link
Copy Markdown
Collaborator

No problem! I just added the test case in question.

@rgrinberg
rgrinberg force-pushed the rename-scope-scope-root branch from 9289b16 to 0aec29d Compare July 6, 2018 08:56
@rgrinberg

Copy link
Copy Markdown
Member Author

Btw @diml I ended up writing a custom lexer for parsing deps[x] because making it unavailable in bootstrap seems a bit fragile to me. As without ocamllex, I'd have to use re which isn't available there. The other option is a manual parser, but it will be quite ugly.

@ghost

ghost commented Jul 6, 2018

Copy link
Copy Markdown

Ok, PR looks good to me, but as said on slack I think we should get rid of the indexed syntax since it is a bit ad-hoc (it works only for one variable and is not recognized at all in other cases) and we have a better solution almost ready with #950. I suggest to add first-dep or dep0 to replace dep[0] in this PR, and we can get rid of it once we merge #950.

@rgrinberg

Copy link
Copy Markdown
Member Author

I think first-dep is better. dep0 implies that depn exists which isn't true.

@rgrinberg

Copy link
Copy Markdown
Member Author

@diml so is the plan to get rid of first-dep completely btw? I.e. to make people assign names to things if they want to refer to a particular dep.

@ghost

ghost commented Jul 6, 2018

Copy link
Copy Markdown

That seems nicer to me. But we can revisit this decision if it's not good in practice.

Comment thread src/super_context.ml Outdated
if syntax_version < (1, 0) then
first_dep ()
else
Loc.fail loc "Variable '<' is renamed to 'first-dep' in dune"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error messages are not consistent: some say in dune files, some say in dune and some say nothing. in dune files seems best to me

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I made all the errors a little more consistent. Full consistency will probably have to wait for the refactor that makes variable name changes first class.

rgrinberg and others added 10 commits July 6, 2018 18:45
Signed-off-by: Rudi Grinberg <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>
Have %{first-dep} to replace %{<}

Signed-off-by: Rudi Grinberg <[email protected]>
@rgrinberg
rgrinberg force-pushed the rename-scope-scope-root branch from 851a0d9 to b8f11b1 Compare July 6, 2018 11:52
@rgrinberg
rgrinberg merged commit 290fffc into ocaml:master Jul 6, 2018
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

Successfully merging this pull request may close these issues.

2 participants