From ruby-talk-admin@ruby-lang.org Fri Dec 16 02:12:06 2005 Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (8.12.3/8.12.3/Debian-6.6) with ESMTP id jBFHC5Zk029070; Fri, 16 Dec 2005 02:12:06 +0900 Received: from funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 6F6025A6A; Fri, 16 Dec 2005 02:12:10 +0900 (JST) Received: from localhost (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 67AA1F04846; Fri, 16 Dec 2005 02:12:10 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 17B57F04842; Fri, 16 Dec 2005 02:12:09 +0900 (JST) Received: from beryllium.ruby-lang.org (beryllium.ruby-lang.org [210.163.138.100]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id E97F163002C; Fri, 16 Dec 2005 02:12:08 +0900 (JST) Received: from beryllium.ruby-lang.org (beryllium.ruby-lang.org [127.0.0.1]) by beryllium.ruby-lang.org (Postfix) with ESMTP id 9810133984; Fri, 16 Dec 2005 02:12:07 +0900 (JST) Received: from localhost (beryllium.ruby-lang.org [127.0.0.1]) by beryllium.ruby-lang.org (Postfix) with ESMTP id 5AFC433989 for ; Fri, 16 Dec 2005 02:11:59 +0900 (JST) Received: from beryllium.ruby-lang.org ([127.0.0.1]) by localhost (beryllium.ruby-lang.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 10181-09 for ; Fri, 16 Dec 2005 02:11:59 +0900 (JST) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.195]) by beryllium.ruby-lang.org (Postfix) with ESMTP id 581A833984 for ; Fri, 16 Dec 2005 02:11:56 +0900 (JST) Received: by zproxy.gmail.com with SMTP id 8so407762nzo for ; Thu, 15 Dec 2005 09:11:51 -0800 (PST) Received: by 10.37.15.5 with SMTP id s5mr2019248nzi; Thu, 15 Dec 2005 09:11:50 -0800 (PST) Received: from lilith.local ( [84.157.5.7]) by mx.gmail.com with ESMTP id 15sm3197800nzp.2005.12.15.09.11.49; Thu, 15 Dec 2005 09:11:50 -0800 (PST) Received: by lilith.local (Postfix, from userid 501) id EA73E4A6D01; Thu, 15 Dec 2005 18:11:46 +0100 (CET) Delivered-To: ruby-talk@ruby-lang.org Date: Fri, 16 Dec 2005 02:11:59 +0900 Posted: Thu, 15 Dec 2005 18:11:46 +0100 From: Christian Neukirchen Reply-To: ruby-talk@ruby-lang.org Subject: Re: regular expressions question To: ruby-talk@ruby-lang.org (ruby-talk ML) Message-Id: In-Reply-To: (Neil Stevens's message of "Thu, 15 Dec 2005 13:03:15 +0900") References: <1134594056.651873.15620@z14g2000cwz.googlegroups.com> <1134597567.426280.11150@o13g2000cwo.googlegroups.com> <1E7A0585-F57B-4C44-92B4-814C4FEB8A0C@grayproductions.net> X-ML-Name: ruby-talk X-Mail-Count: 71 X-MLServer: fml [fml 4.0.3 release (20011202/4.0.3)]; post only (only members can post) X-ML-Info: If you have a question, send e-mail with the body "help" (without quotes) to the address ruby-talk-ctl@ruby-lang.org; help= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) X-Original-To: ruby-talk@ruby-lang.org DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:to:subject:references:from:date:in-reply-to:message-id:user-agent:mime-version:content-type; b=YD0J8tNboN31ZjFs8mMVMcyv9zsAh7i3I442QMW2eFMMTROPbVp02eoNFz31tJAFo7+GT0x6/ObOHiyTCdFAcsYQAj+j0dGJM1alj1+Ao71gK2Rwomh6jPT8G3Lm8Tl3tDLfN8WbRV1TQMu7Wq0KskTf+eJVlAO+RKF2Btc2i5I= X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ruby-lang.org X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on beryllium.ruby-lang.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=7.0 tests=AWL,BAYES_00,BLARS00, BLARS_SPAM00,CONTENT_TYPE_PRESENT,QENCPTR2,RCVDFRMLOCALIP,RCVD_BY_IP, RCVD_IN_BLARS,RCVD_IN_BLARS_HOOPS,RCVD_IN_BLARS_SPAM autolearn=ham version=3.0.3 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Precedence: bulk Lines: 36 List-Id: ruby-talk.ruby-lang.org List-Software: fml [fml 4.0.3 release (20011202/4.0.3)] List-Post: List-Owner: List-Help: List-Unsubscribe: X-Virus-Scanned: by AMaViS snapshot-20020531 Neil Stevens writes: > James Edward Gray II wrote: >> Also, I believe they are thread-local variables are they not? (I'm >> honestly asking.) If so, I don't see a lot of concern about them being >> stomped on before they are used. > > Actually, I just looked it up, and according to "Programming Ruby," > $1-$9 are "local to the current scope." > > My mistake, heh. I wonder how many who use them know that, though, and > how many just do it without checking because it's popular in perl or > popular on here. Actually, these variables are thread-local in Perl too: use strict; use threads; "foo" =~ /(\w+)/; print($1, "\n"); threads->new(sub { "bar" =~ /(\w+)/; print($1, "\n"); })->join; print($1, "\n"); prints: foo bar foo > Neil Stevens - neil@hakubi.us -- Christian Neukirchen http://chneukirchen.org