class Foo { static class Bar { }
object get_bar() { return Bar(); } }
void main() {
write("%O\n", indices(Foo)); write("%O\n", indices(Foo())); write("%O\n", Foo.Bar()); exit(0); }
gives me
({ /* 1 element */ "Bar" }) ({ /* 2 elements */ "get_bar", "Bar" }) /home/marage/src/Pike/pf-7.7/test()->Foo()->Bar()
Perhaps something is broken then, or doesn't the static keyword in pike-code do the same thing as ID_STATIC in cmod?
/ Marcus Agehall (PacketFront)
Previous text:
2004-08-13 14:00: Subject: CMOD questions
I have a library to which I'm trying to create an interface. The library has a general part and several "submodules".
Ok.
I want to make the glue so that the user first creates an object Foo() from the program Foo. Then, from Foo(), the user may create other objects which uses the general parts as set up in Foo().
Therefore, the user must not do Foo.Bar() directly. She should only be able to do Foo()->Bar() or something similar such as Foo()->get_bar() to create Bar-objects.
You'll get this enforced by the runtime if Foo.Bar has been tagged as PROGRAM_USES_PARENT.
Did that clarify what I wish to do? Using the ID_STATIC flag on the Bar program still shows Bar when doing indices(Foo) but does not allow Foo()->Bar(). Is there a way of solving this?
I don't believe you. predef::indices() filters static symbols.
/ Henrik Grubbström (Lysator)