-
Notifications
You must be signed in to change notification settings - Fork 9
Custom operators #57
Comments
Also not sure if we should repeat the arguments in the end call. (i.e. |
@maowtm, thanks for summarizing the discussion. This feels like a macro
Do we need overlapping regions? It will be even more interesting if it was possible to define custom cache invalidation conditions. For example, define cache invalidation conditions for git/hg/svn, etc, given some basic intrinsics. |
Yes, and in fact if we don't consider any internal implementation at all what I had is actually quite a bad syntax. Your macro-style definition is much better IMO. But I just proposed this because it is easy to implement and fits into our internal model. A bit of leaky abstraction I guess.
Probably not.
Not sure how this would work and what would be the use, as usually people would want to rebuild the thing if source has a new commit...? |
I had a discussion with @barr, and he suggested to use operators that define conditions of cache invalidation. We were thinking of something like that:
This is just a rough sketch of the API. |
Or maybe something like |
I discussed this with @mechtaev in chat before we decided to put everything on GitHub so it's more visible. Here is a recall of the basic idea...
Previously it was decided that operators would be implemented as "start/end" internal predicates, so
will become
when translating to the IR, where
merge_begin
andmerge_end
would actually not be accessible to the user.However when implementing it I thought that there is really no reason why we have to forbid any manual usage of these "intrinsics", since they do not break any datalog logic. We could have a defined way to name and use them, for example
_predicate_merge_begin
(...end
) which both takes an "ID" argument to indicate paring, and any::merge
would be translated into those. They will be "intrinsics" in the sense that "run" is an intrinsic - the SLD solver just treats them as always true (as long as it is fully grounded), and they are really only meant to be interpreted by any image generation code.However, by allowing user access to this "special" namespace, we could allow them to define their own operators. Consider the following Modusfile:
Note that the
with_std
operator is "defined" in the last two line.I do admit that this just feels too much like a hack, so maybe it's better to hide this
_predicate
namespace after all and, if needed, have some other way to define operators.The text was updated successfully, but these errors were encountered: