Open shadowcat-mst opened 4 years ago
This might be possible via the MOP. I cannot say, but maybe @leonerd can?
Unless this is trivial, I'm marking this as Post-MVP.
There's plenty of MOP thoughts already, in https://metacpan.org/pod/Object::Pad::MOP::Class and the related ::Slot and ::Method.
Leaving this open because I suspect it will be relevant to @leonerd's work on the MOP.
Closed by accident,
I mean, logically, I guess I can eval up an entire class in a BEGIN block or something ... but it'd be nice to be able to generate two or three methods dynamically all the same.
Ideally, I'd be able to do 'method $name (...) { ... }' but 'name = method (...) { ... }' or some similar syntax would also be fine, I just want some way to be able to generate two or three methods in a foreach loop or similar (and I'd like* to be able to do it for attributes as well, ideally).
If we want to be able to close the class at the end of the 'class { ... }' block I have no issue with having to do whatever I'm doing in a 'BEGIN { ... }' block inside the class block ... but I really do need some way to do that.