Say I have something like this in a macrodef
:
<var name="someName" unset="true" />
<property name="someName" value="someValue" />
This seems to work, but is it a defined behavior to unset a var before it being set? I am new to ant and haven't find anything which documents this case.
Yes it is ok to unset a variable (which is nothing more than a mutable property) if it is not set. Unsetting the variable boils down to removing an entry from a hash table that contains the list of properties. From the documentation of Hashtable#remove(Object key)
:
Removes the key (and its corresponding value) from this hashtable. This method does nothing if the key is not in the hashtable.