On Thu, 17 Jun 1999, M. Uli Kusterer wrote:
> >For those of you who want to read this quickly, a syntax summary. All will
> >be explained below. All single-quoted things are literals, and spaces can
> >be any amount of whitespace. An elipsis (three periods -- ...) indicates
> >continuations in the same fashion for however long the user feels like,
> >brackets indicate optional portions. A vertical bar, |, indicates different
> >options (of which one must be chosen). Unquoted words are expressions to be
> >filled in by the user. Assume the entire thing is on one line; it sort of
> >wrapped.
>
> Anthony,
>
> please use official syntax conventions used in all Hypercard docs:
>
> Unquoted words are keywords/identifiers which have to be written just like
> that, optional stuff is enclosed in [ and ], expressions to be filled in by
> the user (variables, containers, etc.) are encliosed in < and >. Literals
> are, of course, quoted. So, your example would read, ideally:
>
> put item <integer> [delim[ited] [by] <character|regexp>] of <container>
> into <container>
>
> where a chunk can also be a container.
>
> >Perhaps also allow 'of' to be replaced by '=' or 'is':
> >
> > 3) put item 3 (delim="3") of list into i -- or "delimiter="
> > 4) put item 3 (delim is "3") of list into i -- or "delimiter is"
>
> Horrible! This will collide with expressions and looks like someone wanted
> to set the delimiter to a boolean expression. Also, in xTalk there is no
> such thing as using "=" or "is" to assign a value to a variable, one uses
> put. The only place where it's different is the "repeat for" construct,
> which I consider a weak spot in the language.
This topic came up before, and I think the concensus was that we were
going to allow it in a couple of other places too:
local somevar = "some value"
constan someconstant = "some value"
> > put item 1 (delimted by "a" or "b" or "c" or...) of ...
> > put tiem 1 (delim "a" or "b" or "c" or...) of...
> > put item 1 (delim="a" or "b" or "c" or...) of...
> > put item 1 (delim is "a" or "b" or "c" or...) of...
>
> Same here. This looks like someone using the "or" operator to assign a
> boolean expression as the delimiter. With a command like "answer" this is
> tolerable, as there it occurs only in a very limited scope, but with nested
> chunks and all that, code becomes unreadable if one intermingles boolean
> expressions and chunks. Please, don't do it.
Agreed. Though something like this would be nice to have.
> >The important question would be should we allow:
> >
> > put item 1 (delimited by "ab") of...
> >
> >In other words, should we allow multicharacter delimiters? I see no reason
> >why not!
>
> Same here. We should optimize for single-character delimiters, but
> allowing muli-character delimiters sounds like a valuable option.
And unfortunately pretty painful to implement ;-)
> >And how long until we add in regexp support? It'd fit the syntax:
> >
> > put item 1 (delimited by regexp "[a-zA-M]") of...
> > -- or "regular expression" or whatever
>
> I think regexps this way are terrible, because they're unreadable.
> HyperCard has such cool readable syntax, and we should first try to come up
> with readable syntax for a regexp feature (although MC has already got its
> own regexp function). Ideally this would be some syntax as readable as
> HyperCard's sort command has:
>
> sort the lines of cd fld 5 by item 1 of each
This syntax is fine and works in MetaCard too. I am intrigued by the
regex proposal, but I think as long as you're doing regex, using the
matchText() function with parenthesized subexpressions should do the
trick.
Regards,
Scott
> 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
>
>
********************************************************
Scott Raney [EMAIL PROTECTED] http://www.metacard.com
MetaCard: You know, there's an easier way to do that...