Page 1 of 1

URL Syntax

Posted: Sat Feb 06, 2010 9:37 pm
by vamp07
Hi Everyone,

I just bashed my head for an hour trying to get this to work:
put URL"file:/Users/xyz/"&it into field "log"

I had no success until I changed the syntax to:
put URL("file:/Users/xyz/"&it) into field "log"

I looked at the dictionary definition or URL and the examples provided did not use URL in the more traditional language syntax. Was I doing anything wrong?

Thanks

Steven

Re: URL Syntax

Posted: Sun Feb 07, 2010 3:22 am
by FourthWorld
With the first form the engine attempts to get the contents of the URL and then concatenate that with "it" Using the parens in the second form makes it clear to the engine that "it" is to be concatenated to the URL, not the data returning from it.

Re: URL Syntax

Posted: Sun Feb 07, 2010 3:28 am
by BvG
The problem here is the operator precedence.

IF you remember some of your school math, then you remember that + (add) comes before * ( multiply). Similar rules are followed by rev code, and the url (url keyword) comes before & (string merging operator). This is unfortunate, and I hate it. However, it has historical reasons, and is unlikely to be changed. So what rev tries to do without the brackets is:

Code: Select all

put URL "file:/Users/xyz/" into field "log"
put it after field "log"
by using brackets you tell rev that you want this:

Code: Select all

put "file:/Users/xyz/"&it into temporary
put URL temporary into field "log"

Re: URL Syntax

Posted: Sun Feb 07, 2010 12:09 pm
by vamp07
Got it.. I went back to the manual and on page 163 it gets into the dirty details of this topic. Thank!!!