This is a multi-part message in MIME format.
--------------010903050909010005050909
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Em 17-12-2011 09:53, Andrew Grimm escreveu:
> On Sat, Dec 17, 2011 at 6:42 AM, Sylvain Daubert
> <sylvain.daubert / laposte.net>  wrote:
>> Hi,
>>
>> Le 15/12/2011 17:58, Rodrigo Rosenfeld Rosas a ñÄrit :
>>
>>> Since Ruby is built on top of simple concepts, most of the documentation
>>> can be read in the Core API and Standard Library API pages.
>>>
>>> Unfortunately, I don't see to find any official reference (besides
>>> mentions to books) about the language syntax itself.
>>>
>> I agree with that. I think Ruby should have official documentation such as
>> (at least) a tutorial.
>>
>> I don't have enough knowledge about Ruby to start such a project, but I'm
>> ready to help (proofreading, writing examples, etc.)
>>
>> Sylvain
>>
> There's a description of keywords at
> http://ruby-doc.org/docs/keywords/1.9/ (you have to click on the
> keyword to get a description, though).
>
> Originally I thought this was part of Ruby itself, but
> http://ruby-doc.org/docs/ lists it as an additional document.
>

Great! I didn't know about this. But the information about return 
doesn't seem to be accurate:

"Inside a code block, the behavior ofreturndepends on whether or not the 
block constitutes the body of a regular Proc object or a lambda-style 
Proc object. In the case of a lambda, returncauses execution of the 
block to terminate. *In the case of a regular Proc,**return**attempts to 
return from the enclosing method. If there is no enclosing method, it's 
an error.*"

What is the meaning of "enclosing" in this context?

def method_name(proc_argument)
     proc_argument[] # contains a return
end

My understanding is that the enclosing method of the proc call is 
"method_name". Even if you say the the definition for "enclosing method" 
is the one that defined the proc, it still exists, so the snippet "If 
there is no enclosing method, it's an error." also doesn't reflect the 
situation.

The definition of return for procs should be clearer IMO in the docs 
above, don't you agree?

Cheers,

Rodrigo.


--------------010903050909010005050909
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta contentext/html; charsetO-8859-1"
      http-equiv
ontent-Type"> </head> <body bgcolorffffff" text000000"> Em 17-12-2011 09:53, Andrew Grimm escreveu: <blockquote citeid:CAKcdLKqMDFC2i6HSWruBqSkPF-VXkwLFWws002NpH9vRBw / mail.gmail.com" type
ite"> <pre wrap>On Sat, Dec 17, 2011 at 6:42 AM, Sylvain Daubert <a classoz-txt-link-rfc2396E" hrefailto:sylvain.daubert / laposte.net">&lt;sylvain.daubert / laposte.net&gt;</a> wrote: </pre> <blockquote type
ite"> <pre wrap>Hi, Le 15/12/2011 17:58, Rodrigo Rosenfeld Rosas a &eacute;crit : </pre> <blockquote type
ite"> <pre wrap>Since Ruby is built on top of simple concepts, most of the documentation can be read in the Core API and Standard Library API pages. Unfortunately, I don't see to find any official reference (besides mentions to books) about the language syntax itself. </pre> </blockquote> <pre wrap> I agree with that. I think Ruby should have official documentation such as (at least) a tutorial. I don't have enough knowledge about Ruby to start such a project, but I'm ready to help (proofreading, writing examples, etc.) Sylvain </pre> </blockquote> <pre wrap> There's a description of keywords at <a classoz-txt-link-freetext" hrefttp://ruby-doc.org/docs/keywords/1.9/">http://ruby-doc.org/docs/keywords/1.9/</a> (you have to click on the keyword to get a description, though). Originally I thought this was part of Ruby itself, but <a classoz-txt-link-freetext" hrefttp://ruby-doc.org/docs/">http://ruby-doc.org/docs/</a> lists it as an additional document. </pre> </blockquote> <br> Great! I didn't know about this. But the information about return doesn't seem to be accurate:<br> <br> "<span style
olor: rgb(0, 0, 0); font-family: 'Helvetica Neue',Helvetica,Tahoma,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: rgb(238, 238, 238); display: inline ! important; float: none;">Inside a code block, the behavior of<span class pple-converted-space">&nbsp;</span></span><tt styleadding: 0px; margin: 0px; color: rgb(0, 0, 0); font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: rgb(238, 238, 238);">return</tt><span style
olor: rgb(0, 0, 0); font-family: 'Helvetica Neue',Helvetica,Tahoma,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: rgb(238, 238, 238); display: inline ! important; float: none;"><span class pple-converted-space">&nbsp;</span>depends on whether or not the block constitutes the body of a regular Proc object or a lambda-style Proc object. In the case of a lambda, </span><tt styleadding: 0px; margin: 0px; color: rgb(0, 0, 0); font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: rgb(238, 238, 238);">return</tt><span style
olor: rgb(0, 0, 0); font-family: 'Helvetica Neue',Helvetica,Tahoma,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: rgb(238, 238, 238); display: inline ! important; float: none;"><span class pple-converted-space">&nbsp;</span>causes execution of the block to terminate. <b>In the case of a regular Proc,<span class pple-converted-space">&nbsp;</span></b></span><b><tt styleadding: 0px; margin: 0px; color: rgb(0, 0, 0); font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: rgb(238, 238, 238);">return</tt></b><span style
olor: rgb(0, 0, 0); font-family: 'Helvetica Neue',Helvetica,Tahoma,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: rgb(238, 238, 238); display: inline ! important; float: none;"><b> attempts to return from the enclosing method. If there is no enclosing method, it&#8217;s an error.</b>"<br> </span><br> What is the meaning of "enclosing" in this context?<br> <br> def method_name(proc_argument)<br> &nbsp;&nbsp;&nbsp; proc_argument[] # contains a return<br> end<br> <br> My understanding is that the enclosing method of the proc call is "method_name". Even if you say the the definition for "enclosing method" is the one that defined the proc, it still exists, so the snippet "If there is no enclosing method, it's an error." also doesn't reflect the situation.<br> <br> The definition of return for procs should be clearer IMO in the docs above, don't you agree?<br> <br> Cheers,<br> <br> Rodrigo.<br> <br> </body> </html> --------------010903050909010005050909--