Re: No permission to modify static procedure
"Lumj" <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
Fragile module. :( ------------------ Original ------------------ From: "Paulo Moura";<[email protected]>; Date: Mon, Jan 20, 2014 10:15 AM To: "SWI-Prolog"<[email protected]>; Subject: Re: [SWIPL] No permission to modify static procedure On 20/01/2014, at 01:44, Lumj <[email protected]> wrote: > Ok..maybe I didn't address my question clearly enough. > > I have no intention to redefine the built-in predicate, I just happen to pick 'write' as the name for the display predicate for my custom objects, and expect the system to resolve foo:write(foo). If I am not allowed to use the name used by built-in predicate, I have to name it something like 'foo_write'. Is there any reason for the system not to allow this name-hiding? One reason may be that allowing redefinition of built-in predicates may make single pass compilation more difficult or impractical as the redefinition may follow its use. But a lingering problem here is that you can pick a nice predicate name that's not a built-in predicate today but that may become a built-in predicate tomorrow. For example, looking only to the ISO standard, recent revisions add a few more built-in predicates (admittedly, most of them being de facto standard predicates). This means that the code the compiles fine today may fail to compile tomorrow. It's worse if you're writing portable code as the set of built-in predicates varies with Prolog compilers (this, btw, is one of the reasons why Logtalk supports redefinition of built-in predicates within objects and categories). That said, code that's not maintained eventually rots. In the end, it's all about design decisions. Cheers, Paulo ----------------------------------------------------------------- Paulo Moura Logtalk developer Email: <mailto:[email protected]> Web: <http://logtalk.org/> ----------------------------------------------------------------- _______________________________________________ SWI-Prolog mailing list [email protected] https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog -------------- next part -------------- HTML attachment scrubbed and removed