Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #13666 > unrolled thread
| Started by | Lew <lewbloch@gmail.com> |
|---|---|
| First post | 2012-04-19 17:17 -0700 |
| Last post | 2012-04-21 04:15 -0700 |
| Articles | 6 — 4 participants |
Back to article view | Back to comp.lang.java.programmer
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: terminology Lew <lewbloch@gmail.com> - 2012-04-19 17:17 -0700
Re: terminology markspace <-@.> - 2012-04-19 20:01 -0700
Re: terminology Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-04-20 07:09 -0300
Re: terminology Lew <noone@lewscanon.com> - 2012-04-20 08:05 -0700
Re: terminology markspace <-@.> - 2012-04-20 11:03 -0700
Re: "static context" Lew <noone@lewscanon.com> - 2012-04-21 04:15 -0700
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2012-04-19 17:17 -0700 |
| Subject | Re: terminology |
| Message-ID | <580829.126.1334881065985.JavaMail.geo-discussion-forums@pbcgs4> |
Stefan Ram wrote:
> Sometimes, I was being criticized for making up non-standard
> terminology. If there is a standard term for the following,
> then please tell me so:
<http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html>
> In
>
> java.lang.Thread . dumpStack()
> java.lang.System.out . print( 2 )
>
> I do call the source code part in front of the last dot a
> /context/.
Fully-qualified type name.
<http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.5.2>
> I do call the simple name between the last dot and the first
> parentheses a /verb/. (So a verb does never contain a dot.)
Simple method name.
<http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.7.1>
> (I do /not/ call this »method name«, since I want to exclude
> texts with dots, like »>java.lang.Thread.dumpStack«, which
> are also method names in Java AFAIK.)
Qualified method name.
<http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.7.2>
> I do call the simple call after the last dot up to the last
> parentheses a /sentence/.
Method invocation expression, except that includes the qualifier. There is no standard term for what you call a "sentence", nor would most Java programs have the faintest clue what you mean by that word.
<http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12>
> (I do /not/ call this »[method ]call«, since the whole lines
> including the dots are also called »[method ]calls« or
> »[method ]invocations« in Java.)
There's always a qualifier in a method invocation, so there is no such thing as an invocation without one. The qualifier is just implicit by the grace of 'import', but it's explicit in the JVM regardless.
To be consistent with Java terminology, use the term "simple method invocation", which is not official but at least it's explicable.
>
> context sentence
> .------------------. .------------.
> java.lang.Thread . dumpStack()
> java.lang.System.out . print ( 2 )
> '-------'
> verb
> '------------------------------'
> not a verb, because of dots
> '-----------------------------------'
> not a sentence, because of dots
>
> Ok, »context« /is/ a standard JLS term, but »verb« is less
"Context" in the JLS has several meanings, all identical to the standard English usage, not a technical context:
<http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.1>
Here are a few of them:
- In a package declaration (§7.4)
- To the left of the "." in a qualified PackageName
- In a single-type-import declaration
- To the left of the "." in a single-static-import declaration
- To the left of the "<" in a parameterized type
- In an explicit type argument list in a method or constructor invocation
- As a PostfixExpression
- Before the "(" in a method invocation expression
- To the left of the "=" sign in an annotation's element value pair
and many more. Your attempt to reduce "context" to one specific construct amongst this plethora is at variance with Java's terminology.
> so (although sometimes used in OOP, IIRC), and »sentence«
> was invented by me, but seems natural, once one accepts »verb«.
>
> However, if there are already standard Java terms for this,
> I'd gladly use them.
Quite frankly I'm surprised that you aren't already using the terms defined in the JLS where they exist, and following their pattern when they don't. I'm especially surprised that you'd use terms differently from how they do ("context"). I strongly suggest that you use the terminology from the JLS.
--
Lew
[toc] | [next] | [standalone]
| From | markspace <-@.> |
|---|---|
| Date | 2012-04-19 20:01 -0700 |
| Message-ID | <jmqjhq$b7b$1@dont-email.me> |
| In reply to | #13666 |
On 4/19/2012 5:17 PM, Lew wrote: > Stefan Ram wrote: >> java.lang.Thread . dumpStack() java.lang.System.out . print( 2 >> ) >> >> I do call the source code part in front of the last dot a >> /context/. > > Fully-qualified type name. > <http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.5.2> I'd have said the same off the top of my head. I'd also call it a "class" if FQN was a bit long, or I was being less strict in my speaking. > >> I do call the simple name between the last dot and the first >> parentheses a /verb/. (So a verb does never contain a dot.) > > Simple method name. > <http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.7.1> "Method" or "method invocation" works for me. >> (I do /not/ call this »method name«, since I want to exclude texts >> with dots, like »>java.lang.Thread.dumpStack«, which are also >> method names in Java AFAIK.) > > Qualified method name. > <http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.7.2> Or identifier, or "method name," imo. >> I do call the simple call after the last dot up to the last >> parentheses a /sentence/. > > Method invocation expression, except that includes the qualifier. > There is no standard term for what you call a "sentence", nor would > most Java programs have the faintest clue what you mean by that > word. > <http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12> Also "statement" if there's a ; at the end, I think. > >> (I do /not/ call this »[method ]call«, since the whole lines >> including the dots are also called »[method ]calls« or »[method >> ]invocations« in Java.) > > There's always a qualifier in a method invocation, so there is no > such thing as an invocation without one. The qualifier is just > implicit by the grace of 'import', but it's explicit in the JVM > regardless. I'm not sure. If you're invoking a method that is a member of an enclosing class or type, you don't need to qualify it. "wait()", "notify()", etc. never need to be qualified if "this" is the qualifier. As for "the whole line is an invocation," this is a statement with two invocations: double d = Math.sin(1.0) + Math.cos(1.0); I don't think the "whole line" can be an invocations, it's just that you happen to have a method call, expression, and statement that are all the same thing in that one particular example. That won't always be true.
[toc] | [prev] | [next] | [standalone]
| From | Arved Sandstrom <asandstrom3minus1@eastlink.ca> |
|---|---|
| Date | 2012-04-20 07:09 -0300 |
| Message-ID | <PBakr.9945$VF7.7285@newsfe02.iad> |
| In reply to | #13675 |
On 12-04-20 01:40 AM, Stefan Ram wrote: [ SNIP ] > Obviously, these are all different things: A method is not > a method name, and a method is not a method invocation. > > Some, albeit slight, justification of my term »verb« comes > from the JLS 7, which says in 6.1: > > "Method names should be verbs". > It occurs to me that you'd like J, at least for the terminology. All sentences in J are composed of verbs and nouns and copulas and adverbs and conjunctions. AHS -- A fly was very close to being called a "land," cause that's what they do half the time. -- Mitch Hedberg
[toc] | [prev] | [next] | [standalone]
| From | Lew <noone@lewscanon.com> |
|---|---|
| Date | 2012-04-20 08:05 -0700 |
| Message-ID | <jmru07$91b$1@news.albasani.net> |
| In reply to | #13675 |
On 04/19/2012 09:40 PM, Stefan Ram wrote:
> markspace<-@.> writes:
>>>> java.lang.Thread . dumpStack() java.lang.System.out . print( 2 )
>>>> I do call the source code part in front of the last dot a
>>>> /context/.
>>> Fully-qualified type name.
>> I'd have said the same off the top of my head. I'd also call it a
>> "class" if FQN was a bit long, or I was being less strict in my speaking.
>
> A »type name« is a special kind of context, it is a static context.
> My usage does not come from the JLS, but from javac who says things like:
>
> Main.java:7: error: non-static method length() cannot be referenced from a static context
> String.length();
> ^
> 1 error
>
> When you teach java [sic], explaining vocabulary of javac can't be
> that wrong, even if it's not as authoritative as the JLS.
> Obviously, the »static context« above is »String«.
No. 'String' is the (simple) type name. The static context is the semantic
space to the right of the dot.
> I cannot call this »type name«, since the part in front of
> the last dot is not always a type name, as in
>
> java.lang.System.out . println()
>
> . »java.lang.System.out« is the context of »println()«
> (in my terms), but it is not a type name.
"Context" is a general term, and the javac output is using it exactly as the
JLS does. Static contexts occur other than by a type name, e.g.,:
public class Foo
{
static
{ // static context
}
}
There is nothing wrong with using these terms as the JLS does.
When you teach Java, the vocabulary of the JLS can't be wrong. (Well, there
are questionable items in there, but that's another matter.) Trying to go
against it, especially diametrically, can be.
More subtly, you misidentified the static context in the 'String' call to
'length()'. "Context" is used in its ordinary, English sense in the JLS, and
in the concomitant "javac" output. It means, in that example, that at the
point of evaluation of the method name, that is, to the right of the dot, the
semantic environment is that of the type specified by the type name to the
left of the dot. By the rules of Java, since it's a type name and not an
instance name, the context is static. Likewise in a static initializer, to
between the braces is a static context. "Context" means the environment or
ontological background - are we looking at the world from the class-wide
(static) view or the instance view?
I aver that you're going about this backwards, thus impeding understanding of
Java. Instead of trying to map your terms to what exists in Java, start with
the Java terminology and grok what they really mean. Then, if you still really
feel the need, come up with synonyms, rather than shoehorning alien concepts
into the Java space.
--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
[toc] | [prev] | [next] | [standalone]
| From | markspace <-@.> |
|---|---|
| Date | 2012-04-20 11:03 -0700 |
| Message-ID | <jms8d7$upm$1@dont-email.me> |
| In reply to | #13675 |
On 4/19/2012 9:40 PM, Stefan Ram (quoting a bunch of people): >>>> I do call the simple name between the last dot and the first >>>> parentheses a /verb/. (So a verb does never contain a dot.) >>> Simple method name. >>> <http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.7.1> >> "Method" or "method invocation" works for me. > > Obviously, these are all different things: A method is not > a method name, and a method is not a method invocation. Right. It's "method" or "method name" if you mean just the method, and "invocation" if you're referring to the act of making the call. Since some different concepts were being tossed around, I gave both answers.
[toc] | [prev] | [next] | [standalone]
| From | Lew <noone@lewscanon.com> |
|---|---|
| Date | 2012-04-21 04:15 -0700 |
| Subject | Re: "static context" |
| Message-ID | <jmu4rs$9ts$1@news.albasani.net> |
| In reply to | #13675 |
On 04/20/2012 09:27 PM, Stefan Ram wrote:
> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>>>>> java.lang.Thread . dumpStack() java.lang.System.out . print( 2 )
>> A »type name« is a special kind of context, it is a static context.
>
> JLS 7 defines »static context« in 8.1.3, but the compiler
> uses another meaning of »static context«.
>
> For example, the call »dumpStack()« in
>
> class A { void m(){ java.lang.Thread.dumpStack(); }}
>
> is /not/ in a static context according to JLS 7 8.1.3,
Incorrect. The statement 'Thread.dumpStack();' is not in a static context. The
simple method name 'dumpStack()' is.
I see in
<http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.1.3>
that is says,
"A statement or expression occurs in a static context if and only if the
innermost method, constructor, instance initializer, static initializer, field
initializer, or explicit constructor invocation statement enclosing the
statement or expression is a static method, a static initializer, the variable
initializer of a static variable, or an explicit constructor invocation
statement (§8.8.7)."
There are two contexts operating here. 'dumpStack()' occurs in a static
context established by the symbol 'Thread' and the dot. The entire expression,
or statement, 'Thread.dumpStack();' [*] occurs in a non-static context
established by the opening curly brace of the instance method definition.
> but /is/ according to javac.
>
> One reason for this possibly is that JLS 1 did not yet
> define »static context«, so the wording of the compiler
> message might predate the first definition of »static
> context« in the JLS.
[*] Why the heck do you insist on calling out 'java.lang'? It's highly
unconventional and not at all idiomatic for Java.
--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web