develooper Front page | perl.perl5.porters | Postings from July 2002

Re: Thread::Use - use a module inside a thread only

Thread Previous | Thread Next
From:
Elizabeth Mattijsen
Date:
July 30, 2002 07:24
Subject:
Re: Thread::Use - use a module inside a thread only
Message ID:
4.2.0.58.20020730161825.02c71e80@mickey.dijkmat.nl
At 04:04 PM 7/30/02 +0200, Jenda Krynicky wrote:
> > >The problem with run-time "useit Foo" instead of compile-time "use
> > >Foo" is that the symbols are not exported while compiling, prototypes
> > >not "installed", constants not defined, etc. etc. etc.
> > Well, I guess YMMV...  prototypes aren't much use in an OO environment
> > anyway, exports seems to work fine, judging from the testing that I
> > did.  Constants may be another problem, let me check up on that...
>
>Even if there's no prototype defined for a function, the fact that
>perl knows about it already IS important. Try to run this:
>
>         #perl
>         foo 1,2,3;
>         sub foo {print join(', ', @_), "\n"};
>
>or this:
>
>         #perl
>         eval q{
>                 sub foo {print join(', ', @_), "\n"};
>         };
>         foo 1,2,3;
>
>I bet you'll see the same problems with "useit Module".

Personally, I find the "foo 1,2,3" syntax very dirty and close to using 
bare words without strict.  If you write it as "foo( 1,2,3 )", there is no 
problem.

It may be unambiguous if the parser knows it's a subroutine, but it is not 
unambiguous to the reader of the code (because the subroutine may have been 
invisibly exported to that namespace by a module).

In any case, I'll add a note to the documentation that this may be a problem...


Liz


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About