From p.singleton@keele.ac.uk  Tue Feb 29 01:17:32 2000
Received: from mail3.svr.pol.co.uk (mail3.svr.pol.co.uk [195.92.193.19])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id BAA28767
	for <prolog@swi.psy.uva.nl>; Tue, 29 Feb 2000 01:17:32 +0100 (MET)
Received: from modem4294967219.environment.dialup.pol.co.uk ([195.92.1.205] helo=keele.ac.uk)
	by mail3.svr.pol.co.uk with esmtp (Exim 3.13 #0)
	id 12PaMC-0007jy-00
	for prolog@swi.psy.uva.nl; Tue, 29 Feb 2000 00:17:45 +0000
Message-ID: <38BADDC1.22BE6B3F@keele.ac.uk>
Date: Mon, 28 Feb 2000 20:42:41 +0000
From: Paul Singleton <p.singleton@keele.ac.uk>
Organization: SmartArts Computing Consultancy
X-Mailer: Mozilla 4.7 [en] (WinNT; I)
X-Accept-Language: en
MIME-Version: 1.0
To: SWI Prolog <prolog@swi.psy.uva.nl>
Subject: user-defined autoload within call
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I've tried to override the 3.3.0 autoloader with my own, thus:

  :- initialization set_feature(autoload, false).

  exception(undefined_predicate, N/A, Action) :-
      (   write( '[autoloading '), write( N/A), write( '...]'), nl,
          l( N)
      ->  Action = retry
      ;   write( '[autoload FAILED: '), write( N/A), write( ']'), nl,
          Action = fail
      ).

but although this works with top-level goals:

  ?- fred.
  [autoloading fred/0...]

it doesn't get used for undefined predicates within "called" goals:

  ?- Goal = fred,
  |    call(Goal).
  ERROR: Undefined procedure: fred/0

whereas the default autoloader does.  Is there an easy fix for this?
(I've not yet delved into boot/autoload.pl but I'm prepared to).

Paul Singleton


