On Wed, Dec 15, 2021 at 12:10 PM Dan Smith <daniel.sm...@oracle.com> wrote:

Yes, this is a good list. Add to it:
> - They are named with a lower-case keyword
> - They exclusively get to use special operators (for now)
>

(Well that parenthetical turns my blood cold....)
Leaning away from that though: I'm most worried about ==/!= because they
are overloaded across ALL types, of all kinds, and including types that
will be migrating behind the scenes. All the combinations here seem like
potential Puzzler-Whack-A-Mole. But the only thing for it is to sit down
and look at the whole matrix...


My high-level response to "primitive=one of 8 types" is that it may be
> giving the good name to, and drawing attention to, something that doesn't
> matter much. Sure, we'll need to specify a distinction for the purpose of
> the things on the list, but I don't think most programmers should really
> care whether the value they're working with belongs to one of the 8 special
> types or not.
>

I'm not sure "primitive" IS the good name. Maybe "value" is the good name?
Agreed that most programmers most of the time can interact with all
"molecules" in the same consistent way, and that is very good.
But I don't think the need for the concept ever fades *too* far into the
background. A mental graph needs leaves.
If the concept is still needed *sometimes*, then I think it's a problem if
the term you always knew that concept by got taken away.


- Circular declarations: less than 100 people in the world need to care
> about this (maybe exaggerating)
>

Oh, many more people will want to understand how we square that circle than
have any absolute technical need to. They'll wake up one night thinking
"wait, what the hell is an int made of then?" As they descend into that pit
we want them to hit some simple workable explanation they can bounce off of
and get back to work.

Something like "the contents of a value are either (a) the other values
they contain (see their fields), or (b) for primitives, the contents
defined by the platform itself (see no fields)".

(At least I believe an `int` class would not need or want a `value` field
since it can just use `this` for that... right?)



> So we're left with, for most Java programmers, a set of special types that
> get spelled with keywords and get some special behavior in the reflection
> API. My initial sense is that's not enough to put them in their own
> different-noun category.
>

Example: many usages of Class.isPrimitive() are basically recursing an
object graph and simply need to know where to stop.
Did we hit bottom or not? It's a basic kind of question.



> Meanwhile, if we can tell programmers "primitives have members/classes
> now, and libraries can define additional primitives", that can build on
> existing intuitions pretty well. For example, the primitive type/reference
> type duality still exists, and pretty much works the same. Asking them to
> do s/primitive type/value type/ in this context is its own Indiana Jones
> maneuver.
>

Obviously I see it as meaningfully different from an Indiana Jones
maneuver, and wouldn't have used the term if I didn't.

On an island where only pear trees grow they wouldn't have a word for
"fruit".
A traveler comes, "here, these are apples".
Well, they're going to make a word for fruit.
Most times they used to say "pear", it was really the fruitness that
mattered.
They start saying "fruit" more than "pear". They still need the word "pear"
sometimes.

Contrast: traveler says "here, these are pears."
"What?"
"These are the apple kind of pears, and what you have are heritage pears."
For a while no one knows what the hell "bring me a pear" means anymore.
Also, for some reason everyone is being chased by a giant spherical boulder.

One feels more destabilizing than the other.

-- 
Kevin Bourrillion | Java Librarian | Google, Inc. | kev...@google.com

Reply via email to