Re: seek parameters

2003-12-16 Thread Sisyphus
Glenn Linderman wrote:
Here's a strangeness:

my $res = sysseek( @stk[ -2, -3, -1 ] );

fails to compile, but

my $res = sysseek( $stk[ -2 ], $stk[ -3 ], $stk[ -1 ] );

compiles fine.  As far as I can tell, they have the same effect.

And curiously,  the error from the first is about the number of parameters.

That would mean that '@stk[-2,-3,-1]' is being seen as other than 3 
arguments. But that's impossible, isn't it ?

('parameters' mean 'arguments' doesn't it ?)

I certainly can't explain it.

Cheers,
Rob
--
Any emails containing attachments will be deleted from my ISP's mail 
server before I even get to see them. If you wish to email me an 
attachment, please provide advance warning so that I can make the 
necessary arrangements.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: seek parameters

2003-12-16 Thread Arms, Mike
Well, I could see a possibility here, but this is total
speculation as I do not know the underlying implentation
of the sysseek function.

Think of the case of function prototypes:

  sub f (\@) { print 'foo'; }
  my @a = qw(b c d e f z);
  f( @a[-2,-3,-1] );

I get this error:

  Type of arg 1 to main::f must be array (not array slice)

The prototype specifies that this function expects an actual array
to be passed in (and it addresses it via a ref). The fact that it
knows the difference between an array slice and an array I think
means that that info concerning the type of args being passed to
a subroutine can be known to the subroutine.

So, maybe the code author for sysseek, since it is a pretty
low level (as in close to the OS) function, made an assumption
that the parameters being passed in were 3 individual scalars.
It could then misbehave if an array slice is passed in instead.
Maybe a direct interface to a C-function call.

Again - pure thought conjecture here on my part as I do not
know the Perl guts nor the specifics of sysseek. 

 And curiously,  the error from the first is about the 
 number of parameters.

This statement adds strength to my conjecture as an array slice
could be a single parameter (rather than three).

--
Mike Arms


 -Original Message-
 From: Sisyphus [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, December 16, 2003 4:27 PM
 Cc: Win32 perl
 Subject: Re: seek parameters
 
 
 Glenn Linderman wrote:
  Here's a strangeness:
  
  my $res = sysseek( @stk[ -2, -3, -1 ] );
  
  fails to compile, but
  
  my $res = sysseek( $stk[ -2 ], $stk[ -3 ], $stk[ -1 ] );
  
  compiles fine.  As far as I can tell, they have the same effect.
  
  And curiously,  the error from the first is about the 
 number of parameters.
  
 
 That would mean that '@stk[-2,-3,-1]' is being seen as other than 3 
 arguments. But that's impossible, isn't it ?
 
 ('parameters' mean 'arguments' doesn't it ?)
 
 I certainly can't explain it.
 
 Cheers,
 Rob
 

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: seek parameters

2003-12-16 Thread Sisyphus
Arms, Mike wrote:
Well, I could see a possibility here, but this is total
speculation as I do not know the underlying implentation
of the sysseek function.
Think of the case of function prototypes:

  sub f (\@) { print 'foo'; }
  my @a = qw(b c d e f z);
  f( @a[-2,-3,-1] );
I get this error:

  Type of arg 1 to main::f must be array (not array slice)
That's probably close to what's happening. Consider this:

   sub f ($$$) { print 'foo'; }
   my @a = qw(b c d e f z);
   f( @a[-2,-3,-1] );
Then replace the last line with: f($a[-2], $a[-3], $a[-1]);

Cheers,
Rob
--
Any emails containing attachments will be deleted from my ISP's mail 
server before I even get to see them. If you wish to email me an 
attachment, please provide advance warning so that I can make the 
necessary arrangements.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs