New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Ref - or my stupidness #1294
Comments
From jarausch@numa1.igpm.rwth-aachen.deCreated by jarausch@igpm.rwth-aachen.dePlease explain this to me if it's not a bug use strict; my $FRf = \&sin; print "sin(1)= ",sin(1),"\n"; # OK print "sin(1)= ",&$FRf(1),"\n"; # Undefined subroutine &main::sin called at ... Perl Info
|
From [Unknown Contact. See original ticket]Quoting jarausch@numa1.igpm.rwth-aachen.de: You're referencing "sub sin", not the builtin sin(). Raphael |
From [Unknown Contact. See original ticket]"Functions" like sin() and other builtins don't exist in symbol tables. Solution: $RF = sub { sin(@_) }; Nat |
From [Unknown Contact. See original ticket]On Mar 9, Raphael Manfredi said:
While you can EXPLICITLY call builtin sin() via CORE::sin(), you can't -- |
From [Unknown Contact. See original ticket]Helmut Jarausch writes: Not a bug; this is documented. From man perlsub: To unambiguously refer to the built-in form, precede the built-in However, a note to this effect in perlref may be appropriate. Suggested Mx. *** perlref.pod.orig Thu Mar 9 14:36:06 2000 |
From [Unknown Contact. See original ticket]On Mar 9, Nathan Torkington said:
That's not universally safe, because of the prototypes of some builtin -- |
From [Unknown Contact. See original ticket]
sub CORE::AUTOLOAD { ... } --tom |
From [Unknown Contact. See original ticket]
And, in that case, the answer is virtually always 0.841470984807897 :-) DB<1> $RF = sub { sin(@_) }; --tom |
From [Unknown Contact. See original ticket]On Mar 9, Tom Christiansen said:
My point exactly. I did the test you did below.
-- |
From [Unknown Contact. See original ticket]Tom Christiansen writes:
D'oh. Well, it worked for his test case :-) Ah well, time to go learn Python. Nat |
From [Unknown Contact. See original ticket]Quoting tchrist@chthon.perl.com: You lost me. What does autoloading have to do with builtin referencing? Raphael |
From [Unknown Contact. See original ticket]On Mar 9, Nathan Torkington said:
I'm wanting to give a talk on an intro to Python at YAPC. :) And I also Python is nice. I wish I used it more often. -- |
From [Unknown Contact. See original ticket]
Hee. { my $rf = \&CORE::sin; But you need to call the proto and figure that. See Fatal.pm --tom |
From [Unknown Contact. See original ticket]Tom Christiansen <tchrist@chthon.perl.com> wrote
Except of course when it isn't. :-) DB<1> $RF = sub { sin(@_) }; Mike Guy |
From [Unknown Contact. See original ticket]
Common use indicates that "virtually" never means "really" or --tom |
From [Unknown Contact. See original ticket]
You little bugger. :)
Damned scalar context. -- |
From [Unknown Contact. See original ticket]Tom Christiansen <tchrist@chthon.perl.com> wrote
Ah, those multi-sibylline utter-stances of wistom ;-) Worth reading again now that the fur stopped flying... Wolfgang |
From [Unknown Contact. See original ticket]Quoting tchrist@chthon.perl.com: Brilliantly obscure! It frightens me. :-) It does not work on my perl5.005_03 though (I replaced "our" with "use vars"): I see you want to call the sin function I perfectly understand the part up to the call of CORE::AUTOLOAD, since Besides, de-referencing the CODE ref returned yields the results of a Raphael |
Migrated from rt.perl.org#2291 (status was 'resolved')
Searchable as RT2291$
The text was updated successfully, but these errors were encountered: