Re: semantic-analyze-possible-completion

Martin Stein <[email protected]> Tue, 03 Feb 2015 20:53:35 +0100
Newsgroups gmane.emacs.cedet
Message-ID <[email protected]>
Hi,

> However, I was experimenting with namespace examples to see what the
> context looks like and how the relevant tags are retrieved internally
> when I came across this short textbook example somewhat extended by me:
>
> namespace bar
> {
>     const double math_pi = 3.1416;
>     struct nn { double some; } pp;
> }
>
>
> int main () {
>     using namespace bar;
>
>     double x;
>     x = math_!_
>     x = bar::_!_
>     return 0;
> }
>
> Having the cursor at the first _!_ the completion function should
> suggest math_pi, but it does not. If I type x = bar::math instead, then
> the desired completion is shown. To me this looks like a bug, because
> "using namespace bar" is all about make the bar names available in the
> main function. Do I miss something?
>
> Moreover, even with the prefix bar:: the completion engines misses to
> offer pp at the second _!_, it just offers math_pi. Looks like a bug as
> well?

Trying to understand semantic-analyze-scoped-types, which never returned 
anything different than nil for me, I came across 
semantic-ctxt-scoped-types, which is only non-nil in c++-mode. I was 
unaware that namespaces are an c++-only feature. So the above example 
was in a c-file, in c mode... In c++ mode everything works fine as 
expected.

Understanding this also helps to fit Fortran into C structure: For a 
function, subroutine or program, which has a contains part, create a 
"contains" tag of class type and :type "contains" and return those tags 
by overloadable semantic-ctxt-scoped-types. At the moment, functions and 
subroutines residing in a contains sections of an encompassing function, 
subroutine or program are tags in the members list of this encompassing 
tag, and hence the encompassing function, subroutine or program would 
act like a hybrid of class 'function and 'type at the same time, which 
does not fit well into the current framework.

Martin


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/