From ruby-talk-admin@ruby-lang.org Fri Dec 16 02:42:45 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 jBFHgjZk029959; Fri, 16 Dec 2005 02:42:45 +0900 Received: from funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id B81125A4B; Fri, 16 Dec 2005 02:42:49 +0900 (JST) Received: from localhost (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id B34C5F04847; Fri, 16 Dec 2005 02:42:49 +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 80BD1F04866; Fri, 16 Dec 2005 02:42:47 +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 86148630030; Fri, 16 Dec 2005 02:42:47 +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 ED4A333DCC; Fri, 16 Dec 2005 02:42:46 +0900 (JST) Received: from localhost (beryllium.ruby-lang.org [127.0.0.1]) by beryllium.ruby-lang.org (Postfix) with ESMTP id D0CCF33DCE for ; Fri, 16 Dec 2005 02:42:39 +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 13998-02 for ; Fri, 16 Dec 2005 02:42:39 +0900 (JST) Received: from sinus.lauschmusik.de (sinus.lauschmusik.de [213.95.32.201]) by beryllium.ruby-lang.org (Postfix) with ESMTP id 65D0733DCC for ; Fri, 16 Dec 2005 02:42:39 +0900 (JST) Received: from localhost ([127.0.0.1] helo=localhost.localdomain) by sinus.lauschmusik.de with esmtp (Exim 4.50) id 1Emx5E-0004lH-VV for ruby-talk@ruby-lang.org; Thu, 15 Dec 2005 18:40:01 +0100 Received: from g44g2000cwa.googlegroups.com (g44g2000cwa.googlegroups.com) by sinus.lauschmusik.de with NTTP id 166245 for ; Thu Dec 15 18:40:00 CET 2005 Received: from [217.206.116.210] by g44g2000cwa.googlegroups.com (unknown) with NNTP id 166245 for ; Thu Dec 15 18:40:00 CET 2005 Received: from Usenet via a Usenet to mail gateway located at lauschmusik.de. This service provided as a courtesy to the ruby-talk mailing list. If this message is SPAM, its ultimate origin is Usenet, not this gateway program. All subscribers to the ruby-talk mailing list agree to receive the Usenet postings made to comp.lang.ruby via this gateway. Please see http://www.ruby-lang.org/ruby-talk-usenet-policy.html. Delivered-To: ruby-talk@ruby-lang.org Date: Fri, 16 Dec 2005 02:42:40 +0900 Posted: 15 Dec 2005 09:38:15 -0800 From: ajmayo@my-deja.com Reply-To: ruby-talk@ruby-lang.org Subject: Re: Assigning a block to a variable in Ruby To: ruby-talk@ruby-lang.org (ruby-talk ML) Message-Id: <1134668294.973531.304020@g44g2000cwa.googlegroups.com> In-Reply-To: <1134665773.927049.245200@z14g2000cwz.googlegroups.com> References: <1134665773.927049.245200@z14g2000cwz.googlegroups.com> X-ML-Name: ruby-talk X-Mail-Count: 78 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: G2/0.2 X-Original-To: ruby-talk@ruby-lang.org Path: noris.net!news.n-ix.net!news.bawue.net!news.visyn.net!news-fra1.dfn.de!news.tele.dk!feed118.news.tele.dk!postnews.google.com!g44g2000cwa.googlegroups.com!not-for-mail Newsgroups: comp.lang.ruby Organization: http://groups.google.com NNTP-Posting-Host: 217.206.116.210 X-Trace: posting.google.com 1134668299 22474 127.0.0.1 (15 Dec 2005 17:38:19 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 15 Dec 2005 17:38:19 +0000 (UTC) X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: g44g2000cwa.googlegroups.com; posting-host=217.206.116.210; posting-account=adTdjQwAAADKqKsPV5nvjlhw90gy8QGa X-From-Usenet: see Received: header above. X-rubymirror: yes 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=-5.7 required=7.0 tests=BAYES_00, CONTENT_TYPE_PRESENT,MSGID_FROM_MTA_HEADER,NO_REAL_NAME,QENCPTR1, RCVDFRMLOCALIP autolearn=no version=3.0.3 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Precedence: bulk Lines: 50 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 Amazing!. Couldn't be more than 10 mins since I posted and 3 replies!. Thanks very much.... In that time, before I saw these posts, I came up with the following def foo(p) p.call(100) end a = Proc.new {|b| puts b} foo(a) but now I see that presumably proc (in lowercase) is presumably a static class method and will work equally well. i.e as you say a = proc {|b| puts b} Oddly, there is an inconsistency here q = String("abc") q = String.new("abc") are both legal but q = string("abc") is not, which you would extrapolate by extension from the Proc/proc analogy. (because a=Proc {....} is not legal. In fact, perusing the documentation, I can't see how I would have figured out the alternative mechanism using proc in lowercase - where is this documented? why I am keen to understand this is because languages like Perl are infuriating because things like filehandles have special 'magic' properties which get lost if you, for example, try to store them in a hash, etc. This sort of thing destroys the illusion of completeness that a truly great scripting language must provide, IMHO. I see some hints of LISP here, too, with lambda!. A wonderful brew of language features!