Hooking... I can't figure out how to do it.

View: New views
2 Messages — Rating Filter:   Alert me  

Hooking... I can't figure out how to do it.

by John Ohno :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey. I'm once again working with prolog (after a decently long hiatus
doing more or less nothing), and I came back with some neat, useful
ideas -- however, several of them involve hooking into existing SWI
Prolog hooks.

Now, seeing as these hook functions are documented as such, I wouldn't
think there would be a problem, but apparently I was wrong, as
exporting my hook makes the compiler complain about a name clash. I
suppose then that I need to do something to make it overwrite what
it's supposed to, but I'm blanking on how. I probably can't set the
pred as dynamic after the fact, and I doubt that I can use an assert
without it being dynamic. If there is a pred used specifically for
overwriting existing preds (maybe something with a name like
assert_force/2 or something), maybe that might be what I'm looking
for. The docs list preds to hook, but for the life of me I can't find
how to hook them.

Thanks,
~ John

--
Name: John Ohno
SL: Enki Stardust
AIM: unknown1570
Yahoo: digitalsoul286
Skype: john.ohno
MySpace: http://myspace.com/unknown1570

President/Lead Developer,
Accela Labs
(http://accela-labs.com)
 "I feel... Accelerated"

------------
For further info, please visit http://www.swi-prolog.org/

To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>"
in its body to majordomo@...




Re: Hooking... I can't figure out how to do it.

by John Ohno :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Er. Forget it. I think I got it working. There's just a bug (or a
misfeature?) involving not being able to import a hooked pred from one
module to another without kluging it all up. *sigh*

Cutting/pasting the hook from a utility module to every module I need
it in ended up working, it seems.

On 5/30/08, John Ohno <john.ohno@...> wrote:

> Hey. I'm once again working with prolog (after a decently long hiatus
>  doing more or less nothing), and I came back with some neat, useful
>  ideas -- however, several of them involve hooking into existing SWI
>  Prolog hooks.
>
>  Now, seeing as these hook functions are documented as such, I wouldn't
>  think there would be a problem, but apparently I was wrong, as
>  exporting my hook makes the compiler complain about a name clash. I
>  suppose then that I need to do something to make it overwrite what
>  it's supposed to, but I'm blanking on how. I probably can't set the
>  pred as dynamic after the fact, and I doubt that I can use an assert
>  without it being dynamic. If there is a pred used specifically for
>  overwriting existing preds (maybe something with a name like
>  assert_force/2 or something), maybe that might be what I'm looking
>  for. The docs list preds to hook, but for the life of me I can't find
>  how to hook them.
>
>  Thanks,
>  ~ John
>
>  --
>  Name: John Ohno
>  SL: Enki Stardust
>  AIM: unknown1570
>  Yahoo: digitalsoul286
>  Skype: john.ohno
>  MySpace: http://myspace.com/unknown1570
>
>  President/Lead Developer,
>  Accela Labs
>  (http://accela-labs.com)
>   "I feel... Accelerated"
>


--
Name: John Ohno
SL: Enki Stardust
AIM: unknown1570
Yahoo: digitalsoul286
Skype: john.ohno
MySpace: http://myspace.com/unknown1570

President/Lead Developer,
Accela Labs
(http://accela-labs.com)
 "I feel... Accelerated"

------------
For further info, please visit http://www.swi-prolog.org/

To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>"
in its body to majordomo@...