From jan@swi.psy.uva.nl  Mon Jun  7 10:54:38 1999
Received: from gollem.swi.psy.uva.nl (jan@gollem.swi.psy.uva.nl [145.18.114.15])
	by swi.swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id KAA19290
	for <prolog@swi.psy.uva.nl>; Mon, 7 Jun 1999 10:54:38 +0200 (MET DST)
Received: from localhost (localhost [[UNIX: localhost]])
	by gollem.swi.psy.uva.nl (8.8.8/8.8.8) id KAA28778;
	Mon, 7 Jun 1999 10:55:59 +0200
From: Jan Wielemaker <jan@swi.psy.uva.nl>
To: prolog@swi.psy.uva.nl, "Jean-Francois Rompre" <jrompre@uwindsor.ca>
Subject: Re: Can't assign a module name with getenv/2
Date: Mon, 7 Jun 1999 10:54:18 +0200
X-Mailer: KMail [version 0.7.9]
Content-Type: text/plain
References: <199906062101.RAA37703@server.uwindsor.ca>
MIME-Version: 1.0
Message-Id: <99060710555900.27616@gollem>
Content-Transfer-Encoding: 8bit

On Sun, 06 Jun 1999, Jean-Francois Rompre wrote:
>Hello,
>
>I would be grateful for any advice with the following 
>problem.
>
>In my load file, I use getenv to obtain the search path
>used to make it possible to call use_module as follows:
>
>	use_module( util( util)),
>	use_module( interface( history)),
>	etc...
>
>However, when I try to obtain the module name itself, e.g.
>display( prt), from a stored env. variable, the system can't find it.
>When I instead  use 'display( prt)' in hardcoded form , everything
>works like a charm.
>
>In other words, I am trying to do this: create the variable DPY in
>a shell script :
>	...
>	DPY="display( prt)";export DPY
>	...
>	< pl command>
>
>
>which then starts prolog with the application loading
>file and the initialization clause. The intialization clause then
>creates an exception when 
>	...
>	getenv( 'DPY',  DisplayModule),
>	use_module( DisplayModule ),	
>	 ...
>But when I replace the above two statements  with
>
>	....
>	use_module( display( prt)	),
>	....
>it compiles without any error message.

getenv/2 yields an atom, so the getenv version is essentially

	use_module('display(prt)'),

Which of course won't work.  See atom_to_term/3 or term_to_atom/2 to
convert the atom into a term.

	Regards --- Jan

