I've thought Mikhael will comment on this and I didn't make a mistake...
;-)

On Mon, Aug 08, 2005 at 10:59:16AM +0000, Mikhael Goikhman wrote:
> 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

Well, this syntax is strightly derived from existing syntax and this is
the only reason of it's form.

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

I need it only for integer comparision, so didn't take much care about
string operations. I've added strcmp only for completness and because it
was easy to do ;-)
I personaly don't like perl's string operators (eq, ne, etc.) and I
don't see any reason to have le, lt, ge and gt operators other than
completness. I think much more useful would be case insensitive
comparision, but that's only my point of view.

> 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

When I made this patch I wanted it to make as little changes to fvwm
source as possible and make the patch as simple as I only can in the
hope
that this can help in merging it into fvwm...

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

Yes, there is a patch from Scott adding a complete if-elseif-else-endif
syntax, but it's far more bigger, much more complicated and adds
completely new syntax. From the other side Scott's patch is more
functional and probably simpler to use in complicated configuration.

I don't care which patch can be included into fvwm now (it could be even
both of them), I just wanted to have some kind of conditional syntax
aviable in fvwm config file without the need of external commands run by
PipeRead.

PS. Scott's patch was planed to be included after 2.6 release, but I
don't think 2.6 will came out in near future and I need this kind of
functionality right now (or more precisely I need it since october'04 ;-)

-- 
Greetings
Rafal Bisingier

Attachment: pgp1cDPB3n3tw.pgp
Description: PGP signature

Reply via email to