Comments (8)
Hmmmm ... I think this would be tricky. MSM hooks into the MXD parser and uses it to trigger when to fire. Without MXD, your
around foo (Int $bar) { }
typically becomes
around 'foo' => sub { }
Now, you could certainly do something like:
around 'foo' => method (Int $foo) { }
except that now MS has absolutely no clue that it needs to deal with $orig
. So we'd have to make MSM understand how to parse around
outside of MXD ... but then of course it has no way to enforce that you don't do an around
outside of any class, and--even worse--it doesn't have any way to get access to the current class being parsed. Perhaps simply using __PACKAGE__
might work ... ?
It would certainly be non-trivial, and I'm not sure when I'd have the opportunity to look at it, unfortunately.
Dare I ask: why oh why would you remove all that lovely MXD goodness? :-)
from method-signatures.
You know I'm a fan of MXD :-) Still it makes the simulation I'm presenting rather slower than it needs to be and for PAUSE indexing sake it seems the most prudent. Who knows, perhaps I'm just being silly, but I thought I would try. The truth is, this module didn't use too much of the MXD-ness anyway.
As to around, a very evil thing might be
around 'foo' => method ($orig: $self, ... ) { }
hmmmm, that looks yucky!
from method-signatures.
Still it makes the simulation I'm presenting rather slower than it needs to be ...
I'd be very surprised if removing MXD gained you any run-time speed. Compile-time speed I could see, but I don't know that MXD does anything at run-time. And, actually, if you remove the MXD-ness and forget to add all your make_immutable
calls back in, you should see a significant slow-down. ;->
But, hey: try the experiment. I'd be curious to see the profiling results.
... and for PAUSE indexing sake it seems the most prudent.
Not sure I followed that bit.
The truth is, this module didn't use too much of the MXD-ness anyway.
Every single class
statement you use saves you a minimum of two lines of code (the autoclean
and the make_immutable
), not to mention providing a very clear indication of where the class ends (a small thing, but something that makes me absolutely crazy when trying to read "regular" Moose code containing multiple classes). So I think you're getting plenty of MXD goodness no matter what. ;-> But that's just my opinion, obviously. Take it as you will.
As to around, a very evil thing might be
Well, if you're willing to do that, normal old MS should work fine. Although I have to say ...
hmmmm, that looks yucky!
... yeah, that. :-D
from method-signatures.
I'd be very surprised if removing MXD gained you any run-time speed. Compile-time speed I could see, but I don't know that MXD does anything at run-time.
Of course you're right, the actual running time of code I'm running is very quick, so compile-time speed is very noticeable. And I agree, my code looks a lot messier to my eyes too. Perhaps a rollback is in order.
I had forgotten that there is a dzil plugin for indexing MXD correctly, so this shouldn't be a big problem for that; assuming I go back to dzil. (https://github.com/jberger/Physics-RayTransfer/blob/master/dist.ini#L19)
from method-signatures.
Of course you're right, the actual running time of code I'm running is very quick, so compile-time speed is very noticeable.
Well, that's fair comment. I never tried to determine how much MXD added to compile-time. Might be an interesting blog post, if you could figure out a way to profile that.
And I agree, my code looks a lot messier to my eyes too. Perhaps a rollback is in order.
Well, far be it from me to try to tell you how to do your releases, but I can't help but think that the more legibile your code looks, the better that reflects on you as the author. ;->
I had forgotten that there is a dzil plugin for indexing MXD correctly, so this shouldn't be a big problem for that; assuming I go back to dzil. (https://github.com/jberger/Physics-RayTransfer/blob/master/dist.ini#L19)
Ah, yes, I see what you mean now. It's also possible to specify that explicitly, of course, but that dzil plugin is a good call. One day, I plan to collect all those such things and put them in a bundle or Task::
or somesuch to make using MXD much easier. I'll jot this one down for inclusion in that.
from method-signatures.
Joel, are you happy with the answers here? Can I close the issue?
from method-signatures.
While I still think it might be an interesting long-term idea, it isn't a practical one in the short term. Work on something more useful!
from method-signatures.
Understood. Thanx. :)
from method-signatures.
Related Issues (20)
- Allow bare sigils as placeholders HOT 1
- Benchmarks vs 5.20
- Type checks should be done after default is applied. HOT 3
- Line numbers offset when signature has spaces in it HOT 9
- Type checking of defaults
- Multi-line defaults are broken HOT 1
- ($a, $b?, $c) should be a compile error HOT 1
- Type error in earlier Perl versions on Windows
- Anonymous functions which are a key in a hash will get the line number of the hash declaration. HOT 2
- Become a wrapper around Function::Parameters HOT 10
- Change Any::Moose for Moo HOT 4
- Getting "The type is unrecognized" if spaces are added HOT 1
- libmethod-signatures-perl: depends on libdata-alias-perl, broken with Perl 5.24
- support Type::Tiny HOT 33
- Support 'method BUILD' for Moo.* HOT 7
- Data::Alias is still required in 20131010 HOT 3
- t/thread-bug.t crashes on Mac OS X with threading enabled HOT 4
- Deprecate `@_` in favor of `...` HOT 1
- Move to evalEmpire org HOT 4
- Allow attributes between sub name and signature HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from method-signatures.