Hi!

> Yep, that's exactly what "->" does.  It's just pointless syntactic

No, not really. Calling method on an object is an universally accepted
phrase in many languages. True, not all of them use ->, and for some of
them -> may have other meaning, but if you tell somebody at least
vaguely familiar with OOP "-> is a method call operator", you're done
teaching them about ->. That assuming they don't come from numerous
languages where -> is the method call operator.
Moreover, there's no easy and more readable way to call methods in PHP,
so -> is the best way to go.
Moreover, calling methods is a very frequent operation, and any time you
need it, regardless of what is the circumstance, you'd use ->

Neither of these is true for |>-$$ thing - it does not have any matches
in any languages I can think of (maybe Perl 6 has something like that
because what doesn't it have?), it captures only one particular case and
it does something much better done the existing way.

> Oh, sorry, we were talking about the function version of ->, my
> mistake.  That's a totally different thing.

I'm sorry I didn't get what you meant here. "function version of ->"
makes no sense to me - function version of -> is the function call itself.

> Hrmmm... Did you read the RFC? It's pretty clear that the lhs
> expression can be used in a lot more cases that function calls and
> that it needn't be the only argument.  Better read it again.

Only one argument can be $$. So if you need to call two functions and
pass the result of them to the third, the magic does not work anymore.
If you need to do anything on any of these arguments, magic does not
work anymore. If you need to do any error checking or branching, the
magic does not work anymore. Did I misunderstand the RFC? Do we have $1$
and $2$ coming? Maybe, but I found no mention of it in the RFC.

> That's a great reason for voting against short ternary syntax.  What
> the hell is "?:", anyway?

That would be a good question (and there are a number of languages that
omit ?: for exactly that reason) had C, C++ and Perl not existed and
were not direct predecessors and influences on PHP. For the full list of
languages that know what the hell is "?:" please see:
https://en.wikipedia.org/wiki/%3F:

Now, how long is the list of languages which know what is |>, Hack
excluded? I suspect the answer is "not very". Probably not 20+ long?
-- 
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