Re: No permission to modify static procedure
Jan Wielemaker <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 01/19/2014 04:05 PM, Lumj wrote: > Is it possible to write a module in which there's a predicate write/1? > When I try to do this, I got the 'No permission to modify static procedure' error. What I intend to do is to have a write/1 in my module and the system:write/1 remain where it is. > Module file attached: > :-module(m,[write/1]). > write(x). > Am I missing anything? ISO doesn't allow for redefining system predicates. There is a good reason for it: it would not be able to perform any kind of optimization to ISO predicates. For example, several predicates are mapped directly to virtual machine instructions. If the definition was not fixed, this would be impossible. There is a directive redefine_system_predicate/1 that overrules this (if it still works). That was mostly added to redefine stuff to gain compatibility to older versions or other systems. I doubt you can export such modified versions though. If you do not use redefine_system_predicate/1 in the receiving module, you get the same check and if you do, I think you'll also running into trouble. At least, there is no guarantee for the future. For short, I think you are on the wrong track for healthy usage of Prolog. What are you after? Cheers --- Jan