hurricup has asked for the wisdom of the Perl Monks concerning the following question:
Hello Perl coders!
Got a problem and possible solution, need a feedback from community.
As you may know, I'm currently working on Perl5 plugin for Intellij IDEA, and work is going fine, it works and can do a lot of useful things. But i've encountered a problem.
In order to link sub usage and it's definition or declaration, i need to know, in which namespace to look. And it's not a problem when you are using obvious calls:
somesub(); # just looking current namespace Foo::Bar::somesub(); # obviously, looking in Foo::Bar # and now you can even do this: my Foo::Bar $object; $object->somesub(); # will understand that it's a Foo::Bar's sub
But, what to do when it's used like:
Foo::Bar->new()->some_geter()->somethingelse();
Of course, it's possible to constantly work on smart algorythms, which will be able to analyse previous sub in "dereference" chain and try to guess, what was returned.
But it's an endless work as a Perl itself and resourse-consuming.
I belive that the best way here is to introduce a Java-like annotations:
#@Returns Foo::Bar sub somefunc{ ... }
Here, IDE parser can easily find out, that somefunc returns Foo::Bar object. And from the Perl's perspective, it's still just a comment.
Currently thinking about following annotations:
There are lot of useful IDE hints could be, like #@defined, #@undefinable and so on, but these above i really need.
I thought about using attributes, but not sure it's such good idea, and, btw, it would be easy to convert such form of annotations to another one if Perl devs introduce something useful for this.
Really need a feedback and ideas.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Annotations for Perl
by choroba (Cardinal) on Jun 02, 2015 at 16:59 UTC | |
by hurricup (Pilgrim) on Jun 02, 2015 at 17:19 UTC | |
by Anonymous Monk on Jun 02, 2015 at 22:53 UTC | |
by hurricup (Pilgrim) on Jun 03, 2015 at 05:42 UTC | |
|
Re: Annotations for Perl
by RonW (Parson) on Jun 02, 2015 at 18:14 UTC | |
by hurricup (Pilgrim) on Jun 03, 2015 at 05:47 UTC | |
by RonW (Parson) on Jun 03, 2015 at 15:46 UTC | |
|
Re: Annotations for Perl
by fishmonger (Chaplain) on Jun 02, 2015 at 16:32 UTC | |
by hurricup (Pilgrim) on Jun 02, 2015 at 16:38 UTC | |
by Anonymous Monk on Jun 02, 2015 at 16:54 UTC | |
by hurricup (Pilgrim) on Jun 02, 2015 at 17:31 UTC | |
by Anonymous Monk on Jun 02, 2015 at 23:56 UTC | |
| |
by Anonymous Monk on Jun 02, 2015 at 22:21 UTC | |
|
Re: Annotations for Perl
by LanX (Saint) on Jun 06, 2015 at 12:33 UTC | |
|
Re: Annotations for Perl
by Anonymous Monk on Jun 02, 2015 at 22:52 UTC | |
by hurricup (Pilgrim) on Jun 03, 2015 at 05:46 UTC | |
by Anonymous Monk on Jun 03, 2015 at 08:08 UTC | |
by hurricup (Pilgrim) on Jun 03, 2015 at 08:47 UTC | |
|
Re: Annotations for Perl
by Anonymous Monk on Jun 02, 2015 at 22:11 UTC | |
by hurricup (Pilgrim) on Jun 03, 2015 at 05:48 UTC | |
by RonW (Parson) on Jun 03, 2015 at 16:28 UTC | |
by Anonymous Monk on Jun 03, 2015 at 07:53 UTC | |
|
Re: Annotations for Perl
by hurricup (Pilgrim) on Jun 03, 2015 at 13:35 UTC | |
|
Re: Annotations for Perl
by LanX (Saint) on Jun 06, 2015 at 04:12 UTC |