MLL,

I'm assuming you made the change below [1] to defer_tools.js to make it
clearer.  The disadvantage, IMO, is that now there are two regular
expressions that are identical except for one tiny, albeit important,
difference.  If we need to modify the common parts of the regexs later,
we'll have to remember to modify it in two places.

There's all kinds of arguments against using the ternary operator (most of
which I don't agree with), but in this case, my personal opinion is that it
avoids duplication of common code and provides a defense later errors.  The
code is also a bit more concise.

Also, what prompted the change [2] to disallow dashes and periods in switch
names? This may be the right thing to do, but I'm a bit concerned that those
were there a reason... but maybe not.

Glenn

From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 24, 2002 11:00 AM
Subject: [DQSD-CVS] dqsd ChangeLog.txt,1.52,1.53 defer_tools.js,1.11,1.12

<snipped>

[1]
> --- defer_tools.js 24 Jul 2002 15:59:57 -0000 1.12
> !         var expect_regex = new RegExp(
> !             '^(' + re_res_args[2].replace('.', '\\.') +
> !              ')' + (expandSwitches ? '' : '$'), 'i');
> !
> !         re_res_switch = expectedSwitches[j].match(expect_regex);
> !
>           //  If there is a match, adjust the args_array, and save the
values.
>           if (re_res_switch)
> --- 163,170 ----
>         for (var j = 0; j < expectedSwitches.length && !re_res_switch;
j++)
>         {
> !         if (expandSwitches)
> !           re_res_switch = expectedSwitches[j].match(new RegExp('^(' +
re_res_args[2] + ')', 'i'));
> !         else
> !           re_res_switch = expectedSwitches[j].match(new RegExp('^(' +
re_res_args[2] + ')$', 'i'));
>           //  If there is a match, adjust the args_array, and save the
values.
>           if (re_res_switch)


[2]
>     // Regular expression that defines switches
> !   var re_switch = /\/(([-.\w]+)(?::?(\S*)))\s*/;
>     var re_res_args;
>     var re_res_switch;
> --- 150,154 ----
>
>     // Regular expression that defines switches
> !   var re_switch = /\/((\w+)(?::?(\S*)))\s*/;
>     var re_res_args;
>     var re_res_switch;




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
DQSD-Devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dqsd-devel

Reply via email to