-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for variables #89
Comments
@adrianhurt I like the idea in general, but how would this effect already written templates? |
Yeah, I know… But it wouldn't be the first time the backward compatibility is broken. I think it's more logic. Anyway, in my opinion it would be nice to add a note in Play's doc warning that There would be more options to write the same thing if the problem is to maintain the backward compatibility:
|
I assume you mean we should support defining immutable values, but not mutable variables. I believe it's typical scala style to omit parens only for pure functions that are side-effect free. This is what I would typically do at least. So if users are doing that here, @adrianhurt's suggestion should not cause too many backwards compatibility issues. I'm not sure what most code in the wild looks like though. |
I've seen there was another issue for this (#63) but it's closed and I think it's an important lack.
For now, if we need to declare some variables we have to to this:
And it's not handy. However, we can declare reusable blocks:
But they are treated as functions, so
foo
,bar
andresult
will be recalculated every time. I think every time a reusable block is declared without parenthesis, its value should be calculated once and use it as a variable. So the previous example would define variables, and the following one would define functions.The text was updated successfully, but these errors were encountered: