Repository navigation
Revert "ControlNode: deprecate missing comma before arguments" - #376
petrparolek wants to merge 1 commit into
Conversation
This reverts commit 1d1ca9f.
|
Thanks, Petr. You're right that this hurts, and part of the blame is ours: the documentation still shows But I want to keep the deprecation. It isn't a BC break: the template still compiles to exactly the same code, and the fix is just adding the comma: {control poll, 1, 'foo'}The reason is that without the comma the tag is ambiguous, and in some cases it silently compiles to something else. In Latte, just like in PHP, whitespace inside an expression means nothing: {control cart:small -1} {* method name 'render' . 'small' - 1, a TypeError instead of renderSmall(-1) *}
{control poll:type [1]} {* method name from the constant type[1] instead of renderType([1]) *}
{control $comp ($x)} {* calls $comp($x) and renders without arguments *}With the comma, all of these work as intended. Since it's impossible to tell from the spacing which form works and which doesn't, the comma is the only spelling that is always correct. To make the switch painless, I've written a script that adds the missing commas to your templates. It inserts a comma only where the template compiles to exactly the same code as before, so it can't change what a template does, and it lists the tags where a comma would change the meaning for a manual check. Run So I'm closing this, but thanks for raising it. |
This reverts commit 1d1ca9f. In v3.3.1 is not logical and not intuitive very big BC break
example code: