Replies: 5 comments 9 replies
-
@happy-barney, correct me if I'm wrong, but this may be what you were describing when you said:
at https://www.nntp.perl.org/group/perl.perl5.porters/2023/05/msg266478.html. |
Beta Was this translation helpful? Give feedback.
-
CC: @kfly8, @ybrliiu as they have done many interesting things here with tracking the |
Beta Was this translation helpful? Give feedback.
-
The current RFC 0022 for metaprogramming does not address this per Perl/PPCs#25 (comment). |
Beta Was this translation helpful? Give feedback.
-
This will also be needed for multimethods. |
Beta Was this translation helpful? Give feedback.
-
I also wonder how this would work with signature of something like sub around(
METHOD_NAME $method_name, # * Str that matches a valid method name
# (maybe check the package stash too?)
CODEREF[ [
coderef_check_with_signature_of($method_name), # * This is another CODEREF
parameters_of($method_name) # * Flattens all the checks
] => Any ] ) { # * `around` allows return type to change
# (though that would be bad design)
...
} or if this should be part of a DbC-style precondition? |
Beta Was this translation helpful? Give feedback.
-
In addition to making the checks themselves be first class as brought up in https://github.com/orgs/Perl-Oshun/discussions/6, this information should also be available at runtime for introspection via the MOP.
This has some precedent on CPAN:
It also would allow for a kind of check that is not yet defined in the spec
which is to check
CODE
parameters and return:And would allow for some decoupling in the implementation of Design by Contract https://github.com/orgs/Perl-Oshun/discussions/41 (any kind of verifier could be used by the user).
Keywords: MOP, meta, metadata, introspection, coderef
Beta Was this translation helpful? Give feedback.
All reactions