{"action":"created","issue":{"url":"https://api.github.com/repos/SWI-Prolog/roadmap/issues/40","labels_url":"https://api.github.com/repos/SWI-Prolog/roadmap/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/SWI-Prolog/roadmap/issues/40/comments","events_url":"https://api.github.com/repos/SWI-Prolog/roadmap/issues/40/events","html_url":"https://github.com/SWI-Prolog/roadmap/issues/40","id":124814950,"number":40,"title":"Implementation of meta_attribute/2","user":{"login":"logicmoo","id":466945,"avatar_url":"https://avatars.githubusercontent.com/u/466945?v=3","gravatar_id":"","url":"https://api.github.com/users/logicmoo","html_url":"https://github.com/logicmoo","followers_url":"https://api.github.com/users/logicmoo/followers","following_url":"https://api.github.com/users/logicmoo/following{/other_user}","gists_url":"https://api.github.com/users/logicmoo/gists{/gist_id}","starred_url":"https://api.github.com/users/logicmoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/logicmoo/subscriptions","organizations_url":"https://api.github.com/users/logicmoo/orgs","repos_url":"https://api.github.com/users/logicmoo/repos","events_url":"https://api.github.com/users/logicmoo/events{/privacy}","received_events_url":"https://api.github.com/users/logicmoo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-01-04T18:47:31Z","updated_at":"2016-01-20T23:27:41Z","closed_at":null,"body":"This predicate is used to declare a variable attribute and/or the corresponding handlers. The Name is usually the name of module where this attribute is being defined and used. The unqualified use of attributed variables, i.e. terms in the form Var{Attr} is allowed only in modules which have a defined attribute name, otherwise the qualified usage Var{Name:Attr} is required.\r\nThe Handlers argument specifies a list of handler predicates for several built-in operations which require user-defined actions whenever an attributed variable is encountered. The list contains elements in the form Operation:Pred, where Operation is the predefined name of the built-in operation and Pred is the handler predicate specification. The handler definition module is assumed to be the module in which meta_attribute/2 is being called; another module can be specified by using the tool body predicate meta_attribute_body/3. When true/0 is specified as the handler or when no handler for a particular operation is specified, this operation will ignore this extension. If the extension Name already exists, the specified handlers are updated, the non-specified ones remain.\r\n\r\nThe call meta_attribute(Name, []) can be used as a preliminary declaration of a particular attribute, e.g. to compile a module part before the actual declaration is called, or when processing separate files that belong to a particular module.\r\n\r\nMost of the C code for this I already tested out to work .. \r\n\r\nDocs at  http://eclipseclp.org/doc/bips/kernel/termmanip/meta_attribute-2.html\r\n\r\n95% of the O_FLUENT patch was in order to make meta_attribute/2 possible.. I backed that out of the workflow since I didn't want it to slow down verify_attributes/3 workflow \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/SWI-Prolog/roadmap/issues/comments/173400100","html_url":"https://github.com/SWI-Prolog/roadmap/issues/40#issuecomment-173400100","issue_url":"https://api.github.com/repos/SWI-Prolog/roadmap/issues/40","id":173400100,"user":{"login":"triska","id":7482140,"avatar_url":"https://avatars.githubusercontent.com/u/7482140?v=3","gravatar_id":"","url":"https://api.github.com/users/triska","html_url":"https://github.com/triska","followers_url":"https://api.github.com/users/triska/followers","following_url":"https://api.github.com/users/triska/following{/other_user}","gists_url":"https://api.github.com/users/triska/gists{/gist_id}","starred_url":"https://api.github.com/users/triska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/triska/subscriptions","organizations_url":"https://api.github.com/users/triska/orgs","repos_url":"https://api.github.com/users/triska/repos","events_url":"https://api.github.com/users/triska/events{/privacy}","received_events_url":"https://api.github.com/users/triska/received_events","type":"User","site_admin":false},"created_at":"2016-01-20T23:27:41Z","updated_at":"2016-01-20T23:27:41Z","body":"The point is that *after* the unification of two variables, only a single variable remains, so it also makes sense that users only have to update the attributes of **one** of the two variables in the hook. By convention, in `verify_attributes/3`, it is the **second** variable whose attributes are updated in the hook and need to be retained after the unification.\r\n\r\nWhen the hook is called, at least semantically, it need not necessarily be the oldest or youngest variable that is the first or second argument, and in fact it makes sense to not even rely on such a property, and not even guarantee or document at the user level the way this is done. At the implementation level, there may be of course good reasons to prefer one way over the other, and for predictable results, it also makes sense to keep it consistent.\r\n\r\nAt the user level, what matters is: Which variable's attributes are retained after the hook? **That** needs to be 100% consistent and predictable for users, and by established convention, it must be those of the `Value`, i.e., the second argument of `verify_attributes/3` if both arguments are variables."}}