From ko1 at atdot.net Thu Sep 15 15:54:33 2005 From: ko1 at atdot.net (SASADA Koichi) Date: Fri, 16 Sep 2005 04:54:33 +0900 Subject: [Yarv-devel] New massign tests In-Reply-To: References: Message-ID: <4329D179.7060302@atdot.net> Hi, George Marrows wrote: > The results of some more ByteCodeRuby test mining - 6 new tests for > massign, a couple of them pretty obscure. 3 pass, 3 fail - the failures > have separate test methods. Thanks. Most problems were fixed. > + def test_massign_value > + # Value of this massign statement should be [1, 2, 3] > + ae %q{ > + a, b, c = [1, 2, 3] > + } > + end Should massign syntax return array? This behaviour is high runtime cost and we use these syntax at only few cases. -- SASADA Koichi at atdot dot net From george.marrows at ntlworld.com Thu Sep 15 17:52:09 2005 From: george.marrows at ntlworld.com (George Marrows) Date: Thu, 15 Sep 2005 22:52:09 +0100 Subject: [Yarv-devel] New massign tests In-Reply-To: <4329D179.7060302@atdot.net> References: <4329D179.7060302@atdot.net> Message-ID: >> + def test_massign_value >> + # Value of this massign statement should be [1, 2, 3] >> + ae %q{ >> + a, b, c = [1, 2, 3] >> + } >> + end >> > > Should massign syntax return array? This behaviour is high runtime > cost and we use these syntax at only few cases. I agree with you that it's not likely to be used very much. However it is current Ruby behaviour, so you have to ask yourself if you want to exactly match Ruby or not. One place it might get used, perhaps even accidentally, is at the end of a method, where the array result of a final massign will be the result of the method. -- George From matz at ruby-lang.org Thu Sep 15 19:26:12 2005 From: matz at ruby-lang.org (Yukihiro Matsumoto) Date: Fri, 16 Sep 2005 08:26:12 +0900 Subject: [Yarv-devel] New massign tests In-Reply-To: Message-ID: <1126826772.049110.12426.nullmailer@x31.priv.netlab.jp> Hi, In message "Re: [Yarv-devel] New massign tests" on Thu, 15 Sep 2005 22:52:09 +0100, George Marrows writes: |I agree with you that it's not likely to be used very much. However |it is current Ruby behaviour, so you have to ask yourself if you want |to exactly match Ruby or not. One place it might get used, perhaps |even accidentally, is at the end of a method, where the array result |of a final massign will be the result of the method. But since he is developing YARV as Ruby2, he can ask _me_ to change the Ruby behavior. matz. From florgro at gmail.com Thu Sep 22 21:43:41 2005 From: florgro at gmail.com (=?ISO-8859-1?Q?Florian_Gro=DF?=) Date: Fri, 23 Sep 2005 03:43:41 +0200 Subject: [Yarv-devel] New massign tests In-Reply-To: <4329D179.7060302@atdot.net> References: <4329D179.7060302@atdot.net> Message-ID: SASADA Koichi wrote: > Should massign syntax return array? This behaviour is high runtime cost > and we use these syntax at only few cases. Hm, can you detect when it is done in a void context? (Similar to ruby -we "1".) I would imagine it would keep the run-time cost low in most cases -- it would only cause less performance if the return value is potentially significant. (Like when a massign is the last statement of a method.) Sorry if it is not as simple as that.