Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #1331

Re: Sorry for disturbing this page.....I need help Again

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.help
Subject Re: Sorry for disturbing this page.....I need help Again
Date 2011-11-12 10:01 -0800
Organization http://groups.google.com
Message-ID <20207007.1619.1321120883634.JavaMail.geo-discussion-forums@prdy11> (permalink)
References <508339c1-3b13-4c0f-a2b4-d3af4be61ab6@e2g2000vbb.googlegroups.com> <nospam-2DC387.07295312112011@news.aioe.org>

Show all headers | View raw


John B. Matthews wrote:
> [5] <https://sites.google.com/site/drjohnbmatthews/kineticmodel>

Dr. Dude, your site rocks.  If it had a +1 button I'd click it.

Heck, I'll just post about it on G+ myself.

I only have one stylistic objection, to the use of 'this.' with function calls.  It provides no semantic or documentary advantage, as the method may be invoked on a supertype definition, same-type definition or subtype-definition irrespective of the 'this.' qualifier. (JLS §15.12)

For Roedy: The cited JLS section is a candidate for "The Most Convoluted Wording" award, and is very tricky to follow.  I advise to let your mind glide over the details like, "Let m be a potentially applicable method (§15.12.2.1), let e1, ..., en be the actual argument expressions of the method invocation and let Ai be the type of ei, 1 <= i <= n."  Your mental simplification is just, "The argument types have to match."  Then you skip over, for now, the subparagraph that describes precisely how they have to match.

Likewise you skip over, for now, the parts that deal with generics.

Eventually you simplify that whole section down to, "The number and types of arguments have to match, the return type has to be at least a subtype of the invocation's return type, and you have to reach as far down the inheritance chain as possible for it.  If that confuses the compiler, you get a compiler error.  Generics make it more complicated."

This is where study of the JLS pays off, even in the parts that are as difficult as one might fear.  It's a matter of eliding the details in your mind until you get a succinct yet complete summary of the rules in your head.  ("Complete" allows for certain handwaving like "Generics make it more complicated."  That's because the situation is sufficiently cornerish to merit looking it up again if there's confusion.)

Another point - this is not a section for a single reading.  Every single time I run into a situation, be it a code problem or a Usenet post, that calls upon understanding of this particular section, I reread the section.  Sometimes I read it just for fun.  Each time, I either re-summarize as above, or I delve into one of those corners that I avoided in panic before.  I might take an hour just to understand one phrase or sentence like, 

"If m is a generic method as described above then Ul <: Bl[R1 = U1, ..., Rp = Up], 1 <= l <= p."

<http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.12.2.2>
[Watch the ones and ells in the above; your typeface may vary.]

It's time well spent.

-- 
Lew

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Sorry for disturbing this page.....I need help Again Michael Adedeji <yankosmgt@gmail.com> - 2011-11-11 01:31 -0800
  Re: Sorry for disturbing this page.....I need help Again Lew <lewbloch@gmail.com> - 2011-11-11 07:18 -0800
  Re: Sorry for disturbing this page.....I need help Again "John B. Matthews" <nospam@nospam.invalid> - 2011-11-12 07:29 -0500
    Re: Sorry for disturbing this page.....I need help Again Lew <lewbloch@gmail.com> - 2011-11-12 10:01 -0800
      Re: Sorry for disturbing this page.....I need help Again "John B. Matthews" <nospam@nospam.invalid> - 2011-11-12 22:38 -0500

csiph-web