[TYPO3-50-general] RFC: Improved Shorthand Syntax

Sebastian Kurfürst sebastian at typo3.org
Mon Oct 19 10:55:45 CEST 2009

Hey everybody,
Bastian and me discussed the Shorthand Syntax of Fluid again.

I'd propose quite a radical change to this syntax, as outlined in:

Please give your input, what you think about this syntax :-)

Thanks for your comments,
PS: Please answer on the typo3.projects.typo3-5_0.general list


PPS: For your convenience, the bug report is attached here again, but of
course on forge it is more nicely formatted:

h1. Proposal for shorthand syntax

The goal of this RFC is to propose a re-done shorthand syntax for fluid
after some real-world usage.

h2. Current situation

Currently, we refer to "shorthand syntax" as another way to call a

Here, there is a basic example for this:
<pre>{f:bla.blubb("unnamed argument" a="b" c="42" d="{object}")}</pre>
This is equivalent to the following:
<pre><f:bla.blubb a="b" c="42" d="{object}">unnamed

* Every argument needs to be quoted
* The first argument is the data inside the tag body, in case it is unnamed.
* Nesting of ViewHelpers is arbitrarily possible:
 <pre>{f:outer(" first VH: {f:bla()} second VH: {f:blubb()}")}</pre>
 (also inside arguments of ViewHelpers, other VHs can be called)
* ViewHelpers can *not* be called inside arrays

Note: Right now, the shorthand syntax is functionally equivalent like
the Tag-based ViewHelper syntax.

h2. Problems with current syntax

In the most common use-case, we write things like
<pre>{f:bla(argument="{blubb}" argument2="{bla}")}</pre>
There, two things feel strange:

* The "{…}" syntax feels weird
* It feels strange that the argument needs to be quoted
* There is no comma between the arguments, which feels strange to
* Named arguments in many languages are delimited by :, and not by =.
The a="b" syntax feels strange.

h2. Draft for new syntax

We remove the "Shorthand Syntax" as it has been described above, and
instead extend the "Object Access" syntax.

The basic object access syntax looks like this:
<pre>{object} {object.bla.blubb}</pre>

Now, we start to *post-process* this value with a ViewHelper:

This could also be chained

Additionally, if the ViewHelper does NOT work on any object, the first
part can be omitted:

h3. Arguments

Arguments look like this:
<pre>{f:bla.blubb(arg1: 'literal string', arg2: 42, arg3: object1.bla,
arg4:{a1: "string"})}</pre>

* All arguments have a name
* The syntax is the same as in JSON arrays, just without the outer brackets
* All string arguments are NOT evaluated, but taken as *literal* strings.
* arg1 is a string (which will not be post-processed)
* arg2 is a number
* arg3 is an object accessor
* arg4 is an array

h2. Comparison

The new syntax has the following limitations:
* There is no equivalent of the following: {f:process("bla")}, i.e.
there is no {"bla"->f:process()} and I would not introduce it.
* Is is NOT possible anymore to use ViewHelpers as arguments in other
shorthand ViewHelpers (but I think this is not a problem, as you could
use the XML-based syntax where this works)
* It is currently NOT possible to call ViewHelpers in arrays (but this
has not been possible before either)

*Please discuss this with us in the TYPO3 5.0 General Mailing list on

More information about the TYPO3-project-5_0-general mailing list