-
Notifications
You must be signed in to change notification settings - Fork 1
Differences with NVelocity
Alex Crome edited this page Jun 4, 2016
·
5 revisions
#New Features
- New ANTLR based Parser. This parser is easier to update, and fixes a few oddities or the old parser (e.g.
$()
and$.foo
are now parsed as text which help with JQuery support) - Templates are compiled rather than interpreted - this results in faster execution time, although it does have a cost of a higher first time cost than NVelocity due to the time taken to compile & JIT the templates.
- Support for native dictionary syntax
{key: value}
- Can use double quotes to escape a quote in a string literal, or interpolated string
John''s coat'
,"foo "" bar"
- Interoprability with dynamic objects.
- Literal blocks
#[[Text Within a literal block not parsed or executed, and output as is $foo $bar]]
#Known Incompatibilities
- #23 IronVelocity does not support comparing objects implementing IComparable using relational operators
- #21 Whitespace before #set() is not swallowed by IronVelocity
-
#19 Escaping in IronVelocity is a simple escape character to escape a $ or # in text. In NVelocity, you escape an entire reference, which lead to some confusing semantics. For example
\$foo.Bar()
in NVelocity would have always evaluated$foo.Bar()
, and then output the text$foo.Bar()
if it evaluated to a non null value, otherwise\$foo.Bar()
. In IronVelocity you simply escape the dollar so will always output$foo.Bar()
never evaluating$foo.Bar()
-
#11 Nvelocity allowed you to prefix arguments with
#
in certain places and still parse e.g.#set($z = #$x)
. This is a parser error in IronVelocity. - Macros have limited support (Will accept pull requests)
- IronVelocity uses different types for Lists & Dictionaries. If code took a dependency on a concrete type (
HybridDictionary
orArrayList
), they may encounter problems. They should instead rely on theIList<object>
andIDictionary<object,object>
, or their read only variants. - The Parse directive is not supported - the startup costs of IronVelocity are to high to allow for dynamic parsing. May revisit once #12 is implemented.
- NVelocity allowed you to call explicitly implemented interface members. IronVelocity does not allow this.
- IronVelocity Does not support comparing strings using comparison operators (less than, greater than etc.). Equality & Inequality remain supported (no plans to fix) (TODO: think this is a special case of #23, but need to check)