write fails

Jeanne A. E. DeVoto revolution at jaedworks.com
Thu Aug 25 12:55:33 EDT 2005


At 11:22 AM -0500 8/25/2005, Ken Ray wrote:
>Yes, you can, but remember that URL is both a keyword and a function, and
>although it can work without parentheses for some file operations (like
>"into"), it doesn't work when using "after" or "before" without using
>parentheses, and can be touchy at other times.
>
>So I think we've been "getting away" with saying:
>
>   put data into url "file:c:/my documents/test.txt"
>
>when we really should be saying:
>
>   put data into url("file:c:/my documents/text.txt")

I'm afraid that's not right, Ken. URL isn't a function, and while 
your example will work, Rev might not always let you get away with 
leaving out the space after "URL".

The reason you need to use parentheses in statements like
    get URL ("file:" & myURL)
is that URL resolution comes before "&" when resolving expressions. 
(Ken can stop reading here, since he's an expert and knows what that 
implies, but for everyone else: ;-)

If you write something like
    get URL "file:" & myURL
the engine thinks you mean "get URL 'file:', then concatenate it to 
the variable 'myURL'". Since "file:" by itself isn't a valid URL, you 
don't get what you want.

Adding the parentheses forces the engine to do the concatenation 
first, so you get the URL you're seeking. But in this case, the 
parentheses have nothing to do with a function call; they're there to 
straighten out the order in which the engine does the operations to 
get the final value of the expression, 'URL "file:" & myURL'.
-- 
jeanne a. e. devoto ~ revolution at jaedworks.com
http://www.jaedworks.com



More information about the use-livecode mailing list