Skip to content

Commit

Permalink
Give QuantHashes proper .of / keyof methods
Browse files Browse the repository at this point in the history
So that hyper methods may actually properly recognize them.

Note that properly parameterizing Associative gave rise to all sort of weird
errors during the building of the setting.  Which is why the local overrides.
  • Loading branch information
lizmat committed Nov 5, 2018
1 parent 7a85985 commit 8b93ec9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/Baggy.pm6
Expand Up @@ -12,6 +12,8 @@ my role Baggy does QuantHash {
# Immutables aspects of Bag/Mix, need to live to Bag/Mix respectively. # Immutables aspects of Bag/Mix, need to live to Bag/Mix respectively.


#--- interface methods #--- interface methods
method of() { UInt }

multi method ACCEPTS(Baggy:U: \other --> Bool:D) { multi method ACCEPTS(Baggy:U: \other --> Bool:D) {
other.^does(self) other.^does(self)
} }
Expand Down
2 changes: 2 additions & 0 deletions src/core/Mixy.pm6
@@ -1,5 +1,7 @@
my role Mixy does Baggy { my role Mixy does Baggy {


method of() { Real }

multi method hash(Mixy:D: --> Hash:D) { self!HASHIFY(Real) } multi method hash(Mixy:D: --> Hash:D) { self!HASHIFY(Real) }
multi method Hash(Mixy:D: --> Hash:D) { self!HASHIFY(Any) } multi method Hash(Mixy:D: --> Hash:D) { self!HASHIFY(Any) }


Expand Down
2 changes: 2 additions & 0 deletions src/core/QuantHash.pm6
@@ -1,5 +1,7 @@
my role QuantHash does Associative { my role QuantHash does Associative {


method keyof() { Any }

method SET-SELF(QuantHash:D: \elems) { # cannot be a private method method SET-SELF(QuantHash:D: \elems) { # cannot be a private method
nqp::stmts( nqp::stmts(
nqp::if( nqp::if(
Expand Down
2 changes: 2 additions & 0 deletions src/core/Setty.pm6
@@ -1,6 +1,8 @@
my role Setty does QuantHash { my role Setty does QuantHash {
has Rakudo::Internals::IterationSet $!elems; # key.WHICH => key has Rakudo::Internals::IterationSet $!elems; # key.WHICH => key


method of() { Bool }

# helper sub to create Set from iterator, check for laziness # helper sub to create Set from iterator, check for laziness
sub create-from-iterator(\type, \iterator --> Setty:D) { sub create-from-iterator(\type, \iterator --> Setty:D) {
nqp::if( nqp::if(
Expand Down

0 comments on commit 8b93ec9

Please sign in to comment.