On 08 Aug 2005 11:27:16 +0200, Rafal Bisingier wrote:
> 
> This patch ads new test-condition to the Test function named Compare.
> With it one can do simple comparisions of numbers or strigs without
> using PipeRead and shell subprocesses. This could be very handy in
> conditional configuration (a simple if-else is possible with it).

I don't really like this verbose syntax:

  Test (Compare "string 1" strcmp "string 2") DoSomething

The following syntax is better:

  Compare ("string 1" eq "string 2") DoSomething

Perl's operators (eq, ne, lt, gt, le, ge and cmp) are string equivalents
of numerical operators (==, !=, <, >, >=, <=, <=>). Not sure there is a
need for 2 sets of operators rather than just string operations, but ok.

Having separate command for this is not really a problem, just like we
have separate command for TestRc.  And if already do this, then simply:

  If ("string 1" eq "string 2") DoSomething

But then we had another similar "If" patch by Scott, IIRC.

Regards,
Mikhael.

Reply via email to