{"action":"opened","issue":{"url":"https://api.github.com/repos/SWI-Prolog/swipl-devel/issues/163","repository_url":"https://api.github.com/repos/SWI-Prolog/swipl-devel","labels_url":"https://api.github.com/repos/SWI-Prolog/swipl-devel/issues/163/labels{/name}","comments_url":"https://api.github.com/repos/SWI-Prolog/swipl-devel/issues/163/comments","events_url":"https://api.github.com/repos/SWI-Prolog/swipl-devel/issues/163/events","html_url":"https://github.com/SWI-Prolog/swipl-devel/issues/163","id":174574707,"number":163,"title":"Rollback retract/1 change, possibly too risky.","user":{"login":"jburse","id":5411487,"avatar_url":"https://avatars.githubusercontent.com/u/5411487?v=3","gravatar_id":"","url":"https://api.github.com/users/jburse","html_url":"https://github.com/jburse","followers_url":"https://api.github.com/users/jburse/followers","following_url":"https://api.github.com/users/jburse/following{/other_user}","gists_url":"https://api.github.com/users/jburse/gists{/gist_id}","starred_url":"https://api.github.com/users/jburse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jburse/subscriptions","organizations_url":"https://api.github.com/users/jburse/orgs","repos_url":"https://api.github.com/users/jburse/repos","events_url":"https://api.github.com/users/jburse/events{/privacy}","received_events_url":"https://api.github.com/users/jburse/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-01T16:58:19Z","updated_at":"2016-09-01T16:58:19Z","closed_at":null,"body":"The current atomicity of erase/1 seems to be sufficient, to bootstrap\r\nalternative realization of retract/1 such as:\r\n\r\n```\r\nretract_alt(V) :- var(V),\r\n   throw(error(instantiation_error,_)).\r\nretract_alt((H :- B)) :- !,\r\n   clause(H, B, R), erase(R).\r\nretract_alt(H) :-\r\n   clause(H, true, R), erase(R).\r\n``` \r\n\r\nBut it seems a little bit to risky to override the retract/1 semantics,\r\nafter changing the erase/1 semantic. Reason: Too many Prolog systems\r\nimplement the old semantic, see below.\r\n\r\nBut the new erase/1 semantic and the old retract/1 semantic could\r\nco-exist. The old semantic retract/1 can even be bootstrapped from \r\nthe new erase/1 as follows:\r\n\r\n```\r\nretract(V) :- var(V),\r\n   throw(error(instantiation_error,_)).\r\nretract((H :- B)) :- !,\r\n   clause(H, B, R), ignore(erase(R)).\r\nretract(H) :-\r\n   clause(H, true, R), ignore(erase(R)). \r\n```\r\n\r\nBye\r\n\r\nP.S.: Here are the test results for many Prolog systems:\r\n\r\nISO core standard page 81, examples 8.9.3.4:\r\n\r\n```\r\n   :- dynamic insect/1.\r\n   insect(ant).\r\n   insect(bee). \r\n```\r\n\r\n3) GNU Prolog 1.4.4 (64 bits)\r\n   Compiled Apr 23 2013, 16:05:07 with cl\r\n\r\n```\r\n   ?- retract(insect(I)), write(I), nl,\r\n   retract(insect(bee)), fail; true.\r\n   ant\r\n   bee\r\n\r\n   yes\r\n```\r\n\r\n4) ECLiPSe Constraint Logic Programming System [kernel]\r\n   Version 6.1 #222 (x86_64_nt), Thu Jul  7 16:02 2016\r\n\r\n```\r\n   [eclipse 3]: retract(insect(I)), write(I), nl,\r\n   retract(insect(bee)), fail; true.\r\n   ant\r\n   bee\r\n\r\n   I = I\r\n   Yes (0.00s cpu)\r\n```\r\n\r\n5) Ciao 1.15-1781-g328b907: Wed Jun 19 00:06:05 PST 2013\r\n\r\n```\r\n   ?- retract(insect(I)), write(I), nl,\r\n   retract(insect(bee)), fail; true.\r\n   ant\r\n   bee\r\n\r\n   yes\r\n```\r\n\r\n6) B-Prolog Version 8.1, All rights reserved,\r\n   (C) Afany Software 1994-2014.\r\n\r\n```\r\n   ?- retract(insect(I)), write(I), nl,\r\n      retract(insect(bee)), fail; true.\r\n   ant\r\n   bee\r\n\r\n   yes\r\n```\r\n"}}
{"actor":{"display_login":"jburse"}}