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
infix:<eqv> is not dynamic enough #4516
Comments
From @dakkarGiven this code:: { multi sub infix:<eqv>(Foo $a, Foo $b) { multi sub infix:<eqv>(Foo $a, Foo $b) { my @a = Foo.new(:x(1)); say @a[0] eqv @b[0]; the output is:: will get called because: - the first ``eqv`` definition is not visible to any of the calls This means that: - ``eqv``s defined in other packages are never used Should there be some mechanism like ``ACCEPTS`` to make ``eqv`` more Should there be a mechanism to add ``multi`` candidates dynamically? You have only to mumble a few words in church to get married and few |
From @jnthnOn Sat Sep 05 07:47:24 2015, dakkar wrote:
This is correct; multis are lexically scoped.
Typically you'll be writing such types in a module; adding "is export" to the eqv multi candidates you declare will export them, and then they'll be available to anyone importing your type. And if you're in a single file, you can still write them inside of a package and then "import" that package to get them into scope.
No, given then you'd be able to apply this argument to every other operator in the language you might consider overloading.
We have to know the list of multi-candidates at CHECK time; since export/import happen at BEGIN time, then that's enough "static dynamism" for this case. Hope this helps, /jnthn |
The RT System itself - Status changed from 'new' to 'open' |
@jnthn - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#126000 (status was 'rejected')
Searchable as RT126000$
The text was updated successfully, but these errors were encountered: