Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sub hash() and improve Parcel.hash #2094

Closed
p6rt opened this issue Aug 24, 2010 · 5 comments
Closed

Fix sub hash() and improve Parcel.hash #2094

p6rt opened this issue Aug 24, 2010 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 24, 2010

Migrated from rt.perl.org#77412 (status was 'rejected')

Searchable as RT77412$

@p6rt
Copy link
Author

p6rt commented Aug 24, 2010

From @Timbus

This is just a followup fix to ticket #​75584 that pmichaud was going to do
but probably forgot about. Previously Parcel's hash method was delegating to
sub hash (which is backwards). I flipped it around to fix it.

@p6rt
Copy link
Author

p6rt commented Aug 24, 2010

From @Timbus

0001-Make-sub-hash-call-the-.hash-method-on-its-arguments.patch
From 3c7766f14759919d0a2bb6ce4c4ab35c34ec0ead Mon Sep 17 00:00:00 2001
From: Jarrod <gigantic.midget@gmail.com>
Date: Tue, 24 Aug 2010 20:41:40 +1000
Subject: [PATCH] Make sub hash() call the .hash method on its arguments, and change Parcel to implement its own .hash method

---
 src/builtins/Parcel.pir |    9 ---------
 src/core/Parcel.pm      |    4 ++++
 src/core/operators.pm   |    3 +--
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/builtins/Parcel.pir b/src/builtins/Parcel.pir
index e0e9710..6fb697a 100644
--- a/src/builtins/Parcel.pir
+++ b/src/builtins/Parcel.pir
@@ -46,15 +46,6 @@ A Parcel in item context becomes a Seq.
 .end
 
 
-=item hash()
-
-=cut
-
-.sub 'hash' :method
-    .tailcall '&hash'(self)
-.end
-
-
 =item iterator()
 
 Construct an iterator for the Parcel.
diff --git a/src/core/Parcel.pm b/src/core/Parcel.pm
index c96e94b..b1b5e03 100644
--- a/src/core/Parcel.pm
+++ b/src/core/Parcel.pm
@@ -13,4 +13,8 @@ augment class Parcel does Positional {
             ?? $x.notdef || ($x ~~ Positional && $x == 0)
             !! self.Seq.ACCEPTS($x)
     }
+
+    method hash() {
+        my %h = self.list;
+    }
 }
diff --git a/src/core/operators.pm b/src/core/operators.pm
index c8d8915..5e21f2a 100644
--- a/src/core/operators.pm
+++ b/src/core/operators.pm
@@ -205,8 +205,7 @@ our sub circumfix:<{ }>(*@elements) {
 }
 
 our sub hash(*@list, *%hash) {
-    my %h = (@list, %hash);
-    %h
+    %(@list, %hash);
 }
 
 our multi infix:sym<//>(Mu $a, Mu $b) {
-- 
1.7.0.4

@p6rt
Copy link
Author

p6rt commented Oct 8, 2011

From @coke

On Tue Aug 24 05​:26​:24 2010, TiMBuS wrote​:

This is just a followup fix to ticket #​75584 that pmichaud was going
to do
but probably forgot about. Previously Parcel's hash method was
delegating to
sub hash (which is backwards). I flipped it around to fix it.

Whoops! we seem to have missed this patch, and the repository has
changed enough that files in the patch are now gone.

If you feel this still needs patching, please throw us another one, and
ping me on IRC if it doesn't get applied or commented on in a day.

Sorry, and thanks for trying to make rakudo better.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Oct 8, 2011

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 8, 2011

@coke - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Oct 8, 2011
@p6rt p6rt added the patch label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant