Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > no more primitive data types in Java (JDK 10+). What do you think?

Reply
Thread Tools

no more primitive data types in Java (JDK 10+). What do you think?

 
 
Bernd Nawothnig
Guest
Posts: n/a
 
      04-21-2012
On 2012-04-20, Gene Wirchenko wrote:
>>These implementation details should better be hidden and invisible for
>>most cases. Let the compiler automatically detect and generate
>>possible optimisations.

>
> If you complicate things, the compiler then has to work to
> decomplicate (optimise). Why not just keep it simple?


My proposal was quite the contrary: simplification of things, i.e.
removal of unnecessary data types by unifications.

Keep in mind: the compiler is not the programmer!

>>A programming language should be as simple and orthogonal as possible.

>
> One application of keeping it simple would be to use primitives
> where possible -- since they are simpler than objects -- and only use
> objects where they are needed.


See above: don't mix up the compiler, the machine, and implementation
details with the programmer. Things should be simple for the
*programmer*, not necessarily for the compiler or the machine, even if
that maybe preferable. But preferable is not necessary ...




Bernd

--
"Die Antisemiten vergeben es den Juden nicht, dass die Juden Geist
haben - und Geld." [Friedrich Nietzsche]
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      04-21-2012
n 04/20/2012 07:57 PM, BGB wrote:
> On 4/20/2012 8:20 AM, Lew wrote:
>> BGB wrote:
>>> I think for many, "teens" starts at 10 (rather than 13), so 2010-2019
>>> would be
>>> the "teens" of the new millennium.

>>
>> If many thought the world were flat, would that make them right?
>>
>> No.
>>
>> "Ten". "Eleven". "Twelve". "Thir_*teen*_". "Four_*teen*_".
>> "Fif_*teen*_". ...
>>

>
> I was aware of this, hence why 13 was mentioned in contrast.
> "many" need not be the majority though, nor necessarily correct, only "a
> sizeable minority".


How sizeable is this sadly mistaken minority?

If they all thought the world were flat, would that make them correct?

> much like saying "many people use Linux", despite most people using Windows...


Nothing like that at all. We're talking about what "teens" actually means, not
how many people use it wrongly. This is not a subjective matter.

> there are similar things prone to vary, such as:
> how many is "a couple"? "a few"? or "a handful"? (*1)
> is "a dozen" necessarily 12? (rather then 10, 13, or 14)


Nothing remotely similar. The "teens" definition is precise, the "few"
definition is not.

A dozen is necessarily 12.

Duh.

You're all over the map on this one.

> ...
>
>
> *1: yes, there are people who use these terms and expect a certain number. it
> leads to frustration, personally, as I think of most of these as "something
> greater than 1", whereas I know of someone who thinks: "couple"=3, "few"=4,
> and "handful"=5.
>


Imprecise words like "few" or "couple" in that sense (most senses of "couple"
are "two", but there is one sense of "near two") are deliberately vague and
subject to interpretation. Precise words, like "teens"

"teens   [teenz] Show IPA
plural noun
the numbers 13 through 19, especially in a progression, as the 13th through
the 19th years of a lifetime or of a given or implied century."
<http://dictionary.reference.com/browse/teens>

or "dozen"
<http://dictionary.reference.com/browse/dozen>

are not so subject to interpretation.

--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedi.../c/cf/Friz.jpg
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      04-21-2012
glen herrmannsfeldt wrote:
> Now, when Kennedy promised to land on the moon before the decade
> was out, did he mean 1969 or 1970? It seems that NASA believed
> he meant 1969. (The July launch gave them some margin for later
> tries if that one didn't make it.)


Well, of course. The decades question was already cited upthread as
non-controversial. No one for a millisecond back then thought he meant after
January 1, 1970, I assure you.

It certainly would be silly to regard nineteen-*seven*ty as part of the
*six*ties, wouldn't it?

What possible hyperpedantic and stupid "reasoning" could be used to claim
otherwise?

--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedi.../c/cf/Friz.jpg
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      04-21-2012
glen herrmannsfeldt wrote:
> Lew wrote:
>
> (snip, I wrote)
>>> As I remember, all unicode [sic] letters are allowed.
>>> There are plenty

>
>> As I looked up in the JLS, that's not true. Leading digits are
>> not permitted.

>
> What isn't true? I wrote letters, you wrote digits. Unicode has many
> of each, but the letters aren't digits and the digits aren't letters.


It isn't true that a construct such as

class 0 extends Peano

could be in conflict with numbers as objects, as you were trying to claim.

>
>> "An identifier is an unlimited-length sequence of Java letters
>> and Java digits, the first of which must be a Java letter."
>> <http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8>

>
>> The JLS trumps your memory.

>
> and there are a lot more than 52 Java letters.
>
>>> that could be confusing to readers. Maybe there aren't any that
>>> look like roman digits, though. There are many that look like,
>>> but aren't the same character as, roman alphabet letters.

>
>> But those characters are not used to represent integers,
>> so are not germane to this conversation.

>
> True, but it could be confusing. Well, we already have the


Maybe, slightly, but that was irrelevant to the point in the conversation,
which was a discussion of whether numbers as objects implied legitimacy for
having a numerically-named type derive from another. Your statement about
non-digit Unicode characters is a red herring in that context.

> confusion between 0 and O, but most are used to that by now.
> Now, name a variable \u039f and see how confusing it can be.


What does that have to do with whether digit glyphs could be syntactically
valid as identifiers for descendant types?>

>> The question at hand was the potential legitimization of
>> glyphs that represent integers to be used as class names that
>> inherit from other classes. Those glyphs are not currently
>> allowed to be leading characters of identifiers, so unless
>> that changes, rossum's construct will never be legal.

>
> I don't know of a visual representation for all the legal
> Java letters, but yes they should be disjoint from the digits
> that can be used in numeric constants.


And are, as cited. This whole thing is an attempt to resolve your tangential
comment as not pertinent to the point that was being made at the time.

Confusing non-digit glyphs have nothing to do with whether digit glyphs can
lead off identifiers. Pretending that you broke the rules is not the same as
actually breaking the rules.

--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedi.../c/cf/Friz.jpg
 
Reply With Quote
 
BGB
Guest
Posts: n/a
 
      04-21-2012
On 4/21/2012 5:05 AM, Leif Roar Moldskred wrote:
> Lew<(E-Mail Removed)> wrote:
>>
>> How sizeable is this sadly mistaken minority?
>>
>> If they all thought the world were flat, would that make them correct?

>
> Language isn't defined by an objective physical reality, though, but
> by usage -- which is why "awful" and "awesome" today have opposite
> meanings.
>


yes, and why people might actually disagree regarding the usage of
various terms.

for objective reality, people can go and measure and test stuff.
for language use, it more amounts to consensus, and languages change
over time:
this can be drastic, as in the differences between English and German;
this can be more subtle, as in the differences between the US California
dialect and Londoner dialects of English;
or it can be things like the specific uses of certain terms.

so, it is all a bit more informal and fluid, and not nearly so much
about people being somehow chained to a dictionary or similar.


even regarding objective reality, there is still some room for disagreement:
competition between conventions and theories;
various ways of interpreting the results of various measurements or
experiments;
....

rarely are things so simply black and white.
 
Reply With Quote
 
BGB
Guest
Posts: n/a
 
      04-21-2012
On 4/20/2012 4:19 PM, Arne Vajhj wrote:
> On 4/20/2012 10:49 AM, Patricia Shanahan wrote:
>> On 4/19/2012 11:27 PM, Tsukino Usagi wrote:
>> ...
>>> 5.length() or 5.size()? Well if 5 is an object I should be able to
>>> over-ride it.
>>>
>>> Class 6 Extends 14 {}

>> ...
>>
>> I'm sure if the literal 6 were mapped to an Object, it would be an
>> instance of Integer or some other final class, preventing overriding.

>
> In C# value types can not be extended.
>
> In Scala value types is a fixed set.
>
> So it seem very likely that int would be final if this
> change were implemented.
>


yes, probably final, and likely more so with the "object" aspects of all
this essentially being faked in the VM as well, because actually
allocating a memory object for every integer would be a bit, expensive.

it could also work out that:
Integer iobj=new Integer(5);

doesn't actually create a new heap object in the first place, it only
appears to do so, and behaves as if it had done so.

this is the great fun of compilers and VMs:
what is going on in the language, and what is going on nearer the actual
HW, need not really be all that similar.
 
Reply With Quote
 
BGB
Guest
Posts: n/a
 
      04-21-2012
On 4/20/2012 11:53 AM, Bernd Nawothnig wrote:
> On 2012-04-20, Roedy Green wrote:
>> On Thu, 19 Apr 2012 18:27:43 -0500, "Nasser M. Abbasi"<(E-Mail Removed)>
>> wrote, quoted or indirectly quoted someone who said :
>>
>>> "Unified type system (JDK 10+)
>>> No more primitives, make everything objects"

>>
>> This is the way Eiffel works,

>
> The same for Python.
>


ironically, in my case I went differently:
the root of the tree is not "objects", it is "variants", of which both
the primitive/value types and objects are subtypes.

variants have the funky behavior that anything can be stored in a
variant (no casting needed), but going the other way may throw an
exception (the language does not require explicit up-casts in most
cases, but is much more inclined to give warnings about them).

an "object" type also exists, but is generally considered an alias for
"variant".

"Object" is not the root of the type-system, it is only the root of the
class hierarchy (the class hierarchy and type-system are not regarded as
equivalent in this language).


the ability to use ".toString()" on pretty much everything still exists
though, except it doesn't currently do much useful for some types (many
types which lack a sensible string representation will show up in a form
like "#<typename:address>", which is the default syntax for anything
lacking a known "toString()" method).


>> but under the covers there are still primitives. Perhaps what they
>> have in mind for Java, more intelligent boxing. At least at the low
>> levels of the JVM you need primitives.

>
> These implementation details should better be hidden and invisible for
> most cases. Let the compiler automatically detect and generate
> possible optimisations.
>
> A programming language should be as simple and orthogonal as possible.
>


actually, I personally think it should be as "useful" and "usable" as
possible, with simplicity and orthogonality coming second.

otherwise, people could be off using very awkward toy languages in the
name of simplicity and orthogonality, and this would hardly be a better
outcome.

so, it is more of a set of trade-offs.
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      04-21-2012
BGB wrote:
> Leif Roar Moldskred wrote:
>> Lew<(E-Mail Removed) wrote:
>>>
>>> How sizeable is this sadly mistaken minority?
>>>
>>> If they all thought the world were flat, would that make them correct?

>>
>> Language isn't defined by an objective physical reality, though, but
>> by usage -- which is why "awful" and "awesome" today have opposite
>> meanings.
>>

>
> yes, and why people might actually disagree regarding the usage of various terms.
>
> for objective reality, people can go and measure and test stuff.
> for language use, it more amounts to consensus, and languages change over time:
> this can be drastic, as in the differences between English and German;
> this can be more subtle, as in the differences between the US California
> dialect and Londoner dialects of English;
> or it can be things like the specific uses of certain terms.
>
> so, it is all a bit more informal and fluid, and not nearly so much about
> people being somehow chained to a dictionary or similar.
>
>
> even regarding objective reality, there is still some room for disagreement:
> competition between conventions and theories;
> various ways of interpreting the results of various measurements or experiments;
> ...
>
> rarely are things so simply black and white.


Fortunately, in today's world, the meanings of "dozen" and "teens" are so
simply black and white. While your statement as a poster-saying superficial
generality is correct, in the particulars of these terms it's sadly mistaken.

--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedi.../c/cf/Friz.jpg
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      04-21-2012
BGB wrote:
> Bernd Nawothnig wrote:
>> Roedy Green wrote:
>>> Nasser M. Abbasi wrote, quoted or indirectly quoted someone who said :
>>>> "Unified type system (JDK 10+)
>>>> No more primitives, make everything objects"
>>>
>>> This is the way Eiffel works,

>>
>> The same for Python.
>>

>
> ironically, in my case I went differently:


How exactly is that ironic?

--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedi.../c/cf/Friz.jpg
 
Reply With Quote
 
BGB
Guest
Posts: n/a
 
      04-21-2012
On 4/21/2012 12:55 PM, Lew wrote:
> BGB wrote:
>> Leif Roar Moldskred wrote:
>>> Lew<(E-Mail Removed) wrote:
>>>>
>>>> How sizeable is this sadly mistaken minority?
>>>>
>>>> If they all thought the world were flat, would that make them correct?
>>>
>>> Language isn't defined by an objective physical reality, though, but
>>> by usage -- which is why "awful" and "awesome" today have opposite
>>> meanings.
>>>

>>
>> yes, and why people might actually disagree regarding the usage of
>> various terms.
>>
>> for objective reality, people can go and measure and test stuff.
>> for language use, it more amounts to consensus, and languages change
>> over time:
>> this can be drastic, as in the differences between English and German;
>> this can be more subtle, as in the differences between the US California
>> dialect and Londoner dialects of English;
>> or it can be things like the specific uses of certain terms.
>>
>> so, it is all a bit more informal and fluid, and not nearly so much about
>> people being somehow chained to a dictionary or similar.
>>
>>
>> even regarding objective reality, there is still some room for
>> disagreement:
>> competition between conventions and theories;
>> various ways of interpreting the results of various measurements or
>> experiments;
>> ...
>>
>> rarely are things so simply black and white.

>
> Fortunately, in today's world, the meanings of "dozen" and "teens" are
> so simply black and white. While your statement as a poster-saying
> superficial generality is correct, in the particulars of these terms
> it's sadly mistaken.
>


http://en.wikipedia.org/wiki/Dozen

as noted, 13, 14, and 10 notions of "dozen" are listed, in addition to
the usual 12.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Default primitive values from primitive Class<?> object. Daniel Pitts Java 7 10-23-2008 04:30 PM
Java reflection with primitive types Zach Java 2 06-08-2005 02:21 AM
Primitive vs. non-primitive l-value richardclay09@yahoo.co.uk C++ 7 05-09-2005 02:52 PM
Creating primitive data types from contents of String Jesper Sahner Java 13 11-16-2004 02:06 AM
Collections API for primitive types =?ISO-8859-1?Q?S=F8ren_Bak?= Java 0 08-27-2003 06:59 PM



Advertisments