generics "erasure" doubt

J

josh

Hi I've a doubt with generics erasure.

When the compiler do an "erasure" it always convert type parameters
with Object type?

If I've a method in which I pass an Integer object the E typo is
translated with Object or with Integers?
 
L

Lew

josh said:
Hi I've a doubt with generics erasure.

No, you don't. You have a question. A doubt is a suspicion, e.g., about
veracity or honesty.
When the compiler do an "erasure" it always convert type parameters
with Object type?

No, it never does.
If I've a method in which I pass an Integer object the E typo [sic] is
translated with Object or with Integers?

Neither. "Erasure" means that the type parameter goes away entirely.
 
J

josh

No, you don't. You have a question. A doubt is a suspicion, e.g., about
veracity or honesty.


No, it never does.

are you sure ? many books doesn't say that!

If I've a method in which I pass an Integer object the E typo [sic] is
translated with Object or with Integers?

Neither. "Erasure" means that the type parameter goes away entirely.

are you sure ? I'm reading that!
 
H

Hendrik Maryns

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

josh schreef:
No, you don't. You have a question. A doubt is a suspicion, e.g., about
veracity or honesty.

No, it never does.

are you sure ? many books doesn't say that!

If I've a method in which I pass an Integer object the E typo [sic] is
translated with Object or with Integers?
Neither. "Erasure" means that the type parameter goes away entirely.

are you sure ? I'm reading that!

My guess: you have to read better.

H.

- --
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFGLyaqe+7xMGD3itQRAlajAJ9I/DsIpXhOOY2sBEYhZzNdh6IjHACSA2Mx
xgbyXXaG9eJS0GAUquw32w==
=7uVt
-----END PGP SIGNATURE-----
 
L

Lew

josh schreef:
josh schreef:
are you sure ?

Yes.

josh schreef:
many books doesn't say that!

Which books? What /do/ they say?

josh schreef:
If I've a method in which I pass an Integer object the E typo [sic] is
translated with Object or with Integers?
Neither. "Erasure" means that the type parameter goes away entirely.

josh schreef:
are you sure ?

Yes. Why else would I risk putting it out here in a public place where
everyone can see it? Don't worry, I will let you know if I am unsure,
otherwise do not doubt it. (Now you are expressing doubt, by the way. See
the differeence? You suspect my answer, so you doubt it. It's still correct,
of course, despite your doubts.)

josh schreef:
I'm reading that!

You're reading what. specifically?

As the name indicates, type erasure erases the type parameter. It doesn't
convert it.

Hint: What is the dictionary definition (in English) of the word "erasure"?
<http://en.wiktionary.org/wiki/erasure>
<http://en.wiktionary.org/wiki/erase>

Reference:
<http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.6>
 
J

John W. Kennedy

Lew said:
No, you don't.

Yes he does. If you're going to correct someone's language, be sure you
know what you're talking about, first.
A doubt is a suspicion, e.g., about veracity or honesty.

You're wrong.

--
John W. Kennedy
"Compact is becoming contract,
Man only earns and pays."
-- Charles Williams. "Bors to Elayne: On the King's Coins"
* TagZilla 0.066 * http://tagzilla.mozdev.org
 
I

Ingo R. Homann

Hi josh,

apart from the meaning of the word "doubt" (I am no native speaker ;-),
I think you are right, in what type erasure does. Consider having a
class like this:

class Container<T> {
T t;
void set(T t) {
this.t=t;
}
}

Then it is true - AFAIK - that T (in line 1) is "erased" whereas the
other T's can be thought of "replaced by Object". (Of course, type
erasure does a bit more because there are no casts necessary, which
would be the case if you replaced T to Object manually.)

Ciao,
Ingo
 
J

josh

josh schreef:

josh schreef:
are you sure ?

Yes.

josh schreef:
many books doesn't say that!

Which books? What /do/ they say?

josh schreef:
If I've a method in which I pass an Integer object the E typo [sic] is
translated with Object or with Integers?
Lew said:
Neither. "Erasure" means that the type parameter goes away entirely.

josh schreef:
are you sure ?

Yes. Why else would I risk putting it out here in a public place where
everyone can see it? Don't worry, I will let you know if I am unsure,
otherwise do not doubt it. (Now you are expressing doubt, by the way. See
the differeence? You suspect my answer, so you doubt it. It's still correct,
of course, despite your doubts.)

josh schreef:
I'm reading that!

You're reading what. specifically?

As the name indicates, type erasure erases the type parameter. It doesn't
convert it.

Hint: What is the dictionary definition (in English) of the word "erasure"?
<http://en.wiktionary.org/wiki/erasure>
<http://en.wiktionary.org/wiki/erase>

Reference:
<http://java.sun.com/docs/books/jls/third_edition/html/typesValues.htm...>

ok, I post this form Java How To Program 6Ed and so you can understand
me why I have some "doubts" and
not some questions!

this is from Chapter 18 the listing
// generic method printArray
public static < E > void printArray( E[] inputArray )
{
// display array elements
for ( E element : inputArray )
System.out.printf( "%s ", element );
System.out.println();
} // end method printArray

and this is the phrase:parameter section and replaces the type parameters with actual types.
This process is known as erasure.
By default all generic types are replaced with type Object <<<

so it is said "removes" and than "replaced" and than look at that
final book example:

public static void printArray( Object[] inputArray )
{
// display array elements
for ( Object element : inputArray )
System.out.printf( "%s ", element );
System.out.println();
} // end method printArray

Regards
 
E

Esmond Pitt

josh said:
ok, I post this form Java How To Program 6Ed>
...
and this is the phrase:


parameter section and replaces the type parameters with actual types.
This process is known as erasure.
By default all generic types are replaced with type Object <<<

So what does it say about translating generic *classes* into Java. Don't
tell me it says that GenericClass<T> is translated into
GenericClass said:
so it is said "removes" and than "replaced" and than look at that
final book example:

That example being about a generic method not a generic class is
consistent with what you've been told here.
 
L

Lew

John said:
Yes he does. If you're going to correct someone's language, be sure you
know what you're talking about, first.


You're wrong.

No, you're wrong, genius.
Verb

Infinitive
to doubt


Third person singular
doubts


Simple past
doubted


Past participle
doubted


Present participle
doubting

to doubt (third-person singular simple present doubts, present participle doubting, simple past doubted, past participle doubted)

1. To lack confidence in; to disbelieve, question, or suspect.

He doubted that was really what you meant.

[edit]
 
L

Larry Barowski

Lew said:
No, you're wrong, genius.

This same topic was discussed here a few weeks ago. In British
and American English, the nouns "doubt" and "question" are
never synonymous, but it seems that in Indian English they can
be. "josh" sounds like an American name, but you never know.
 
J

John W. Kennedy

Lew said:
No, you're wrong, genius.

To begin with, you might want to look up the noun, rather than the verb,
since it is the noun that is under discussion. But that's neither here
nor there, really, seeing that Wiktionary is far less reliable than
Wikipedia to begin with. (A competent encyclopedia article requires the
author merely to be knowledgeable on the subject at hand, and literate;
a competent dictionary entry requires the author to be a lexicographer.)

doubt
–noun
5. a feeling of uncertainty about the truth, reality, or nature of
something.
6. distrust.
7. a state of affairs such as to occasion uncertainty.
8. Obsolete. fear; dread.

-- Dictionary.com. Dictionary.com Unabridged (v 1.1). Random House, Inc.
http://dictionary.reference.com/browse/doubt (accessed: April 26, 2007).

doubt
n.
1. A lack of certainty that often leads to irresolution. See
Synonyms at uncertainty.
2. A lack of trust.
3. A point about which one is uncertain or skeptical: reassured me
by answering my doubts.
4. The condition of being unsettled or unresolved: an outcome still
in doubt.

-- Dictionary.com. The American Heritage® Dictionary of the English
Language, Fourth Edition. Houghton Mifflin Company, 2004.
http://dictionary.reference.com/browse/doubt (accessed: April 26, 2007).

doubt
noun
1. the state of being unsure of something [ant: certainty]
2. uncertainty about the truth or factuality or existence of something;
"the dubiousness of his claim"; "there is no question about the validity
of the enterprise"

-- Dictionary.com. WordNet® 3.0. Princeton University.
http://dictionary.reference.com/browse/doubt (accessed: April 26, 2007).


--
John W. Kennedy
"Those in the seat of power oft forget their failings and seek only the
obeisance of others! Thus is bad government born! Hold in your heart
that you and the people are one, human beings all, and good government
shall arise of its own accord! Such is the path of virtue!"
-- Kazuo Koike. "Lone Wolf and Cub: Thirteen Strings" (tr. Dana Lewis)
* TagZilla 0.066 * http://tagzilla.mozdev.org
 
L

Larry Barowski

John W. Kennedy said:
Definitions of "doubt"

None of those definitions are "a interrogative statement" or
"a request for information", which is how the OP used the
word "doubt". In American and British English, it never
has that meaning.
 
J

John W. Kennedy

Larry said:
None of those definitions are "a interrogative statement" or
"a request for information", which is how the OP used the
word "doubt". In American and British English, it never
has that meaning.

"a feeling of uncertainty about the truth, reality, or nature of something"

"A lack of certainty that often leads to irresolution. See Synonyms at
uncertainty."

"the state of being unsure of something [ant: certainty]"

The "interrogative statement" and "request for information" exist only
in your interpretation.
 
L

Larry Barowski

John W. Kennedy said:
The "interrogative statement" and "request for information" exist only in
your interpretation.

Read the OP again. How else would you interpret "I've a doubt
with generics erasure"? He doesn't seem to doubt that generics
erasure exists, and doesn't go on to discuss any sort of doubt
related to erasure. He does have some questions about how
erasure works. The two statements that follow seem to be requests
for information, and not requests to confirm or deny suspicions.
Try this: "I have some doubts about ferrets. Are they in the weasel
family? How many toes do they have?". "doubts" could be the
correct word there for the intended meaning, but it would be a
strange sequence of sentences.
 
J

John W. Kennedy

Larry said:
Read the OP again. How else would you interpret "I've a doubt
with generics erasure"? He doesn't seem to doubt that generics
erasure exists, and doesn't go on to discuss any sort of doubt
related to erasure. He does have some questions about how
erasure works. The two statements that follow seem to be requests
for information, and not requests to confirm or deny suspicions.

You keep insisting that "doubt" == "suspicion".
Try this: "I have some doubts about ferrets. Are they in the weasel
family? How many toes do they have?". "doubts" could be the
correct word there for the intended meaning, but it would be a
strange sequence of sentences.

Oh God! We mustn't have people making sentences the way YOU wouldn't. I
mean, next thing, they'll be trying to marry each other....

--
John W. Kennedy
"...if you had to fall in love with someone who was evil, I can see why
it was her."
-- "Alias"
* TagZilla 0.066 * http://tagzilla.mozdev.org
 
L

Larry Barowski

John W. Kennedy said:
You keep insisting that "doubt" == "suspicion".

I've never insisted on that, or even hinted at it. The paragraph
above is the first in which I've even used the word.

He doesn't go on to discuss any sort of doubt related to erasure,
using any definition of "doubt" that you supplied earlier. He
does follow with two very direct questions.
Oh God! We mustn't have people making sentences the way YOU wouldn't. I
mean, next thing, they'll be trying to marry each other....

Your point seems to be that we should assume that disjointed
sentences in sequence are just as likely as related ones. I think
you'll find that related sentences occur much more frequently,
even when they are written by people other than ME.
 
J

Joshua Cranmer

John said:
"a feeling of uncertainty about the truth, reality, or nature of something"

"A lack of certainty that often leads to irresolution. See Synonyms at
uncertainty."

"the state of being unsure of something [ant: certainty]"

The "interrogative statement" and "request for information" exist only
in your interpretation.

Those statements do not the match the OP's original statement. All of
them in essence mean that a doubt requires a presumption of truth. The
OP's original statements neither presume that the answer is "yes" or
"no"; thus, they do not have the fundamental questioning of truth that
is necessary for doubt to exist.
 
J

John W. Kennedy

Joshua said:
John said:
"a feeling of uncertainty about the truth, reality, or nature of
something"

"A lack of certainty that often leads to irresolution. See Synonyms at
uncertainty."

"the state of being unsure of something [ant: certainty]"

The "interrogative statement" and "request for information" exist only
in your interpretation.

Those statements do not the match the OP's original statement. All of
them in essence mean that a doubt requires a presumption of truth.

"Is this a statement that I see before me?"
-- Lewis Carroll: "A Tangled Tale"


--
John W. Kennedy
"I want everybody to be smart. As smart as they can be. A world of
ignorant people is too dangerous to live in."
-- Garson Kanin. "Born Yesterday"
* TagZilla 0.066 * http://tagzilla.mozdev.org
 
J

John W. Kennedy

Larry said:
I've never insisted on that, or even hinted at it. The paragraph
above is the first in which I've even used the word.

He doesn't go on to discuss any sort of doubt related to erasure,
using any definition of "doubt" that you supplied earlier. He
does follow with two very direct questions.


Your point seems to be that we should assume that disjointed
sentences in sequence are just as likely as related ones. I think
you'll find that related sentences occur much more frequently,
even when they are written by people other than ME.

They are related. He states that he is not clear on how type erasure
works with Java generics. Then he asks some questions that he hopes will
clarify his understanding. His sentences are somewhat parataxic, but
hardly disjointed.

--
John W. Kennedy
"Those in the seat of power oft forget their failings and seek only the
obeisance of others! Thus is bad government born! Hold in your heart
that you and the people are one, human beings all, and good government
shall arise of its own accord! Such is the path of virtue!"
-- Kazuo Koike. "Lone Wolf and Cub: Thirteen Strings" (tr. Dana Lewis)
* TagZilla 0.066 * http://tagzilla.mozdev.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top