On Thu, 27 Nov 2008 17:56, Mario DeFazio wrote:
>
> I guess old habits die hard, but I still wonder why it is that 15 (or is
> it 20?) years after
> David Korn added native integer arithmetic and the math expression (( ))
> to ksh,
> folks still use -eq, -ge,  -gt and so on inside [[ ]] or worse,  [ ] .
> You have the integer variables defined with let, why not use them as
> integers
> and avoid the unnecessary num-to-string-to-num conversions, the extra
> $var derefs,
> and improve the readability? OK, readability may be subjective, but we
> all remember
> our basic algebraic expressions, right? :-)
>
Guilty as charged; I'm allergic to anything that looks like csh, and yes, 
some old habits die extremely hard. However in the context of the 
performance question presented (nice to tie it back on-thread), I think 
we're looking at a storm in a teacup.

> Regarding post-fix/pre-fix operations, I am a stalwart fan of the KISS
> principle,
>
So? I was only questioning the runtime environment I tested it on (ie 
biological neurones) since I didn't actually run it on silicon. Glen's 
reply about wait proves that I completely missed something obvious due to a 
lack of hot mineral testing. I can't see your point otherwise.

> Therefore I gently submit these syntax changes for your code above:
>
> while (( n > 0 )) ; do
>     wait
>     (( n-- ))
> ...

Given Glen's point about wait, this tail loop simplifies to a simple wait, 
and the main loop needs to be smarter; with or without integer variables!

> At least it's nice to see that many people have stopped using [ ]  in
> favor of [[ ]] :-)
>
I still feel thoroughly modern for achieving that; perhaps it's time to join 
the 21st century and (( embrace this )) too.

Cheers


_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to