On 13/6/99 3:19 pm M. Uli Kusterer <[EMAIL PROTECTED]> wrote:

>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.

I'm not sure I agree about your example above.  In that particular case, 
you can simply do what MC does and have a single directory delimiter 
cross platform.  And I can't think of a case where it wouldn't be 
possible to call a function to achieve the kind of functionality you're 
talking about.  But needing that kind of functionality is relatively 
rare: usually you just want to change the delimiter for the current 
section of script.  Having to save it, set it and reset it is not exactly 
intuitive, and local delimiters have made scripters lives easier (I know: 
we've had less tech. support to give on this subject since they came in).

But being able to set multiple delimiters is a line is the final icing on 
the cake, and I hope no-one will say I've misread things if I suggest the 
syntax we seem to have arrived at on this list is:

put item 2 by <del|imiter> "/"

Regards,

Kevin

>Cheers,
>-- M. Uli Kusterer


Kevin Miller <[EMAIL PROTECTED]> <http://www.xworlds.com/>
Cross Worlds Computing, MetaCard Distributors, Custom Development.
Tel: +44 (0)131 672 2909.  Fax: +44 (0)1639 830 707.

Reply via email to