From: sur max Date: 2007-02-16T16:11:19+09:00 Subject: Re: is it behaving strange ? ------=_Part_808_18681744.1171609876001 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline definitely, it seems so natural using =3D *a,b and this gives the feel of ruby. isn't it ? On 2/16/07, Robert Dober wrote: > > On 2/16/07, Pe=F1a, Botp wrote: > > fr: sur max [mailto:sur.max@gmail.com] : > > # b =3D [*a,6] # =3D> [9,5,6] ----- false, compile error > > # b =3D *a,6 # =3D> [9,5,6] ----- false, compile error > > > > pls be careful. "*" op will splat. so here ruby is just telling/policin= g > you not too. > > > > I always treat splat op as a black hole. this way i make less mistakes. > > > > eg > > > > so this is allowed, > > > > irb(main):050:0> b,*a=3D1,2,3,4 > > =3D> [1, 2, 3, 4] > > irb(main):052:0> a > > =3D> [2, 3, 4] > > > > this one is not, > > > > irb(main):053:0> b,*a,c=3D1,2,3,4 > > SyntaxError: compile error > > (irb):53: syntax error, unexpected ',', expecting '=3D' b,*a,c=3D1,2,3,= 4 > > irb(main):054:0> > > > > ruby, is telling me that "*a" is a blackhole. The c does "not matter". > Botp > > this is a very nice analogy, however it does only hold for the LHS > i.e. assignment target and formal parameter lists. > On the LHS a splatted expression is an *infinite* consumer a blackhole ;) > On the RHS a splatted expression is a *finite* producer though. > I see no reason why ..., *a, ... should be forbidden on the RHS. > to ... =3D *(a + [b]) > I'd prefer > ... =3D *a, b > > Side note to David: > after a night of consideration I do not believe that there any > syntactical problems > the splat operator already being allowed in front of parenthesis. > > > > so is this one, > > > > irb(main):056:0> *a > > SyntaxError: compile error > > (irb):56: syntax error, unexpected '\n', expecting '=3D' > > > > that's a blackhole without a hole or opening. feed it :) > as mentioned above we are in the producer case here > > again, another stupid blackhole reasoning. > I would not go that far ;) > > > > nonetheless, splat is a very sweet yet too powerful operator. > I feel that splat op digress oo-ness. But i believe it's not oo for > oo's sake. It's solving problems and discovering brilliant solutions. > Ruby does it w ease and fun. Sometimes, i feel ruby will trend toward > object and method unification, wherein objects can be methods and vice > versa. arggh, like matter <=3D=3D> energy. maybe, a superproc or > superlamdba in the future... i'll stop now :) > You might have a point though ;) > > > > drive w caution, (black)holes ahead. > > > > sorry for the long post fr a nuby. > > kind regards -botp > > > > > Cheers > Robert > > -- > We have not succeeded in answering all of our questions. > In fact, in some ways, we are more confused than ever. > But we feel we are confused on a higher level and about more important > things. > -Anonymous > > --=20 sur http://expressica.com ------=_Part_808_18681744.1171609876001--