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


Groups > comp.lang.ruby > #3706

Re: calling methods, beginner help

From Brian Candler <b.candler@pobox.com>
Newsgroups comp.lang.ruby
Subject Re: calling methods, beginner help
Date 2011-04-29 13:19 -0500
Organization Service de news de lacave.net
Message-ID <bfdfa23b1836c337e45d26cf02457fdb@ruby-forum.com> (permalink)
References <626238bd776ed0898a473c7a16e02fb5@ruby-forum.com> <5aa298eaa7c92eb99aeadefbca7a9cc6@ruby-forum.com> <efd4233bb963bf4f26a8d05e360e6858@ruby-forum.com> <6680776a9ca2187c2ac75ee95d5b5b2f@ruby-forum.com>

Show all headers | View raw


Ronnie Aa wrote in post #995728:
> With procedures I mean this:
>
> http://www.ruby-doc.org/core/classes/Proc.html.
>
> 'Proc' is a abbreviation of procedure isn't it?

No, it's a Proc :-) A Proc object can either be a block crystallised 
into an object, or a lambda. It carries the semantics of either.

$ irb --simple-prompt
>> def foo(&blk); blk; end
=> nil
>> foo { puts "hello" }
=> #<Proc:0x00007fdbc6eceba0@(irb):2>

>> lambda { puts "hello" }
=> #<Proc:0x00007fdbc6ec4f10@(irb):3>

You probably don't want to concern yourself with the differences, but 
the gory details are here:
http://innig.net/software/ruby/closures-in-ruby.rb

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

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


Thread

calling methods, beginner help Ronnie Aa <liquid98@gmail.com> - 2011-04-28 12:06 -0500
  Re: calling methods, beginner help Markus Schirp <mbj@seonic.net> - 2011-04-28 12:14 -0500
  Re: calling methods, beginner help 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-28 12:23 -0500
  Re: calling methods, beginner help Ronnie Aa <liquid98@gmail.com> - 2011-04-28 12:44 -0500
    Re: calling methods, beginner help Markus Schirp <mbj@seonic.net> - 2011-04-28 13:03 -0500
    Re: calling methods, beginner help 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-28 13:03 -0500
    Re: calling methods, beginner help Brian Candler <b.candler@pobox.com> - 2011-04-28 15:29 -0500
  Re: calling methods, beginner help Ronnie Aa <liquid98@gmail.com> - 2011-04-28 13:40 -0500
  Re: calling methods, beginner help Ronnie Aa <liquid98@gmail.com> - 2011-04-28 16:05 -0500
    Re: calling methods, beginner help Brian Candler <b.candler@pobox.com> - 2011-04-29 03:02 -0500
      Re: calling methods, beginner help Ronnie Aa <liquid98@gmail.com> - 2011-04-29 04:27 -0500
        Re: calling methods, beginner help Brian Candler <b.candler@pobox.com> - 2011-04-29 13:19 -0500
        Re: calling methods, beginner help Stu <stu@rubyprogrammer.net> - 2011-04-29 15:24 -0500

csiph-web