Drop findlib:x syntax and display an error message#887
Conversation
|
I might be misunderstanding something, but the plan was to remove the findlib vars only in dune projects. It should still be available in jbuild projects. |
|
Ok! I'll fix that! |
|
BTW, we are currently refactoring the S-expression parsing API so that we can write versioned parsers more conveniently. Currently it is painful to do. @NathanReb you should probably wait until we finish this work as it will be much easier to adapt this PR once the new API is in place. |
|
@NathanReb if you rebase on the current master, you can now access the version of the syntax in the S-expression parser via |
|
Cool! I'll look into it today, sry for the delay! |
|
Ok so I started working on this. There's a now a test case for the jbuild backward compatiblity, it just lacks the implementation :) From what I understand you can extract the syntax at parsing time using
|
|
Actually, I believe @rgrinberg added a way to access the syntax when expanding variable in #905 |
This is usually because a As diml pointed out, I have a way to access the syntax of the variable at expansion time which you might find useful. Though I think that doing this checking at parsing time as you're trying to is also alright. |
|
I had another look at this while I'm reading #905. We indeed need to keep more than just @NathanReb, I was indeed thinking about keeping this information at the level of actions, but actually keeping it in We can pass the syntax version stored in
What tests are failing? The version of the syntax is implicitly passed to s-expression parsers. The failure might be due to a place where we forgot to fill it in. |
|
I don't think it actually runs any test, it just crashes with an internal error before that. Here's the error: and here's the content of |
|
Ah, it's a case we found recently. I believe this one is fixed by #905 |
|
Ok, in the meantime I'll into how to get read of |
|
#905 is now merged in master |
|
I pushed some changes:
This is still not ready though because I need to set the syntax version for |
|
Looking at how |
|
I guess you can make just document that |
|
You can probably extract a |
Signed-off-by: Nathan Rebours <nathan@cryptosense.com>
|
Just made |
|
Looks good, thanks! |
| (jbuild_version 1) | ||
|
|
||
| (rule | ||
| (write-file target.txt ${findlib:pkg:file}) |
There was a problem hiding this comment.
Btw, it would be nice to standardize on the formatting here. Have a look at the other dune files for how format this stuff.
Having another look at the PR, I find this point less convincing now. The way I see The entity that seems to be versioned here is the expansion functions themselves rather than the templates. In any case, I don't think it's worth to hold up the PR because of this. Since the variable expansion system needs a bit of a renovation to handle things such #928 better, so I approve once all the dune and jbuild files are correctly formatted. |
|
@rgrinberg the versions that users write in their Regarding the formatting, eventually we should have (BTW, there seem to be an issue with the DCO bot, it's stuck again) |
|
On Sat, Jun 30, 2018, 3:35 AM Jérémie Dimino ***@***.***> wrote:
@rgrinberg <https://github.com/rgrinberg> the versions that users write
in their dune-project file should control alll the features that are
available. From a usability point of view, adding, removing or renaming a
variable is the same as adding, removing or renaming a stanza, so it seems
natural to me that to use the version numbers for both.
I agree that our versioning applies to adding or removing variables. It's
just that I see it as versioning the variables and not the templates. I.e.
if we have a single template %{foo}, we should be able to expand it with
different versions of the syntax. E.g. if we somehow load a subsystem from
a jbuild file but expand it in a dune rule, then we should use dune's
variable definitions.
Regarding the formatting, eventually we should have dune pp that would
automatically format dune files like ocamlformat automatically format
OCaml source files. Then we could have a target to reformat all the files,
but in the meantime let's not be too fussy about the formatting inside
blackbox tests.
That's a good idea. Maybe call it dune fmt? As we'd the command to just
update the dune files in the working tree.
… |
Actually, I think in this case we should use jbuild's definitions. The reason for that is the the author of the subsystem controls the definition of the subsystem but doesn't know where the subsystem is going to be used. If we used dune's definition, the interpretation of variables might not be the same as the one where the subsystem was defined, which doesn't seem right. |
|
👍 for dune fmt. I think I heard something about an autoformatter for s-expressions, surely Jane Street uses one internally? |
|
Yh, we have one. I haven't finished preparing for release. The only problem is that it has a few dependencies. Additionally it is not aware of what is field, a constructor etc... in dune files. |
|
OK, I'll open an issue so that we can discuss/coordinate over there. |
|
Thanks @emillon I also think that we should just roll our own formatter. We already pretty print sexps in many other places anyway. |
Hi
Description
This removes the support for the
${findlib:x}syntax as mentionned in #842. An informative error message is displayed whenever the old syntax is encountered, suggesting to use${lib:x}instead.Questions
We weren't sure whether it should still be supported in
jbuildfiles so we just dropped support there as well. Let me know if we should change that!cc @emillon