I lately played around with Fusion and Eel an discovered that this will create a closure:
path = ${() => "hello"}
to actually use and invoke this closure i tried out multiple things: at first i naively thougt this should work:
root = Neos.Fusion:Value {
closure = ${(arg) => "Hello world " + arg}
value = ${this.closure('Neos')}
}
but since ‘this’ is the current Fusion Object php implemenation of Neos.Fusion:Value a method of “closure” will be tried to be called.
(what doesnt work since its not allowed in the eel context and the method doesnt exist… i got around that by hacking some stuff and for fun implemented a magic __call that would intercept all these paths wich are called as method … but that seemed wrong and was only for fun.)
A real way to call these could be ${this['closure']()}
but this will throw a syntax error by the eel parser.
Or creating a Eel helper wich would invoke the passed closure.
So why am i writing this? because someone might have some fun ideas what could be archived with closures in fusion…
Having this kind of thing on a larger scale would allow for 100% scoped parts if you made them pure functions (eg you only ever have the arguments you put in).
Which in turn might be intersting to caching purposes.
@christianm