Ian Jaroslaw Kowalski wrote:
One more thing which I forgot:
Q1 there's a problem where:
B: ${$propertyname} and ${propertyname} C: ${${propertyname}} and ${propertyname}
both are legal forms to express a property. Variant A has no such problem.
Jarek
----- Original Message ----- From: "Jaroslaw Kowalski" <[EMAIL PROTECTED]>
To: "Scott Hernandez" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Saturday, December 06, 2003 11:40 AM
Subject: [nant-dev] SUMMARY: Expression Syntax
Hi Scott,because
As you requested, here's a summary of expression evaluator discussion:
Ian, Gert, Martin - can you please correct me if I'm wrong anywhere in the summary.
======================================================== There are 2 questions:
QUESTION 1: How should expressions be written?
A) <echo message="aaa" if="${length(propertyname)=3}" /> B) <echo message="aaa" if="${length($propertyname)=3}" /> C) <echo message="aaa" if="${length(${propertyname})=3}" />
Variant A - is clean and compatible with current approach to accessing properties. Properties can still be accessed as ${propertyname}.
This may have the following problems:
- it may be hard to distinguish between property and function names
they only differ by () (Java, C#, C++ also have this problem).be
- we may no be able to access some properties (like
nant.task.cvs-checkout.location) because they contain dashes which cannot
distinguished from "minus" operator. "a-b" could either be "a" MINUS "b"or
a property named "a-b". Fortunately there are only 6 such properties inNAnt
(so this could be quite easily resolved):told
nant.tasks.cvs-update nant.tasks.cvs-checkout nant.tasks.delay-sign nant.tasks.cvs-update.location nant.tasks.cvs-checkout.location nant.tasks.delay-sign.location
There was a suggestion to disallow such property names and formally define them as:
property name => identifier { DOT identifier } * identifier => [a-zA-Z_][a-zA-Z0-9_]*
In English:
"property name" is a sequence of "identifiers" separated by dots "identifier" starts with a latin letter or an underscore and contains only letters, digits underscores (like in C#, C++, Java, VB, JavaScript...)
- we may not be compatible with property names which are numeric. I was
that currently a property can be named "1234". There seems to be anaccess
agreement that this should be disallowed asap. I suggest that we disallow
properties containing dashes in their names at the same time.
- one could always use use propertyvalue('propertyname') function to
weird-names propertiesbecause
Variant B - prefix properties with '$' - similar to PERL
- is still quite clean, yet there are some dollars starting to appear
- this solves the first problem (the properties can be distinguished
somethey are prefixed with $) - accessing properties with dashes can still be tricky:
$property-name-with-dashes // access property $property-name-with-dashes(1) // $property-name-with MINUS dashes(1)
Variant C - enclose properties in ${...}
- it's difficult to read, especially when using proportional font, - it's unambiguous - no problem accessing any property
Opinions on Q1:
Jarek: A Martin: A Ian: A or B Gert: B or C
QUESTION 2:
Should we always require ${} (or anything else we use for quoting) to be
written around expressions, or should we allow unquoted expressions in
places?I
Variant A (quote all expressions)
<if test="${length(someproperty)=3}"> ... </if>
<echo message="test" if ="${length(someproperty)=3}" /> <echo message="test" unless ="${length(someproperty)=3}" />
- it's simple
- you ALWAYS use quotes around expressions (both embedded in strings and
stand-alone)
- you can easily spot the expressions in your build file
- this may allow for easy implementation of syntax highlighting (actually
already did this for VIM)
Variant B: allow for unquoted expressions in some places where non-string values are expected:
Like "<if test="..." /> <... if="..." /> <... unless="..." />
<if test="length(someproperty)=3"> ... </if> <echo message="test" if="length(someproperty)=3" /> <echo message="test" unless="length(someproperty)=3" />
- this is somewhat more readable (less dollars) - it may be hard to find expressions in the build file. - it may not be clear when to use quotes and when not to use them
Variant C: skip quotes for <if test="..." /> - keep for everything else
- this is implemented in "test1"
Opinions on Q2:
Jarek: A Martin: A
CURRENT STATUS:
1. Expression evaluator is in CVS in branch "EE-patches" 2. It implements variants: Q1:A and Q2:C
A binary release of this is available at
http://jaak.sav.net/nant-ee/nant-ee-test1.zip
It contains some test cases written as a build file.
Jarek
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers
--
Ian MacLean, Developer, ActiveState, a division of Sophos
http://www.ActiveState.com
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers