Skip to content
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

prototype() with no arguments #14376

Closed
p5pRT opened this issue Dec 28, 2014 · 7 comments
Closed

prototype() with no arguments #14376

p5pRT opened this issue Dec 28, 2014 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Dec 28, 2014

Migrated from rt.perl.org#123514 (status was 'resolved')

Searchable as RT123514$

@p5pRT
Copy link
Author

p5pRT commented Dec 28, 2014

From @cpansprout

prototype() is not documented as accepting no arguments. But it does accept no arguments, and corrupts the stack in the process​:

$ ./perl -Ilib -le '$,=" "; print 1,2,3,prototype(),4,5,6'
1 2 4 5 6

Here, it steals 3 from the stack and replaces it with undef. Here is a more intriguing example​:

$ ./perl -Ilib -le 'print "CORE​::undef", prototype()'
;\[$@​%&*]

Should prototype() be illegal? Or should it mean prototype($_)?

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Dec 28, 2014

From @rgs

On 28 December 2014 at 23​:17, Father Chrysostomos
<perlbug-followup@​perl.org> wrote​:

prototype() is not documented as accepting no arguments. But it does accept no arguments, and corrupts the stack in the process​:

$ ./perl -Ilib -le '$,=" "; print 1,2,3,prototype(),4,5,6'
1 2 4 5 6

Here, it steals 3 from the stack and replaces it with undef. Here is a more intriguing example​:

$ ./perl -Ilib -le 'print "CORE​::undef", prototype()'
;\[$@​%&*]

Should prototype() be illegal? Or should it mean prototype($_)?

Well, according to itself, it requires one argument​:

perl -E 'say prototype"CORE​::prototype"'
$

which is probably an implementation detail. I see no strong objection against
allowing a default topic for it

@p5pRT
Copy link
Author

p5pRT commented Dec 28, 2014

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Dec 28, 2014

From j.imrie1@virginmedia.com

On 28/12/2014 22​:17, Father Chrysostomos (via RT) wrote​:

# New Ticket Created by Father Chrysostomos
# Please include the string​: [perl #123514]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=123514 >

prototype() is not documented as accepting no arguments. But it does accept no arguments, and corrupts the stack in the process​:

$ ./perl -Ilib -le '$,=" "; print 1,2,3,prototype(),4,5,6'
1 2 4 5 6

Here, it steals 3 from the stack and replaces it with undef. Here is a more intriguing example​:

$ ./perl -Ilib -le 'print "CORE​::undef", prototype()'
;\[$@​%&*]

Should prototype() be illegal? Or should it mean prototype($_)?

I'd go for the latter, prototype($_), in line with oct(), say(), print()
etc

@p5pRT
Copy link
Author

p5pRT commented Dec 29, 2014

From @cpansprout

Fixed in eb4ec35 to infer $_.

--

Father Chrysostomos

@p5pRT p5pRT closed this as completed Dec 29, 2014
@p5pRT
Copy link
Author

p5pRT commented Dec 29, 2014

@cpansprout - Status changed from 'open' to 'resolved'

@p5pRT
Copy link
Author

p5pRT commented Dec 29, 2014

From @rjbs

* Father Chrysostomos via RT <perlbug-followup@​perl.org> [2014-12-28T19​:46​:19]

Fixed in eb4ec35 to infer $_.

+1

--
rjbs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant