emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: progmodes/project.el and search paths


From: Stephen Leake
Subject: Re: progmodes/project.el and search paths
Date: Wed, 12 Aug 2015 08:49:00 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt)

David Engster <address@hidden> writes:

> Stephen Leake writes:
>> Depends on the use case; the user might want to see:
>>
>> - "all (overloaded) definitions of "foo", in all projects "
>>
>>     Perhaps to check whether current occurance could be using a
>>     different definition. Or to see if the different definitions could
>>     be combined, or further refactored.
>>
>>     This is more useful in languages that explicitly support overloaded
>>     symbols (Ada has many definitions of "Put" in its standard library).
>>
>> - "the definition for _this_ use of "foo", in some project "
>>
>>     To see what it actually does.
>>
>> - "all methods for this generic function"
>>
>>     Similar to the first use case, but limited to one generic function.
>>
>> So the question now is: what does EDE do for these use cases?
>
> AFAIK, you can only search in the current project. However, your use
> cases involve more than just a project system. If you want to search for
> overloads or methods, you need a parser as well. 

Yes. 

> This also applies to the most important feature (at least for me):
> show all definitions of 'foo' that are currently in scope. EDE has no
> notions of symbols, scope, overloading, methods, etc.

Yes, I'm beginning to realize that. Semantic provides those things. And
it can use different backends, so it can serve as the Emacs standard
interface to such things (although I'd want to make significant changes
to use it for Ada mode).

In that sense, Semantic competes with xref in the same way EDE competes
with project.el.

> It gets much more complicated when you're not only interested in
> definitions, but any occurance of a symbol. For instance, you want all
> places where 'foo' gets called, but not any 'foo', but the method 'foo'
> from class 'bar' and not from any other class.

Right; that's name resolution; best done by the compiler. So hopefully
it can output cross reference information (or provide access to it in
some way).

> I can't really say much about xref since I haven't really worked with it
> yet. The semantic-symref feature is also pretty limited in this
> regard. So in the end, I often ended up calling grep or global
> directly. 

Right.

> All this stuff is highly dependent on the language you're using.

The backend may be, but at the API level, there are some things that all
object oriented languages support:

- Search for all implementations of this method.

    That's the language used by elisp cl-generic and eieio defclass. I
    just made this the default behavior for xref-find-definitions.
    Although that's not tested on eieio classes; I'll add that to my
    list.
    
    In Ada, it's called "functions that override primitive operations".

    In C++, it's "functions that override a virtual function".

    The terminology is different, but the underlying notion of runtime
    dispatch is the same.

    We might want to customize the menu entry depending on the current
    programming language.
    
- Search for the parents of this type.

    "Type" is the Ada word; other languages use "class" here.

- Search for all functions that overload this one.

    Ada and C++ (at least) support this.
    
- Search for all references to this function.

In C, these searches are simpler; the first three only return one
result.

-- 
-- Stephe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]