Comments (6)
This is mentioned in the RFC too:
A nullsafe function call syntax ($callableOrNull?()) is also outside of scope for this RFC.
from php-src.
@heiglandreas I wouldn't mind keeping this around as a feature request. But do note that I'm not sure this syntax is feasible due to the aforementioned lookahead problem.
from php-src.
$foo?()
is not supported syntax. It's also ambiguous (without lookahead) because of $foo?(expr):(other_expr)
.
from php-src.
switch ($expr) { case $var?(2):foo: do_things(); }
is fundamentally ambiguous here anyway, independently of lookahead. Is $var?(2)
(the nullsafe fcall) the case expression and foo:do_things()
the body (a goto label and a function call), or $var?(2):foo
(a ternary with foo constant in else part) and do_things()
the body?
from php-src.
Right. Some other languages do $foo?.()
for syntax to avoid the ambiguity.
from php-src.
Right. Some other languages do
$foo?.()
for syntax to avoid the ambiguity.
Or $foo?->()
to be more PHP like (this should allow $foo->()
as well for consistency), which makes it end up in two different short style variants doing the same thing :/
Another option would be to make the callback argument of call_user_func[_array]
nullable. Not as nice/readable as native syntax but an option.
from php-src.
Related Issues (20)
- OVERFLOW_AFTER_CHECK in sljitNativeX86_common.c HOT 3
- Deprecate semicolons after case in switch statement HOT 1
- Why internal function is slower than my own doing the same? HOT 12
- With GCC 14.2, trying to include /usr/include/php/main/php.h fails HOT 3
- heap buffer overflow in phpdbg (zend_hash_num_elements() Zend/zend_hash.h) HOT 1
- Building with Oracle Developer Studio compiler fails HOT 6
- stop a child when used more than x mb ram after stop process HOT 25
- Infinite recursion in property hooks inside traits. HOT 3
- Pdo\pgSql does not fetch() efficiently HOT 4
- Dynamic AVX detection is broken for MSVC HOT 1
- `bug74589_utf8.phpt` fails with `Could not open input file: …/source/ext/standard/tests/directory/bug74589_/test.php` HOT 4
- http_build_query() Bug HOT 1
- ReflectionClass can't detect readonly properties for mysqli HOT 7
- Use dynamic AVX detection where there is only compile time detection now
- dom: Element::$substitutedNodeValue test failed HOT 3
- Cannot configure PHP from source to use the desired Kerberos library path HOT 8
- Assertion violation in ZendAccelerator.c
- Static class overloading support (__getStatic() / __setStatic() / __issetStatic() / __unsetStatic()). HOT 4
- Show URL in php-fpm error log HOT 1
- APCu apc.shm_size=32M HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-src.