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


Groups > comp.lang.ruby > #6559

Re: what's up with return *splat ?

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.ruby
Subject Re: what's up with return *splat ?
Date Tue, 12 Jun 2012 23:19:40 +0200
Lines 34
Message-ID <a3pq3mFm27U1@mid.individual.net> (permalink)
References <0fae13bb-3468-4883-b855-17950bee1117@t2g2000pbl.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net AjRU006eG8JNZb9hqFcRDwt7JkAKyrngJGV8AyCyIHdAu5gUXyP9iWZWh7+kRfgB4=
Cancel-Lock sha1:0j9F61xGIfitEMWMPsTJeVjuEUU=
User-Agent Mozilla/5.0 (Windows NT 6.0; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1
In-Reply-To <0fae13bb-3468-4883-b855-17950bee1117@t2g2000pbl.googlegroups.com>
Xref csiph.com comp.lang.ruby:6559

Show key headers only | View raw


On 12.06.2012 20:48, Phlip wrote:
> Rubies:
>
> Back in the Halcyon days (whatever that means) of Ruby 1.8, a function
> could obey the contract "return nil, a scalar, or an array" with a
> mere splat:
>
>    return * splat
>
> The interpretation there is (roughly!) "splat behaves as if you had
> written each argument in an array as scalars separated by commas."
>
> So (roughly!), you would get one of these three results:
>
>    return nil
>    return scalar
>    return [ scalar1, scalar2, scalar3 ]
>
> Now that I work in Ruby 1.9, the splat don't work like that. It just
> passes through an array.
>
> Am I using it wrong? Did splat change? If so, why? And can I use some
> other 1.9-compliant trick?

Can you please show the code you used for testing?  Thank you.

Kind regards

	robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

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


Thread

what's up with return *splat ? Phlip <phlip2005@gmail.com> - 2012-06-12 11:48 -0700
  Re: what's up with return *splat ? Robert Klemme <shortcutter@googlemail.com> - 2012-06-12 23:19 +0200
    Re: what's up with return *splat ? Phlip <phlip2005@gmail.com> - 2012-06-12 17:10 -0700
      Re: what's up with return *splat ? Robert Klemme <shortcutter@googlemail.com> - 2012-06-16 15:04 +0200
        Re: what's up with return *splat ? Phlip <phlip2005@gmail.com> - 2012-06-21 16:24 -0700
          Re: what's up with return *splat ? Robert Klemme <shortcutter@googlemail.com> - 2012-06-22 18:24 +0200
            Re: what's up with return *splat ? Phlip <phlip2005@gmail.com> - 2012-06-22 10:02 -0700
              Re: what's up with return *splat ? Robert Klemme <shortcutter@googlemail.com> - 2012-06-22 23:36 +0200
                Re: what's up with return *splat ? Phlip <phlip2005@gmail.com> - 2012-06-24 16:27 -0700

csiph-web