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


Groups > de.comp.lang.java > #13392

Re: guter Stil void oder boolean

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups de.comp.lang.java
Subject Re: guter Stil void oder boolean
Date 11 Jul 2022 11:54:13 GMT
Organization Stefan Ram
Lines 42
Expires 1 Apr 2023 11:59:58 GMT
Message-ID <void-20220711125214@ram.dialup.fu-berlin.de> (permalink)
References <1a3b5a2f-84da-4710-978b-c953f1262955n@googlegroups.com> <void-20220709224802@ram.dialup.fu-berlin.de> <void-20220710074558@ram.dialup.fu-berlin.de> <tah1do$c4r$1@newsreader4.netcologne.de>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Trace news.uni-berlin.de 1iNqAwd8PjlT2PPp6vwsWQiJhdLYRhS2blpDKgAQ0o3GHR
X-Copyright (C) Copyright 2022 Stefan Ram. All rights reserved. Distribution through any means other than regular usenet channels is forbidden. It is forbidden to publish this article in the Web, to change URIs of this article into links, and to transfer the body without this notice, but quotations of parts in other Usenet posts are allowed.
X-No-Archive Yes
Archive no
X-No-Archive-Readme "X-No-Archive" is set, because this prevents some services to mirror the article in the web. But the article may be kept on a Usenet archive server with only NNTP access.
X-No-Html yes
Content-Language de-DE
Accept-Language de-DE, en-US, it, fr-FR
Xref csiph.com de.comp.lang.java:13392

Show key headers only | View raw


Patrick Roemer <sangamon@netcologne.de> writes:
>Dass "void" in Java nur ein Pseudotyp ist (eine void-Methode gibt _gar 
>nichts_ zurück, hat also keinen Rückgabetyp), ist eine von C geerbte 
>Eigenheit.

  In C (und C++) /ist/ "void" ein Typ:

|The void type comprises an empty set of values; 
|it is an incomplete object type that cannot be completed.
n2310, 6.2.5p19

  . Java kann das daher nicht von C geerbt haben.

>Ich finde es recht erstaunlich, dass die JLS keine tragfähige Definition 
>für "void" beinhaltet (vielleicht habe ich heute auch nur ganz 
>schlechtes Suchkarma), 

  Die JLS 18 enthält in 8.4.5 alles, was man wissen muß:

|uses the keyword void to indicate that the method does not
|return a value
JLS 18, 8.4.5.

  .

>                       aber ich bin mir sehr sicher, dass die Semantik 
>"diese Methode hat nur Nebeneffekte" ist, und nicht "diese Methode weiss 
>noch nicht so recht, was sie zurückgeben will".

  Du hast recht, was die JLS angeht. Aber hier geht es darum,
  daß jemand für seine persönliche Entwurfssprache die Bedeutung
  von "void" etwas erweitern will. Wie ich schon schrieb, wäre
  ein separater Typ "ToBeSpecified" dafür "sauberer", aber könnte 
  die Schreibweise etwas schwerfälliger machen und zu sehr ablenken.

>...aber empfehlen würde ich dieses Vorgehen sicher nicht - erst denken, 
>dann tippen.

  Woher soll ich wissen, was ich denke, bevor ich lese, was
  ich getippt habe? :)

Back to de.comp.lang.java | Previous | Next | Find similar


csiph-web