Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #37466

Re: underscore as keyword in Java 9

Newsgroups comp.lang.java.programmer
Date 2017-09-25 13:21 -0700
References <slrnoscj1i.ijn.avl@logic.at> <oq635r$alr$1@news.albasani.net> <0b855e3b-6966-4f3b-bfdb-0863c64d7e39@googlegroups.com>
Message-ID <e644fe0e-195a-48ea-92aa-ef610af6d647@googlegroups.com> (permalink)
Subject Re: underscore as keyword in Java 9
From lewbloch@gmail.com

Show all headers | View raw


Eric Douglas wrote:
> 
> I don't see the point to _ as a placeholder for a value passed in or out of a method in an OO language.
> 
> Passing in if we don't want to pass a parameter we either have an overload for the method to default that parameter or pass in a dummy value such as null for an object or -1 for primitive number.
> 
> Passing out if you don't need that parameter don't reference it.  To pass out more than one we can use a native array[], a List object, a built in multi-value object ie java.awt.Point, or a custom object.
> 
> I'm sure I've never used _ by itself, so if it doesn't affect _variable or _method we should be fine.  I normally write catch (Exception e) even if I never reference the e variable within the block.

The JLS tells us that identifier characters include "for historical reasons, the ASCII underscore". That "for historical reasons" is a hint that one should not use it for current code, other than in constant variable names and not as the first character.

The style conventions, if followed, would prevent any difficulty from a repurposing of the identifier `_`. But no one cares about coding conventions, so now they're whining.

Kinda like those folks who used non-public APIs like `Unsafe` then complained when the usage turned out to be, well, unsafe.

I find it difficult to be sympathetic to those who abuse the system then complain when the abuse becomes untenable.

-- 
Lew

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

underscore as keyword in Java 9 Andreas Leitgeb <avl@logic.at> - 2017-09-23 11:58 +0000
  Re: underscore as keyword in Java 9 j4n bur53 <janburse@fastmail.fm> - 2017-09-23 18:46 +0200
    Re: underscore as keyword in Java 9 Arne Vajhøj <arne@vajhoej.dk> - 2017-09-23 21:01 -0400
      Re: underscore as keyword in Java 9 Andreas Leitgeb <avl@logic.at> - 2017-09-24 11:25 +0000
        Re: underscore as keyword in Java 9 j4n bur53 <janburse@fastmail.fm> - 2017-09-24 17:30 +0200
        Re: underscore as keyword in Java 9 Arne Vajhøj <arne@vajhoej.dk> - 2017-09-24 18:24 -0400
          Re: underscore as keyword in Java 9 Andreas Leitgeb <avl@logic.at> - 2017-09-24 23:27 +0000
            Re: underscore as keyword in Java 9 Arne Vajhøj <arne@vajhoej.dk> - 2017-09-24 21:10 -0400
              Re: underscore as keyword in Java 9 Andreas Leitgeb <avl@logic.at> - 2017-09-25 13:30 +0000
    Re: underscore as keyword in Java 9 Eric Douglas <e.d.programmer@gmail.com> - 2017-09-25 08:07 -0700
      Re: underscore as keyword in Java 9 lewbloch@gmail.com - 2017-09-25 13:21 -0700
      Re: underscore as keyword in Java 9 Silvio <silvio@internet.com> - 2017-09-25 23:30 +0200
        Re: underscore as keyword in Java 9 Arne Vajhøj <arne@vajhoej.dk> - 2017-09-25 20:24 -0400
          Re: underscore as keyword in Java 9 j4n bur53 <janburse@fastmail.fm> - 2017-09-26 13:37 +0200
          Re: underscore as keyword in Java 9 Silvio <silvio@internet.com> - 2017-09-27 19:05 +0200
            Re: underscore as keyword in Java 9 Eric Douglas <e.d.programmer@gmail.com> - 2017-09-27 10:25 -0700
              Re: underscore as keyword in Java 9 Silvio <silvio@internet.com> - 2017-09-27 23:02 +0200
            Re: underscore as keyword in Java 9 Arne Vajhøj <arne@vajhoej.dk> - 2017-09-27 20:02 -0400
              Re: underscore as keyword in Java 9 Eric Douglas <e.d.programmer@gmail.com> - 2017-09-28 05:11 -0700
                Re: underscore as keyword in Java 9 Arne Vajhøj <arne@vajhoej.dk> - 2017-09-28 20:42 -0400
          Re: underscore as keyword in Java 9 Sebastian <nowhere@nirvana.org> - 2017-09-27 20:26 +0200
            Re: underscore as keyword in Java 9 Silvio <silvio@internet.com> - 2017-09-27 23:10 +0200
        Re: underscore as keyword in Java 9 Andreas Leitgeb <avl@logic.at> - 2017-09-26 08:29 +0000
          Re: underscore as keyword in Java 9 Silvio <silvio@internet.com> - 2017-09-27 19:08 +0200
          Re: underscore as keyword in Java 9 Sebastian <nowhere@nirvana.org> - 2017-09-27 21:46 +0200
  Re: underscore as keyword in Java 9 Eric Douglas <e.d.programmer@gmail.com> - 2017-09-27 06:53 -0700
    Re: underscore as keyword in Java 9 Andreas Leitgeb <avl@logic.at> - 2017-09-27 15:59 +0000
      Re: underscore as keyword in Java 9 Arne Vajhøj <arne@vajhoej.dk> - 2017-09-27 19:18 -0400
        Re: underscore as keyword in Java 9 Daniele Futtorovic <da.futt.news@laposte.net> - 2017-09-28 11:41 +0200

csiph-web