modern Tcl and correct quoting

Poor Yorick org.macosforge.lists.macports-dev at pooryorick.com
Wed Jun 12 21:39:29 PDT 2013


On Wed, Jun 12, 2013 at 04:57:38PM -0500, Ryan Schmidt wrote:
> 
> I would guess that most programmers who wrote "==" in Tcl didn't realize it was a numeric comparison operator. It certainly wasn't clear to me, since it works correctly on most strings. That kind of thing trips me up in bash scripting as well. In addition to base, most Portfiles get this wrong too. It's even all over our recommended code snippets in the PortfileRecipes wiki page.
> 

To be precise, "==" is an all-purpose comparison operator which prefers numeric
comparisons.

To improve code quality, I think the best policy, rather than emphasizing the
superficial similarities between Tcl and sh or C syntax, is to highlight the
uniquely elegant features and idioms of Tcl syntax.

I've mastered some of the deepest darkest corners of bash syntax (got some
creds in ABS), and it's one of my ongoing regrets.  If only I could get those
years back and put them into Tcl instead!  Bash never became fun, but coding in
Tcl only gets more satisfying.

-- 
Yorick


More information about the macports-dev mailing list