modern Tcl and correct quoting

Poor Yorick org.macosforge.lists.macports-dev at pooryorick.com
Wed Jun 12 08:24:42 PDT 2013


On Wed, Jun 12, 2013 at 10:58:50PM +1000, Joshua Root wrote:
> On 2013-6-12 22:00 , Rainer Müller wrote:
> > On 2013-06-12 08:05, Poor Yorick wrote:
> >> 	use "eq" instead of "==" where appropriate
> > 
> > Fine as well.
> 
> What is the benefit of this? Is it just that the operands could
> potentially be numerically equal but different strings, in cases where
> we want an exact string match?
> 

It's mostly for performance, as "eq" allows Tcl to avoid the running the
heuristics to determe what types of values are being compared, but there are
edge cases where using "==" will use numerical comparison where string
comparison was intended or vice versa.  Borrowing from Python Zen, "Explicit is
better than implicit".

-- 
Yorick


More information about the macports-dev mailing list