Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

__init not being magically called?

4 views
Skip to first unread message

William Coleda

unread,
Sep 19, 2004, 3:37:10 AM9/19/04
to Perl 6 Internals
Didn't __init used to get magically called when you new'd a class? I just had Tcl go all pear shaped after updated to cvs-latest, and tracked it down to my instances of a class (TclWord) not getting intialized. Which I don't seem to have done manually before.

.local int tclword
tclword = find_type "TclWord"
word = new tclword
word->__init()

Before an update, I just needed the first 3 to have a fully initialized object. Now I need the last as well. Did I miss a memo? (again? =-)

Jens Rieks

unread,
Sep 19, 2004, 10:24:29 AM9/19/04
to William Coleda, perl6-i...@perl.org
Can you give an example how I can reproduce his?
__init is called if no BUILD property is set on the class object.

make test in languages/tcl runs with and without 'word->__init()'.

BTW, word."__init"() is AFAIK the correct syntax.
I did not even knew that -> also works :-)
The unquoted version (word.__init()) is an indirect call (the name of the
method to call is in the variable __init)...

jens

Leopold Toetsch

unread,
Sep 20, 2004, 8:41:10 AM9/20/04
to William Coleda, Perl 6 Internals
William Coleda wrote:
> Didn't __init used to get magically called when you new'd a class?

It is called. See t/pmc/object-meths.t. Is it in the correct namespace?

leo

Will Coleda

unread,
Sep 20, 2004, 11:33:03 AM9/20/04
to Leopold Toetsch, perl6-i...@perl.org
Yup. See languages/tcl/lib/tclword.imc (in namespace "TclWord"). Called by
languages/tcl/lib/parse.imc (in namespace "_Tcl").

Without the explicit call to init, it's not being called (as a debug print
in TclWord's __init shows for me.) (And, since the initialization of the object
isn't done, future use of the object barfs, and my test suite dies.)

Though, someone else on the list said that it WAS working for them, with or
without. Again, I'm on OS X 10.3 here, if that matters.

Ahhhh. This is just a symptom of something else, as parrot's test suite is
failing that test for me.

Let's try this again... (make realclean;perl Configure.pl; make; make test).

Ok. Parrot is now passing 100%.

Removing my explicit call to __init... and I also pass 100%.

(Note to self, don't use "make -j")

Regards.

0 new messages