Path: csiph.com!weretis.net!feeder8.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Mostowski Collapse Newsgroups: comp.lang.java.programmer Subject: Re: JSR 401 Date: Thu, 1 Apr 2021 16:44:10 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 1 Apr 2021 14:44:11 -0000 (UTC) Injection-Info: solani.org; logging-data="28328"; mail-complaints-to="abuse@news.solani.org" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:60.0) Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.7 In-Reply-To: X-User-ID: eJwNyEkBwDAIBEBL4QY5YQP+JbTzHBMnR6ibq61tvDLFGyzjKs7kRXB621IU0TREktrD5PV/KS17k7mOYOYDbhoV9g== Cancel-Lock: sha1:DRyxXirh44pcBXP3DGfLXsD8Gvg= Xref: csiph.com comp.lang.java.programmer:39678 LoL Eric Sosman schrieb: > > Has anyone else studied the working drafts of the forthcoming JSR 401? > It's an attempt to unify "primitives" and "objects" in a future Java, > making it possible to have a List instead of List, or a > Map instead of Map, and so on. It would > also allow arrays of generic types, like JList[], relieving an > irritation that's nagged us since the dawn of generics. > > But there's a drawback: Although arrays of objects (even of generic > types) will work, arrays of primitives would no longer be possible! > That is, you could no longer create or use an int[], but would need > to use something like an ArrayList instead. I'm not intimate > with the inner workings of the JVM and I fail to understand some of > the problems the working papers describe, but it has something to do > with the fact that an array knows the type of its elements and a > primitive doesn't actually have a "type" in the sense of belonging to > a class hierarchy. > > Unless I've misunderstood (I *hope* I've misunderstood!), this is both > surprising and dismaying. "Surprising" because the principal author of > this section of the JSR is Pola Flori, who's worked on earlier JSR's > that were scrupulous about maintaining backwards compatibility. Also > "dismaying" because of the likely memory bloat and performance impact > of replacing your double[][] matrix with a List> and so > on. A BufferedImage that today likely stores pixels in an int[] would > instead need to use a List or something of that kind. I can't > imagine that this would be a Good Thing ... > > But as I say, I may have misunderstood. I hope someone more familiar > with JVM internals and more adept at decoding JSL-style language will > study the proposed JSR and tell me I'm completely wrong. It's a work > in progress rather than an official JSR, so you'll find it hosted at > > https://enterrasolutions.com/wp-content/uploads/2019/04/000156-0021-000078_2.png > >