Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!news.stack.nl!aioe.org!.POSTED!not-for-mail From: thinbluernime Newsgroups: comp.lang.java.programmer Subject: Re: Java blunders Date: Fri, 25 Jul 2014 04:07:49 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 41 Message-ID: References: NNTP-Posting-Host: i+hccjf+IDuaX49PUP4Bpw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.10 (MacIntel) X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.java.programmer:29296 On Wed, 23 Jul 2014 15:14:34 -0400, Eric Sosman wrote: > I'll also take issue with your use of "semi-supported:" Can you > find a Java implementation anywhere, even one implementation, on which > these operations are *not* supported as described in the JLS? I interpreted that as meaning that the capability exists in the language to do bitwise work with bytes, but that no particular effort was made to facilitate this, and it was allowed to get quite warty, suggesting that it's "supported" at the "it's technically possible" level but not at the "they cared about making this non-horrible to do, or even thought much about it specifically" level. > IMHO Java would be a better language if `switch' were removed > altogether, fall-through or not. But that's just MHO, which (clearly) > is not widely shared. Meanwhile, I oppose anything that encourages the > use of the construct. If Java existed in a vacuum, so one could always use polymorphism instead of "switch", then maybe. But Java does not exist in a vacuum and at the edge it will often be necessary to take a finite set of numbers, strings, or something such as a png compression-type magic number, an enum-like field from a database, or similar and react to that. And that is a place where switch is useful and polymorphism isn't. Switch can even be used to turn "which value was received" to "which class to instantiate" so you can use polymorphism in the rest of the code. switch (compression-ID) { case C_DEFLATE: comp = new Deflater(); break; case C_ZLIB: comp = new ZLib(); break; ... } return decodeRest(bulkOffset, comp, yadda yadda yadda); ... rawData = comp.decompress(myByteBuffer);