From: Robert Dober on
On Tue, May 4, 2010 at 11:55 AM, Justin Collins <justincollins(a)ucla.edu> wrote:
<snip>
It is legal in 1.9 and illegal in 1.8
HTH
R.

From: Brian Candler on
Ruby Knight wrote:
> Hello, i need some help here, when i run the following code i get the
> error below. Why is that, according to the textbook it should work, also
> looked it up in the cookbook, no luck there too. Thanks in advance.
>
> def split_apart(first, *splat, last)

What Robert is saying is that is valid syntax for ruby 1.9, but not for
ruby 1.8.

I don't know what "the textbook" and "the cookbook" are that you refer
to, but they were probably written for 1.9.

ruby 1.9 is a substantially different language to ruby 1.8, which you
probably wouldn't expect from the "minor" version bump.
--
Posted via http://www.ruby-forum.com/.

From: David A. Black on
Hi --

On Tue, 4 May 2010, Robert Dober wrote:

> On Tue, May 4, 2010 at 11:55 AM, Justin Collins <justincollins(a)ucla.edu> wrote:
> <snip>
> It is legal in 1.9 and illegal in 1.8

Ditto in arrays as well as parameter lists. (Kind of interesting that
1.8.7 also gives the useless literal error.)

$ ruby -ve '[1,2,*[3,4],5]'
ruby 1.8.7 (2008-05-31 patchlevel 0) [i686-darwin9.8.0]
-e:1: syntax error, unexpected ',', expecting ']'
[1,2,*[3,4],5]
^
-e:1: warning: useless use of a literal in void context

$ ruby191 -ve 'p [1,2,*[3,4],5]'
ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-darwin9.8.0]
[1, 2, 3, 4, 5]


David

--
David A. Black, Senior Developer, Cyrus Innovation Inc.

THE Ruby training with Black/Brown/McAnally
COMPLEAT Coming to Chicago area, June 18-19, 2010!
RUBYIST http://www.compleatrubyist.com

From: Ruby Knight on
Thanks guys for all the input as well as the timely responses! I have to
upgrade my Ruby version then, i thought i had the latest version
installed but seems not.

Regards


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

From: Justin Collins on
Robert Dober wrote:
> On Tue, May 4, 2010 at 11:55 AM, Justin Collins <justincollins(a)ucla.edu> wrote:
> <snip>
> It is legal in 1.9 and illegal in 1.8
> HTH
> R.
>
>
Hmmm...noted.

-Justin