Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #3246

Re: anonymous closures with Proc,new, lambda and ->

From Brian Candler <b.candler@pobox.com>
Newsgroups comp.lang.ruby
Subject Re: anonymous closures with Proc,new, lambda and ->
Date 2011-04-20 10:18 -0500
Organization Service de news de lacave.net
Message-ID <9b174c2306ccb671f0cdd13f433067f9@ruby-forum.com> (permalink)
References <BANLkTimdp71nhRkF5GiOxsQ-gtP4wkwE9w@mail.gmail.com> <03b15245deb79f0148cf821c34a7ed41@ruby-forum.com> <ae38c1271ac391d8aad35ef2cc946cda@ruby-forum.com> <BANLkTimUF7wuGnis4endTjSQgW7TOnpJ+w@mail.gmail.com> <F3D54DF8-5D84-4B3F-9EFF-BE6D36319697@carboni.ca>

Show all headers | View raw


Michael Edgar wrote in post #993817:
> Proc
> doesn't implement #initialize, so it bubbles up to Object#initialize.
> Since Object#initialize just takes any number of arguments and ignores
> them, providing an argument to Proc.new doesn't raise.

So I think the question becomes: why does Object#initialize accept any 
number of arguments in 1.9? It doesn't in 1.8.

$ ruby -ve 'Object.new(1,2,3)'
ruby 1.8.7 (2010-06-23 patchlevel 299) [x86_64-linux]
-e:1:in `initialize': wrong number of arguments (3 for 0) 
(ArgumentError)
  from -e:1:in `new'
  from -e:1
$ ruby192 -ve 'Object.new(1,2,3)'
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]
$

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

anonymous closures with Proc,new, lambda and -> Stu <stu@rubyprogrammer.net> - 2011-04-19 01:07 -0500
  Re: anonymous closures with Proc,new, lambda and -> Robert Klemme <shortcutter@googlemail.com> - 2011-04-19 02:30 -0500
  Re: anonymous closures with Proc,new, lambda and -> Brian Candler <b.candler@pobox.com> - 2011-04-19 03:05 -0500
    Re: anonymous closures with Proc,new, lambda and -> Brian Candler <b.candler@pobox.com> - 2011-04-19 03:15 -0500
      Re: anonymous closures with Proc,new, lambda and -> Stu <stu@rubyprogrammer.net> - 2011-04-19 04:57 -0500
        Re: anonymous closures with Proc,new, lambda and -> Brian Candler <b.candler@pobox.com> - 2011-04-19 07:24 -0500
          Re: anonymous closures with Proc,new, lambda and -> Adam Prescott <adam@aprescott.com> - 2011-04-19 14:55 -0500
      Re: anonymous closures with Proc,new, lambda and -> Stu <stu@rubyprogrammer.net> - 2011-04-19 16:43 -0500
        Re: anonymous closures with Proc,new, lambda and -> 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-19 18:48 -0500
        Re: anonymous closures with Proc,new, lambda and -> 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-19 21:28 -0500
          Re: anonymous closures with Proc,new, lambda and -> Stu <stu@rubyprogrammer.net> - 2011-04-20 01:03 -0500
            Re: anonymous closures with Proc,new, lambda and -> Robert Klemme <shortcutter@googlemail.com> - 2011-04-20 02:23 -0500
              Re: anonymous closures with Proc,new, lambda and -> Steve Klabnik <steve@steveklabnik.com> - 2011-04-20 05:55 -0500
            Re: anonymous closures with Proc,new, lambda and -> 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-20 12:32 -0500
              Re: anonymous closures with Proc,new, lambda and -> Steve Klabnik <steve@steveklabnik.com> - 2011-04-20 12:59 -0500
                Re: anonymous closures with Proc,new, lambda and -> Brian Candler <b.candler@pobox.com> - 2011-04-20 15:40 -0500
                Re: anonymous closures with Proc,new, lambda and -> 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-20 19:51 -0500
                Re: anonymous closures with Proc,new, lambda and -> Stu <stu@rubyprogrammer.net> - 2011-04-21 01:31 -0500
                Re: anonymous closures with Proc,new, lambda and -> Brian Candler <b.candler@pobox.com> - 2011-04-21 04:34 -0500
                Re: anonymous closures with Proc,new, lambda and -> Robert Klemme <shortcutter@googlemail.com> - 2011-04-21 06:13 -0500
                Re: anonymous closures with Proc,new, lambda and -> Robert Klemme <shortcutter@googlemail.com> - 2011-04-21 09:20 -0500
                Re: anonymous closures with Proc,new, lambda and -> 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-21 11:56 -0500
                Re: anonymous closures with Proc,new, lambda and -> Steve Klabnik <steve@steveklabnik.com> - 2011-04-21 12:06 -0500
                Re: anonymous closures with Proc,new, lambda and -> Robert Klemme <shortcutter@googlemail.com> - 2011-04-27 06:49 -0500
                Re: anonymous closures with Proc,new, lambda and -> Stu <stu@rubyprogrammer.net> - 2011-04-27 13:33 -0500
                Re: anonymous closures with Proc,new, lambda and -> Steve Klabnik <steve@steveklabnik.com> - 2011-04-27 17:06 -0500
  Re: anonymous closures with Proc,new, lambda and -> 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-19 13:02 -0500
    Re: anonymous closures with Proc,new, lambda and -> Brian Candler <b.candler@pobox.com> - 2011-04-19 13:19 -0500
      Re: anonymous closures with Proc,new, lambda and -> Steve Klabnik <steve@steveklabnik.com> - 2011-04-19 13:26 -0500
        Re: anonymous closures with Proc,new, lambda and -> Michael Edgar <adgar@carboni.ca> - 2011-04-19 13:51 -0500
          Re: anonymous closures with Proc,new, lambda and -> Brian Candler <b.candler@pobox.com> - 2011-04-20 10:18 -0500
            Re: anonymous closures with Proc,new, lambda and -> Jeremy Bopp <jeremy@bopp.net> - 2011-04-20 12:44 -0500

csiph-web