Open loomis opened 11 years ago
See branch issue_32 for initial changes for this issue. The problem with the implementation is that the current escape functions are global static utilities. Either turning the escaping on or off will have to be a global (JVM) decision or the compiler options will have to be threaded through to all of the escaping function calls. For the pan escape/unescape functions this isn't much of an issue because the compilation context is available. However, the escape function is used in the Path constructor which is called from numerous locations, often without the compiler context or options being available.
I'd suggest another option ot the optional new behaviour initially envisionned through the new panc option: start a new major version of the compiler (v11) where the new behaviour is introduced and replaces the current behaviour. As long as we have the CCM-compliant version ready (capable of handling the new property/attribute in the profile saying if escaping was enabled or not when generating the profile, see #35) for 14.x version and 13.x, this should have no impact on sites. The only requirement for sites will be to upgrade to the last version of CCM before switching to v11. And this would make the implementation much simpler (thus quicker!) and keep the compiler code cleaner. After this change, there will be no restriction in the pan language about the characters that are valid in a path element, except '{ and '}' that are currently used to escape path elements. Thus backward compatibility requires to keep them as special characters and I propose to keep them as a way to escape standard interpretation of characters like '/' and '$'. For example :
'/a/{/tmp/test}' = 'Just a test';
variable MYFILE = '/tmp/test';
'/a/{${MYFILE}} = 'Just a test';
These two examples would be valid and result in the second path element to be /tmp/test
. Note that the second form is not yet supported and is related to #77.
I vote for introducing this cleanly in a new major version.
I vote also for introducing the change into a new major version.
Since all of the output formats can handle non-escaped values, add a switch to turn off the escaping. An agreement needs to be made about how to transmit the value of this switch to downstream clients.