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

Re: [FWP] Fun with terminology



On Fri, Oct 29, 1999 at 02:51:44PM -0400, John Porter wrote:
> Ronald J Kimball wrote:
> > 
> > The question is:
> > 
> > Why does the sentence say "Perl's prefix dereferencing operators are
> > typed"?
> > 
> > And my answer is:
> > 
> > The phrase "Perl's dereferencing operators are typed" would not be
> > correct.
> 
> 
> The more fundamental question, which seems to be begged here, is:
> 

[As long as we're talking about language usage, "begging the question"
refers to the fallacy of circular logic, not to a question being raised by
a particular situation.  There, that's my pet-peeve.  :) ]


> What does it mean to say that something in Perl is "typed"?
> 
> Perl enforces very few type requirements; but one that it DOES
> enforce is that when a dereference is attempted, the thing being
> dereferenced must be the correct kind of reference.
> 
> 	@{ \%h }
> 
> is a fatal error, and it's all because of type.
> 
> So, chipmunk, how am I misunderstanding you?
> 

Whereas those prefix operators $ @ et al. all specify a type to the argument,
the infix operator -> does not.  You can use -> to dereference array refs,
hash refs, and subroutine refs.

$array_ref->[$i];
$hash_ref->{$str};
$sub_ref->($arg);

For ->, it's the right operand, not the operator, that determines the type.


So, the phrase "Perl's dereferencing operators are typed" is incorrect
because only some of the dereferencing operators are typed.


Ronald

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