-
-
Save anonymous/82e9f1fc92de6e4e40ff463612e10e69 to your computer and use it in GitHub Desktop.
obj equi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl6 | |
class Foo { | |
has Str $.a; | |
has Int $.b; | |
method eq(Foo $other){ | |
my Bool $flag = True; | |
for self.^attributes { | |
do { $flag = False; last; } unless ( $_.get_value(self).Str eq $_.get_value($other).Str ); | |
} | |
return $flag; | |
} | |
} | |
say Foo.new(:a(<foo>), b => 100).eq(Foo.new(:a(<foo>), b => 100)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment