[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Delayed semantical interpretation



At 01:36 PM 9/23/99 -0400, John Porter wrote:
>Peter Scott wrote:
> > At 09:36 AM 9/23/99 -0400, John Porter wrote:
> >
> > >foo { 'bar', 'quux' };
> > >
> > >was foo declared as foo($) or foo(&)?
> >
> > But both are compile-time errors due to too many arguments, and the second
> > one also  loses with
> >
> >          Type of arg 1 to main::foo must be block (not constant item)
> >
> > (this even without -w or strict... gotta watch those prototypes).  I don't
> > see it.
>
>Well, I don't know what you're doing wrong.
>
>% perl
>sub foo1($) { print "foo1: @_\n" }
>sub foo2(&) { print "foo2: @_\n" }
>
>foo1 { 'bar', 'quux' };
>foo2 { 'bar', 'quux' };
>^D
>foo1: HASH(0xbc050)
>foo2: CODE(0xc3bec)
>
>I get the exact same results on both 5.004_04 and 5.005_60,
>with and without -w and strict.

Fascinating.  Why would this behavior be platform-dependent?

% perl
sub foo1($) { print "foo1: @_\n" }
sub foo2(&) { print "foo2: @_\n" }
foo1 ( 'bar', 'quux' );
Too many arguments for main::foo1 at - line 3, near "'quux' )"
foo2 ( 'bar', 'quux' );
Type of arg 1 to main::foo2 must be block (not constant item) at - line 4, 
near "'quux' )"
Too many arguments for main::foo2 at - line 4, near "'quux' )"
^D
Execution of - aborted due to compilation errors.
% perl -v

This is perl, version 5.004_04 built for sun4-solaris


--
Peter Scott
Pacific Systems Design Technologies


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe