Anyway, as I said, I think I may be missing some point you're making. If you'd care to clarify, I'd be happy to discuss further.
Hi
My point is that empty list , the parens , are not being lost, they never existed, and they can't be passed around, because foo() is the same as foo((),(),())
Its a special case in the parser that causes use YADA (); to be treated as BEGIN{require YADA;} with no call to import.
B::Deparse peeks at the optree to decide when to print use YADA();
This is the parsing parts of a "use" statement
https://perl5.git.perl.org/perl.git/blob/HEAD:/perly.y#l349
349 | USE startsub
350 { CvSPECIAL_on(PL_compcv); /* It's a BEGI
+N {} */ }
351 BAREWORD BAREWORD optlistexpr ';'
352 {
353 SvREFCNT_inc_simple_void(PL_compcv);
354 utilize($1, $2, $4, $5, $6);
355 parser->parsed_sub = 1;
356 $$ = NULL;
357 }
toke.c s_tokenize_use
Related loading module parts
op.c Perl_vload_module
op.c Perl_utilize 6307 /* Fake up an import/unimport */
6308 if (arg && arg->op_type == OP_STUB) {
6309 imop = arg; /* no import on explicit () */
6310 }
http://perldoc.perl.org/perlapi.html#load_module
If you look inside sub begin_is_use inside B::Deparse ( L571 and L611 ) you can see what it goes through to decide if its dealing with a use statement with or without empty parens, its looking at the optree, because of the fake begin sub in utilize
As you can see, the empty parens simply never existed
Similar to my post above, but a weaker demonstration, if you look at perlrun there are two switches for loading modules $ perl -mopen -e 1
$ perl -Mopen -e 1
open: needs explicit list of PerlIO layers at -e line 0.
BEGIN failed--compilation aborted.
Passing no arguments (like empty parens) doesn't work with either version import gets called , because in the end its a simple use statement $ perl -Mopen= -e 1
open: needs explicit list of PerlIO layers at -e line 0.
BEGIN failed--compilation aborted.
$ perl -mopen= -e 1
open: needs explicit list of PerlIO layers at -e line 0.
BEGIN failed--compilation aborted.
|