>But:
>What about to have the "set itemdelimiter to x" to be local instead of
>global
>or to have
>set globalitemdelimiter to x
>and
>set itemdelimiter to x --which is then local

Hi,

 it still would be much more comfy. Imagine you are parsing text. Sometimes
you need a different delimiter for every line in a script. Or imagine you
are moving an item to a different "delimiter level". I.e. imagine you have
a list of headings:

 put "Major 1:Minor 1:Text 1\Major 2:Minor 2:Text 2" into str

and now you want to make "Text 2" another Major. You'd have to say:

 set the itemDelimiter to "\"
 get item 2 of str
 delete item 2 of str
 set the itemDelimiter to ":"
 put it into item 3 of str

and then you'd finally have:

 Major 1:Minor 1:Text 1\Major 2:Minor 2\Text 2

Now, imagine we had this "by" or "delimiter" syntax:

 put item 3 by ":" of (item 2 by "\" of str) into item 3 by "\" of str
 delete item 3 by ":" of item 2 by "\" of str

2 lines vs. 5 is a good argument to me. It would also reduce parsing
overhead as The second situation can be optimized a bit better by the xTalk
host, I guess.

>local delimiter:

I believe MC recently made the delimiter local. In HC it is reset to comma
on idle. I have to admit I like "reset on idle" better for situations where
you have to work a lot with the same delimiter, for example when munging
with search paths it'd be cool if I could have a handler like the following.

on setupFileDelim
  GLOBAL gOldDelim
  put the itemDelimiter after gOldDelim
  if the platform = "MacOS" then
    set the itemDelimiter to ":"
  else if the platform = "DOS" then
    set the itemDelimiter to "\"
  else
    set the itemDelimiter to "/"
  end if
end setupFileDelim

on restoreFileDelim
  GLOBAL gOldDelim
  set the itemDelimiter to last char of gOldDelim
  delete last char of gOldDelim
on restoreFileDelim

on mouseUp
  setupFileDelim
  answer file "Choose a file"
  put it into thePath
  put last item of thePath into fileName
  put first item of thePath into volumeName
  put item (number of items of thePath) -1 into parentFolderName
  restoreFileDelim
end mouseUp

With a local delimiter, you'd have to re-implement setupFileDelim and
restoreFileDelim in every handler that works a lot with file delimiters. Of
course, you can work around this problem by creating a fileDelimiter()
function that returns the proper delimiter, but there sure are other cases
where it isn't that simple. And sometimes you may want to change the
delimiter for all functions your handler calls. Of course, you can pass it
in, but that doesn't look as elegant. Anyway, it's my personal opinion and
it isn't really a problem. The deal is that itemDelimiter should be the
default used when writing "item" and you should be able to override it
using "by <delimiter>" or a similar construct.

 My opinion, now I want yours.

Cheers,
-- M. Uli Kusterer

------------------------------------------------------------
             http://www.weblayout.com/witness
       'The Witnesses of TeachText are everywhere...'

--- HELP SAVE HYPERCARD: ---
Details at: http://www.hyperactivesw.com/SaveHC.html
Sign: http://www.giguere.uqam.ca/petition/hcpetition.html

Reply via email to