unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
To: emacs-devel@gnu.org
Subject: Re: Minor bug in cc-menus.el: cc-imenu-java-generic-expression does not match all Java 1.5+ function definitions.
Date: Tue, 28 Jul 2009 13:42:46 +0200	[thread overview]
Message-ID: <87ws5t3ufd.fsf@lola.goethe.zz> (raw)
In-Reply-To: 20090728101959.GA2295@muc.de

Alan Mackenzie <acm@muc.de> writes:

> sorry about the delay replying - I'm the guy who does the CC Mode
> things, and sadly there's only one of me at the moment.
>
> On Sat, Jul 18, 2009 at 08:27:10AM -0700, Nathaniel Flath wrote:
>> I was using Imenu, and noticed that it currently doesn't recognize Java
>> functions with either:
>> Generics e.g : public List<String> foo() { ...
>> or annotated arguments, e.g : public void foo( @NonNull bar ) {
>
> CC Mode has got a bit behind in handline C++ templates and Java generics
> (which are essentially the same thing from Emacs's point of view).
> There's quite a bit of work to be done on updating Java Mode's support
> for recent enhancements to the language.
>
> <rant>
> Misusing "<" and ">" as template/generic delimiters was an egregious
> "design" decision by the C++ people,

It was actually a design decision by the Ada people.  Ada uses <...> for
constraints in lots of contexts, and generics parameters are
constraints.

It was abysmally stupid to let C++ templates look like Ada generics, in
particular since C++ has << and >> operators.  But then C++ syntax is a
collection of stupidities, parseable only by hand-written recursive
descent parsers and they still tend to get the corner cases wrong (while
human readers tend to get surprised by quite more cases).  And it is
already stupid to have a preprocessor with a different syntax, but that
particular stupidity is inherited.

C++ is an attempt to cram not only everything that can be somehow made
to fit into the functionality, but also into the syntax.  And that's
insane.

> There are pieces of C++ code which need a compiler (or some equivalent
> tool) to distinguish "less than" from "template start".  There might
> also be similar Java code, I'm not sure.  As a result, syntactic
> analysis of C++ (and maybe Java) code which contains "<" and ">" is
> either difficult or impossible in the general case.

And nowadays, >> for ending two nested template parameter sets is
supposed to be handled properly by the compiler.  Making the problem
still more complex.

In a well-designed language, recognizing syntactic elements does not
need much context.  Nobody wants to read computer languages in the style
of classic Greek where a single sentence spreads itself over more than
one page and happens not to actually have a verb predicate, so you go
back and forth until you finally manage to make sense of the nested
somewhat arbitrary constructs.

If I wanted to do that, I would learn German.  Oh, wait...

-- 
David Kastrup





  reply	other threads:[~2009-07-28 11:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-18 15:27 Minor bug in cc-menus.el: cc-imenu-java-generic-expression does not match all Java 1.5+ function definitions Nathaniel Flath
2009-07-21 20:18 ` Nathaniel Flath
2009-07-24  3:58   ` Glenn Morris
2009-07-28 10:19 ` Alan Mackenzie
2009-07-28 11:42   ` David Kastrup [this message]
2009-07-29  3:28   ` Chong Yidong
2009-07-29  4:46     ` Nathaniel Flath
2009-08-07 14:32       ` Nathaniel Flath
     [not found]         ` <5e3a506e0908162232h192a3c28o42e1745f4444b911@mail.gmail.com>
2009-08-17  5:33           ` Fwd: " Nathaniel Flath
2009-08-22 14:17             ` Alan Mackenzie
2009-08-22 16:48               ` Nathaniel Flath
     [not found]                 ` <jwvr5v3b9ke.fsf-monnier+emacs@gnu.org>
     [not found]                   ` <5e3a506e0909291146w607168e7l578858a741cfa19a@mail.gmail.com>
2009-10-17 16:59                     ` Nathaniel Flath
2009-10-17 23:43                       ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ws5t3ufd.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).