Hmm... If import is namespace operation, why (then) code is executed during this operation? Or it is executed only for .pmod files?
The foo.pmod code is loaded, compiled and instantiated by the compiler, druing the compilation of code that refers to the module.
The question, actually, is - which files (.pmod and/or .pike) import "." will use... And - where. And which location inherit uses to search for programs/modules...
To inherit a file bar.pike in the same directory, simply use
inherit .bar;
If you don't want to type the dot there, you can use
import .; ... inherit bar;
which will do about the same thing, except that the compiler will look in your directory for *all* modules. So if you for example happen to have a file Stdio.pmod in that directory, the compiler will pick it up instead of the standard Stdio module. That's why import . is not really recommended.
/ Niels Möller (vässar rödpennan)
Previous text:
2004-02-02 13:39: Subject: Re: Pike module initialization at compile time
On Mon, Feb 02, 2004 at 01:15:02PM +0100, Henrik Grubbström (Lysator) @ Pike (-) developers forum wrote:
What would be the difference? import is a namespace operation.
Hmm... If import is namespace operation, why (then) code is executed during this operation? Or it is executed only for .pmod files?
The question, actually, is - which files (.pmod and/or .pike) import "." will use... And - where. And which location inherit uses to search for programs/modules...
Regards, /Al
/ Brevbäraren