-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Elpi Db mydb lp:{{ <code> }}
not the same as Elpi Db mydb lp:{{ }}. Elpi Accumulate mydb lp:{{ <code> }}
#721
Comments
About global/superglobal, I always forget it, but IIRC with superglobal you obtain that if the db exists, then the extra code is also there, even if you don't require the file defining the db directly. Global would work if you require it, but not if it is required transitively. |
I doubt that, libobject does not tell you if a |
This is what we wrote recently, but I can't understand it no more let load i ((_,kn),s as o) =
if Int.equal i 1 ||
(s.scope = Coq_elpi_utils.Global && is_inside_current_library kn) ||
s.scope = Coq_elpi_utils.SuperGlobal then cache o in |
So I think we made "global" only apply to the current library |
There is also the open function.
should be equivalent to
|
thanks, this explain why global is not enough for @Janno |
I do not understand your two equivalent examples at all. It seems intuitively wrong to me. Could you make it more concrete with |
The example works when |
Oh, now I understand. What is the reason for that behavior? Why does it make sense to deviate from the usual interpretation of these locality annotations? |
Note that modules M and N are generated in elpi, and once both are still ongoing, one does an elpi.accumulate-clauses with scope If the scope is not |
(This came up again this week in https://coq.zulipchat.com/#narrow/channel/253928-Elpi-users-.26-devs/topic/Elpi.202.2E0.20.28beta.20testers.29/near/484771703 and also featured (less prominently) in https://coq.zulipchat.com/#narrow/channel/253928-Elpi-users-.26-devs/topic/Unknown.20Db.20in.20clients.20of.20elpi.20command.20in.208.2E19 at the beginning of the year.)
It seems counter-intuitive that the following two snippets do not have the same effect in clients that
Require
(but do notImport
) the file.versus
The former will make
<code>
available to all clients that can see or otherwise interact withmydb
but the latter only does so for clients that actuallyImport
the effect.The correct incantation seems to be
While this works, it is also somewhat surprising because I would expect
#[global]
to play the role of#[superglobal]
here. But maybe that could easily be changed. Or maybe there is a good reason for not using#[global]
?In any case, I wonder if it might be more consistent to separate the effect of having created the database from the effect of putting code into it and allowing/requiring
#[superglobal]
(or just#[global]
) on bothElpi Db
andElpi Accumulate
to make the effect of putting the code into the database truly global. The creation of the database should likely always be global. Of course, there is a danger of this being differently confusing when people expect the omission of#[global]
onElpi Db
to also affect the effect of creating the database.The text was updated successfully, but these errors were encountered: