Hi!

> Just having a different syntax, writing $foo{0} = 'zzz'  instead of $foo[0]
> = 'zzz'  does not make the implicit truncation behavior any more obvious or
> reasonable. If we want to actually make it less confusing, what we should

It makes it clear the operation you are dealing with is not array access
and is not bound by its rules, but another operation with (possibly)
different rules which you need to learn.

> Similarly, Stas' comments on how things like $string[0] ^= "\xf0" do no
> work, are not a reason to promote a different string offset syntax -- that
> wouldn't actually *solve* anything. Instead we should strive to make these

That would solve the situation where we imply that strings are like
arrays by using same syntax only to break that promise with many
operations.

> things work as expected. If I can write $string[0] = $string[0] ^ "\xf0" it
> stands to reason that $string[0] ^= "\xf0" should work as well.

That would be much harder to do and largely pointless unless we make
string offsets be real zvals. Which I strongly recommend against - we
have enough trouble with pointer-like nature of references, one more
pointer-like time would produce huge amount of trouble.
-- 
Stas Malyshev
smalys...@gmail.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to