John Barnette wrote:
> John Porter wrote:
> > The punctuation imposes context on the variable expression.
> > $foo[0]
> > accesses an array. Where's the "@"?
>
> It accesses an *element* of the array, which is a scalar.
Still, the "$" does not describe the type of the variable, which
in this case is an array. The "$" imposes scalar context on the
expression "foo[0]". What is in foo[0] is irrelevant.
> Where's the confusion?
Right here, apparently. The punctuation (so-called) is NOT descriptive
of the variable's type, despite what some people say.
If it were, then the parser would see "$foo" and immediately conclude
that the variable is a scalar. But no, it has to keep scanning until
it finds other stuff, like {} or [], to decide what type "foo" is.
--
John Porter
- Re: RFC 109 (v1) Less line n... Steve Fink
- Re: RFC 109 (v1) Less line n... Nathan Torkington
- Re: RFC 109 (v1) Less line n... Steve Fink
- Re: RFC 109 (v1) Less line noise - let's get ... John Porter
- Re: RFC 109 (v1) Less line noise - let's ... Nathan Torkington
- Re: RFC 109 (v1) Less line noise - le... John Porter
- Re: RFC 109 (v1) Less line noise - let's get rid ... John Porter
- Re: RFC 109 (v1) Less line noise - let's get ... John Barnette
- Re: RFC 109 (v1) Less line noise - let's ... Jonathan Scott Duff
- Re: RFC 109 (v1) Less line noise - le... John Barnette
- Re: RFC 109 (v1) Less line noise - let's ... John Porter
- Re: RFC 109 (v1) Less line noise - let's get ... Russ Allbery
- Re: RFC 109 (v1) Less line noise - let's get rid ... Kai Henningsen
- Re: RFC 109 (v1) Less line noise - let's get ... Mike Pastore
- Re: RFC 109 (v1) Less line noise - let's get ... Russ Allbery
- Re: RFC 109 (v1) Less line noise - let's get rid of @% Nathan Torkington
- Re: RFC 109 (v1) Less line noise - let's get rid ... Karl Glazebrook
- Re: RFC 109 (v1) Less line noise - let's get ... Jonathan Scott Duff
- Re: RFC 109 (v1) Less line noise - let's ... John Porter
- Re: RFC 109 (v1) Less line noise - le... Jonathan Scott Duff
- Re: RFC 109 (v1) Less line noise... John Porter
