roxen.lists.pike.general

Subject Author Date
Re: Importing constants from modules in 7.8.* Henrik_Grubbström <grubba[at]roxen[dot]com> 20-04-2009
On Mon, 20 Apr 2009, <aldem-pike[at]aldem.net> wrote:

> Hi,

Hi.

> 	I am trying to upgrade my Pike installation to 7.8 (from 7.6), and
> 	experience strange behavior - getting error "Undefined identifier".
>
> 	I've a module which contains definition:
>
> #! Module.pmod
> constant NULL = UNDEFINED;
> #
>
> 	Later I import it somewhere:
>
> #
> import Module;
> #....
> object	x = NULL;
> #
>
> 	And I get this error. It did work before in all 7.6 versions, but
> 	stopped to work now. If I declare a variable instead if constant,
> 	the definition is imported.

Are you sure that it actually worked in Pike 7.6 (ie that zero_type(NULL) 
was 1)?

> 	Where is the problem? Do I do something wrong (they why it worked
> 	before?) or semantics of "constant" has changed?

The reason that it fails is probably that NULL actually gets the value 
UNDEFINED (and not 0) in Pike 7.8. Note that symbols with the value 
UNDEFINED in modules indicate that the symbol doesn't exist, thus the
error message.

> 	Thanks!
>
> Regards,
> /Al

--
Henrik Grubbström					<grubba[at]roxen.com>
Roxen Internet Software AB