Feature Request: Code Assist for arguments

pubgrub wrote on Tue Apr 24 17:34:43 MEST 2007:

Code Assist is presently not working for variables/objects that have been
passed to a function as arguments, i.e.:

sub foo : Local {
	my ( $self, $c) = @_;

I'm presently working on a project which is based on the Catalyst framework,
so I have constructs like the above all the time. As $c in this case is
my Catalyst object, I need to access its methods quite often and it would
be great to be able to use the Code Assist feature for this.

Maybe it would be possible to declare the object in some kind of perldoc
way to tell epic how to handle them.

jploski wrote on Tue Apr 24 19:17:59 MEST 2007:
Dynamic type inference without additional clues would be very difficult
and at times impossible to accomplish. I was also thinking about "perldoc"-like
annotations to solve this problem. In fact, I was thinking javadoc-like,
not perldoc-like because POD is very lax about documentation conventions.

It would be much better to support an IDE-neutral specification convention
for Perl API documentation rather than invent hacks for EPIC. The trouble
is, I am unaware of any such convention (possibly it would go against the
official language philosophy?) There is a doxygen filter for Perl which
goes a step into the right direction (http://www.bigsister.ch/doxygenfilter),
but it doesn't actually define useful conventions for describing types of
parameters or return values (which is disappointing). I also don't think
that the doxygen filter is widely used enough to serve as a "standard".

Another approach (in the hacks for EPIC category) might be configurable
naming conventions (so that you can say that a variable named $dbh always
refers to a DBI object).
pubgrub wrote on Wed Apr 25 00:04:56 MEST 2007:
As I only know two IDEs for Perl, Eclipse and Komodo, and Komodo doesn't
support anything like it either, I would just go for the hack :)

Maybe it would be possible to set both global and per-function naming conventions


matisse wrote on Wed Apr 25 05:19:25 MEST 2007:
The PPI module might help, but I agree that some sort of annotation seems
like a good solution. Such annotation could even, someday, be used by Perl

sub foo : Local {
   my ( $self, $c) = @_; # @TYPES( MyClass::MyObject, Catalyst )
jploski wrote on Wed Apr 25 18:34:09 MEST 2007:
If we are to believe the following page, Perl 6 is going to have type annotations
and there is already a syntax for it. Unfortunately, no mention of a format
backwards-compatible with Perl 5 is made:

pubgrub wrote on Wed Apr 25 20:54:56 MEST 2007:
I see. That sounds like a good thing.

The bad thing is that we might have to wait quite some time until we can
use that feature.


Note: The above is an archived snapshot of a forum thread. Use the original thread at sf.net to post comments.