repeat . . . delimit by

Richard Gaskin ambassador at fourthworld.com
Mon Sep 16 02:23:47 CEST 2013


Alex Tweedly wrote:
> On 16/09/2013 00:44, Richard Gaskin wrote:
>> It may also be helpful to remember that lineDel and itemDel are purely
>> arbitrary; that is, they needn't be limited to use only on what we
>> might think of as lines and items.
>>
>> The only general rule governing them is that the engine will insist
>> that "lines" be a larger chunk type than "items" (you can get item 2
>> of line 1, but you can't get line 2 of item 1) - but beyond that
>> you're free to use whatever delimiters you like.
> Well, it only insists on that in a very limited way.
>
> A single item can contain multiple lines.
>
> You cannot say
>     put line 1 of item 2 of temp
> But you can say
>     put line 1 of (item 2 of temp)
> and it will happily do so.
>
> put "abc,def" & CR into temp
> put "ghi,klm" & CR after temp
> put line 1 of  (item 2 of temp)
>
> does indeed output "def"

Yes, using parens can coerce independent evaluation of expressions to 
bypass the rule regarding chunk sizes, and other rules as well.

A popular example:

   put url "file:" & tSomePath

...yields the contents of the variable tSomePath (hopefully a file path) 
because "file:" is evaluated first, and then the empty contents of the 
unfound file is concatenated with the contents of tSomePath.

But using:

   put url ("file:" & tSomePath)

...will yield the contents of the file, since the parenthetical 
expression is first evaluated independently before being acted on by 
"put url".

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  Follow me on Twitter:  http://twitter.com/FourthWorldSys



More information about the use-livecode mailing list