twigphp / Twig

Twig, the flexible, fast, and secure template language for PHP
https://twig.symfony.com/
BSD 3-Clause "New" or "Revised" License
8.17k stars 1.25k forks source link

`set ... as ...` is not adequacy #54

Closed Koc closed 14 years ago

Koc commented 14 years ago
# SQL
SELECT CONCAT('foo', 'bar') AS gg

# Twig
{% set gg as 'foo' ~ 'bar' %}

As you see - variable name and value of this variable in Twig swapped.

So I propose: a) provide is {% set gg is 'foo' ~ 'bar' %} b) swap varible name and variable value.

Yes, I know that it will break backward compatibility but it will add more of the adequacy.

fabpot commented 14 years ago

You are totally right. I don't want to swap variable name and the value, as it won"t make sense for the block tag:

{% block title as 'title' %} -> {% block 'title' as title %} won't be easy to parse

So, I think changing as to is is the best thing to do. Any other idea for the word in between? "is" looks quite fine but I would have preferred another adjective if possible.

Koc commented 14 years ago

no, I haven't any other idea for word between, Maybe eq or equal, but it looks as compare. Or does it possible use = ?)

fabpot commented 14 years ago

ok, I think I will use = as this is what Jinja uses.

fabpot commented 14 years ago

changed as to = for the set tag and removed the need for as in short-notation of the block tag (closed by 8809a1cab12202e9baccc26e9a6fea2da0a956a7)

jmikola commented 14 years ago

{% set gg to 'foo' %} would have worked, too, but = is perfectly clear