Wed Jun 23 16:46:36 2010: Request 58579 was acted upon.
Transaction: Correspondence added by MBARBON
Queue: Wx
Subject: Compile Wx constants without exporting Wx constants
Broken in: (no value)
Severity: (no value)
Owner: Nobody
Requestors: [email protected]
Status: open
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=58579 >
Il Mer 23 Giu 2010 10:38:26, SMUELLER ha scritto:
> Hi Adam,
>
> Adam Kennedy via RT wrote:
> > Tue Jun 22 07:27:02 2010: Request 58579 was acted upon.
> > Subject: Compile Wx constants without exporting Wx constants
>
> > use Wx ();
> >
> > my $value = Wx::wxDefaultPosition;
>
> Without saying anything about whether the following is good or not: The
> reason it works like this is that the constants are generated via
> AUTOLOAD. They are listed in Constant.xs.
Not exactly; it's Exporter that declares them. AUTOLOAD is only invoked if
the constant is
actually used.
> I wonder why Wx doesn't use ExtUtils::Constant to generate the constants
> (also using AUTOLOAD, usually).
At the time, I did not know about it.
> EU::Constant can generate code that is
> likely more efficient than the repeated call to strEQ.
s/likely/surely/ :-)
> Is it because of
> the ifdefs on wxWidgets versions?
That is one of the reasons I never switched to it.
>Would it be worthwhile to patch EU::Constant to allow for this kind of
>conditional code
generation?
A speed increase can't hurt, and I don't think there will be a maintenance
increase/decrease;
I'm not sure the speed increase is going to be noticeable, though. Are there
any benchmarks
for ExtUtils::Constant?
> If we assumed somebody wanted all those constants anyway, we could
> generate the XSUBs at XS compile time.
This has a better chance of actually speeding things up (because the subs
will be visible
at Perl compile time, and inlineable). Again, not sure it matters for most
applications.
Reagrds,
Mattia
P.S.: I'd welcome a patch implementing any of the two, it just isn't my itch