FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » error message I don understand
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: error message I don understand [message #174928 is a reply to message #174926] Mon, 18 July 2011 16:01 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
Thomas 'PointedEars' Lahn wrote:
> Denis McMahon wrote:
>
>> Thomas 'PointedEars' Lahn wrote:
>>> In the end an oversimplified, wrong explanation. It is a syntactical
>>> requirement, not a functional one:
>>>
>>> $a = x();
>> Here you're assigning the return value of the function x() to the
>> variable $a.
>>
>>> $a[0] = 42;
>> Here you're writing to the variable $a (or rather, in this case, to an
>> element of the array that is variable $a).
>>
>> Neither of these is trying to assign (write) a value to the return value
>> of the function call.
>
> Yes, it is. The return value of the function is a one-element array, and
> with that assignment I am writing to the same memory area (or another memory
> area that holds a copy of the former's content) by changing the first
> element of the array. IOW, the return value is _not_ read-only.
>
>> Whether you call the issue syntactical or not is just irrelevant and
>> messing about with semantics.
>
> You are mistaken. The issue is a syntactical one, not a functional one,
> because a function call (currently) cannot occur on the left-hand side of an
> assignment expression in PHP, *regardless* of the return value of function
> to be called.
>

so you are saying that (x())[3]=7; is not allowable?

> IOW, it does not make sense to say that "the return value is read-only" as
> the function is *never* *called* and *no* return value is obtained in the
> first place then. This is a rather important difference because syntax
> errors are detected by the parser upon (JIT-)compilation already.
>
>
> PointedEars
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Ouion Movement, Roun Time (Floating Point Time)
Next Topic: [MEMCACHED] Is there a way to get the expiration of a key?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 20:22:43 GMT 2024

Total time taken to generate the page: 0.05993 seconds