[TYPO3-project-4-3] Variation for TypoScript "if"
Martin Kutschker
masi-no at spam-typo3.org
Thu Jun 11 16:32:55 CEST 2009
JoH asenau schrieb:
>>> Could be nested as well:
>>>
>>> if {
>>> value = 1
>>> isLessThan = 4
>>> and {
>>> isLessThan = 2
>>> or {
>>> isInList = 1,2,3
>>> }
>>> }
>>> or {
>>> equals = 2
>>> and {
>>> isGreaterThan = 1
>>> }
>>> }
>>> }
>>>
>>> What do you think?
>> a) Who wants to make all this comparisons to a single value? "1" in
>> your example.
>
> Hey- after all it's just an example and "1" could be any value that should
> be compared to field values, GPvar values and other parameters.
My point wasn't the example value "1". My question is: who wants to
compare the *same* value against a multitude of other values?
>> b) Using a COA-like notation (as I have suggested) makes it easier to
>> add new clauses later on.
>
> Making it more confusing to the non TypoScript-safe programmer.
Come on. If you cannot grasp the concept of a COA you're lost.
> If you write my example in just one line it would be readable in the
> followin way:
>
> if value isLessThan A and (isLessThan B or isInList C,D,E) or (equals F and
> isGreaterThan G)
As a programmer I'm confused now.
Do you intend to express this?
V < A && (V < B || inList(V,C,D,E) || (V == F && V > G)
> This would be as close as possible to the common PHP syntax as well as to
> the natural language being used by people trying to describe the comparison
> with their own words.
Actually I would then prefer "real expressions" as Ernesto has
suggested. The idea came up at T3DD07 during a brain-storming session
for TYPO3v5/TSv2.
> Even the current syntax is close to this, but it's confusing because some
> comparisons are using kind of "mirrored" values. if you change the behvaiour
> of isGreaterThan, isLessThan and isInList, the confusion should be
> minimized, since I can't find anything confusing about a syntax like:
>
> if {
> value = 1
> isLessThan = 5
> isGreaterThan = 0
> isInList = 1,2,3,4
> }
If you don't find this confusing then let's agree to disagree. To me it
is confusing, horrible and useless.
The only use case for comparing a single value against two other values
is an in-between check: A < B < C vs A < B && B < C
Masi
More information about the TYPO3-project-4-3
mailing list