[
https://issues.apache.org/jira/browse/VELOCITY-542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16621283#comment-16621283
]
Nate Chadwick edited comment on VELOCITY-542 at 9/19/18 10:33 PM:
------------------------------------------------------------------
This change creates severe backward compatibility issues for end users that
have either standardized on Kebab case for naming variables / framework objects
or hyphens in existing variable names. Some JavaScript frameworks standardize
on this naming convention. We unfortunately finally rolled out an update to
2.0 and nearly every customer had templates break as a result of this change
(and others).
While I can understand that use case 3 above generates an error. The template
developer could just as easily have added a space after the variable name to
solve it.
#set($previousCampNumber = $thisCampNumber - 1)
I don't think removing the hyphen as an allowed identifier character from the
template language is an acceptable fix. We had to fork the project and back
this change out.
Requesting that this fix be reconsidered due to backwards compatibility
concerns. For such a minor use case the change is pretty major on existing
users.
was (Author: [email protected]):
This change creates severe backward compatibility issues for end users that
have either standardized on Kebab case for naming variables / framework objects
or hyphens in existing variable names. Some JavaScript frameworks standardize
on this naming convention. We unfortunately finally rolled out an update to
2.0 and nearly every customer had templates break as a result of this change
(and others).
While I can understand that use case 3 above generates an error. The template
developer could just as easily have added a space after the variable name to
solve it.
#set($previousCampNumber = $thisCampNumber - 1)
I don't think removing the hyphen as an allowed identifier character from the
template language is an acceptable fix. We had to fork the project and backout
this change out.
Requesting that this fix be reconsidered due to backwards compatibility
concerns. For such a minor use case the change is pretty major on existing
users.
> minus sign in #set requires spaces to surround it
> -------------------------------------------------
>
> Key: VELOCITY-542
> URL: https://issues.apache.org/jira/browse/VELOCITY-542
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 1.5
> Reporter: Will Glass-Husain
> Assignee: Claude Brisson
> Priority: Minor
> Fix For: 2.0
>
>
> The following example:
> #set($thisCampNumber = 10)
> #set($nextCampNumber = $thisCampNumber+1)
> #set($previousCampNumber = $thisCampNumber-1)
> #set($previousCampNumberB = $thisCampNumber - 1)
> 1: $thisCampNumber<br>
> 2: $nextCampNumber<br>
> 3: $previousCampNumber<br>
> 4: $previousCampNumberB<br>
> produces this result
> 1: 10
> 2: 11
> 3: $previousCampNumber
> 4: 9
> Note that using a minus sign in a #set statement does not work if there are
> no spaces around it. (however, the same is not true for +).
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]