[999] in Coldmud discussion meeting

root meeting help first previous next next in chain last in chain last

[COLD] string matching functions

daemon@ATHENA.MIT.EDU (Wed May 15 17:32:57 1996 )

Date: Wed, 15 May 1996 15:02:19 -0600 (MDT)
From: Brandon Gillespie <brandon@tombstone.sunrem.com>
To: coldstuff@cold.org

I realize we have hit the post 1.0 stage, but this is something which has 
been grating on me for a while.  Namely, the order of arguments varies 
from matching function to matching function.  All functions generally 
have a key argument (i.e. the pattern, template, regexp) and a string, 
along with other args.  However, the order of these varies.  I would
like to change that, so its always the same across the board.  Right now 
we have:

    match_begin(str, key, ...)
    match_pattern(key, str, ...)
    match_template(key, str, ...)
    match_regexp(key, str, ...)
    regexp(key, str, ...)
    strsed(key, str, ...)

The only reason the regexp functions have the key first is because 
template and pattern were key first as well.  However, I'm considering
switching them, as it would 'feel' much more natural across the board,
and with native method hooks it would make MUCH more sense.  For 
instance, right now you would do:

       "regexp".match_regexp(str);

When in actuality the target should be 'str', not 'regexp'.  In swapping 
the order this would straighten out to:

       str.match_regexp("regexp")
(or):  match_regexp(str, "regexp")

What I'm suggesting doing is changing ALL matching functions to take the 
string as the first argument, and the key as the second argument.  The 
impact of this is anybody who is not planning on simply upgrading to the 
next coldcore would have to search their db for each matching function 
and swap the args (I'll be doing coldcore).

Comments?

-Brandon Gillespie