flow-development-collection
flow-development-collection copied to clipboard
Eel Null Coalescing Operator
Description
Currently one often needs to write the following code in fusion eel:
{foo != null ? foo : bar}
in php this could be better written like
$foo ?? $bar;
im proposing to implement this Null Coalescing Operator in eel:
{foo ?? bar}
The eel parser https://github.com/neos/flow-development-collection/blob/68321067e83dc82702d266f6b27b4f4afad54186/Neos.Eel/Resources/Private/Grammar/Eel.peg.inc#L43 and the CompilingEelParser https://github.com/neos/flow-development-collection/blob/68321067e83dc82702d266f6b27b4f4afad54186/Neos.Eel/Classes/CompilingEelParser.php#L293 should be extended. (Those snippets show the ternary eel)
I would not implement this in the InterpretedEelParser.php as this one is not used and should probably be removed.
I think you mean {foo != null ? foo : bar} in your example
btw concerning fusion woulndt this be cool?
path ??= 'hello'
->
[email protected] = ${value ?? 'hello'}
edit: this was more of a Schnapsidee as it makes things less transparent and harder to learn