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


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

Re: "Small" Program Challenge.

Path csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail
From "javax.swing.JSnarker" <gharriman@boojum.mit.edu>
Newsgroups comp.lang.java.programmer
Subject Re: "Small" Program Challenge.
Date Wed, 20 Jun 2012 21:15:23 -0400
Organization media lab?
Lines 91
Message-ID <jrtsjc$6s5$1@speranza.aioe.org> (permalink)
References <jrlu9c$eab$2@speranza.aioe.org> <IqxDr.28704$hJ3.24051@newsfe14.iad> <jrmaju$u48$1@news.albasani.net> <7kIDr.12088$Bp1.3039@newsfe10.iad> <c4f82855-8df5-492a-a26d-a8bcebcfcaf1@googlegroups.com> <jro1f5$edb$1@speranza.aioe.org> <c5fbd690-1af5-4427-844f-744ad0991c53@googlegroups.com> <jrofgk$ec6$1@speranza.aioe.org> <cbe27a00-af3b-48f0-82c3-c0f8ab30e1d4@googlegroups.com> <o9nvt71lop4bii7haes51im3884d2ts03k@4ax.com> <jron75$s6k$1@speranza.aioe.org> <4291u795eegvb0j8b09lvqkng3hh13t336@4ax.com> <jrqk0m$e2b$3@speranza.aioe.org> <4732eeb4-9d34-4765-ba6d-c098f0528038@googlegroups.com> <jrr68t$ohi$1@speranza.aioe.org> <UsydnWLZ1Ih_vXzSnZ2dnUVZ8sKdnZ2d@giganews.com> <jrr81g$rt6$1@speranza.aioe.org> <2P2dnb8yuIyntXzSnZ2dnUVZ8hGdnZ2d@giganews.com> <jrrlfc$bfe$1@news.albasani.net>
NNTP-Posting-Host y4noUEMC8u/SvRWFa5JPRw.user.speranza.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
User-Agent NewsTap/3.5.5 (iPhone/iPod Touch)
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com comp.lang.java.programmer:15475

Show key headers only | View raw


On 20/06/2012 1:01 AM, Lew wrote:
> Leif Roar Moldskred wrote:
>> javax.swing.JSnarker wrote:
>>> Leif Roar Moldskred wrote:
>>>>
>>>> As has been pointed out earlier in the thread, that's exactly what
>>>> happens when, with Java 7, you try to start a Java program with a
>>>> class that does not contain a valid main method.
>>>
>>> And as has been pointed out earlier in the thread, that contravenes the
>>> spec, which says initialization occurs *before* invocation.
>
> No, it doesn't contravene the spec. Initialization *does* occur before
> invocation, but not before the attempt to invoke. As the spec explains.

The spec explains no such thing -- fortunately, because it doesn't make 
sense. You cannot separate "the attempt to invoke" from "invocation". 
The two go hand in hand like the attempt to catch a ball and the 
successful catch. How can they not? Until the first byte of the main 
method's bytecode is executing the attempt may or may not be successful; 
success is defined by the main method's bytecode being entered and 
starting to execute! How *else* could one sensibly define the attempt to 
invoke said bytecode? But then initialization *must* precede the attempt 
to not violate the spec, because otherwise it occurs after at least the 
first byte of the main method begins executing. And by then it's too 
late. The main method will see stuff uninitialized that the spec 
requires it never see uninitialized, and there goes your claim to have a 
conformant implementation. And until that moment, the "attempt to 
invoke" is not guaranteed to succeed and is therefore still an attempt 
and not an invocation by your own peculiar worldview in which you regard 
the two as somehow separate.

> The same thing happens in Java 5 (and should have happened in 1.2
> through 1.4), if you refer to the 'class' literal of a class before any
> action that triggers intialization, the class will be loaded but not
> initialized.

How does loading it right away in such cases accomplish anything useful? 
The class literal might as well evaluate to a memory-cheap stub-object 
that is transparently replaced with the real class object when, and only 
when, something is done with it that goes beyond bandying it about, 
printing it, using its monitor, getting its hashcode, or comparing it 
for equality. And the things that would then trigger actual loading also 
are the ones that trigger initialization. Such a scheme would be *much* 
more in what you previously called the "spirit of lazy initialization".

> These are facts which completely undercut "JSnarker"'s claim.

In a pig's eye.

> As does the JLS:

Only by your twisted and, shall we say "unique", interpretation of it.

> See?
>
> There is a point at which a class has been loaded, verified and
> prepared, but not initialized.

Nothing in that says that that circumstance should be anything but very 
brief, and it's clear that it must exist *at least* very briefly as 
loading obviously must precede initialization.

> As for the process happening upon an attempt to invoke, here's language
> from 12.1.1:
>
> "The initial attempt to execute the method main of class Test discovers
> that the class Test is not loaded ..."
>
> Where's your temporal sequence now, O Snarky One? As I have stated and
> you have obstinately rejected repeatedly, the loading (if not yet done)
> and initialization occurs upon the attempt to invoke, i.e., the attempt
> happens first, conceptually.

What it says is that an attempt is made and fails because the class is 
not both loaded and initialized. It is loaded, if necessary, and 
initialized, and then a fresh attempt is automatically made. THAT 
attempt may then succeed, or fail for other reasons, such as the method 
doesn't exist.

> Read the JLS and understand.

Already did that. Still waiting for you to practice what you preach, thoguh.

-- 
public final class JSnarker
extends JComponent
A JSnarker is an NNTP-aware component that asynchronously provides 
snarky output when the Ego.needsPuncturing() event is fired in cljp.

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


Thread

"Small" Program Challenge. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-13 13:45 -0700
  Re: "Small" Program Challenge. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-13 13:52 -0700
    Re: "Small" Program Challenge. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-13 16:17 -0700
      Re: "Small" Program Challenge. glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-06-14 00:16 +0000
    Re: "Small" Program Challenge. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-13 16:19 -0700
      Re: "Small" Program Challenge. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-13 16:24 -0700
    Re: "Small" Program Challenge. markspace <-@.> - 2012-06-13 17:40 -0700
  Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-13 21:28 -0400
  Re: "Small" Program Challenge. Roedy Green <see_website@mindprod.com.invalid> - 2012-06-13 20:52 -0700
    Re: "Small" Program Challenge. "Hiram Hunt" <hiramhunt@verizon.net> - 2012-06-14 08:23 -0400
      Re: "Small" Program Challenge. "Hiram Hunt" <hiramhunt@verizon.net> - 2012-06-14 08:30 -0400
    Re: "Small" Program Challenge. Arne Vajhøj <arne@vajhoej.dk> - 2012-06-17 21:17 -0400
  Re: "Small" Program Challenge. Paul Cager <paul.cager@googlemail.com> - 2012-06-14 02:32 -0700
  Re: "Small" Program Challenge. Bent C Dalager <bcd@pvv.ntnu.no> - 2012-06-14 11:29 +0000
  Re: "Small" Program Challenge. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-14 12:50 -0700
  Re: "Small" Program Challenge. Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-06-14 15:49 -0500
  Re: "Small" Program Challenge. Gene Wirchenko <genew@ocis.net> - 2012-06-14 14:56 -0700
  Re: "Small" Program Challenge. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-14 17:02 -0700
  Re: "Small" Program Challenge. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-14 17:09 -0700
  Re: "Small" Program Challenge. Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2012-06-15 22:13 -0700
    Re: "Small" Program Challenge. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-16 12:11 -0700
  Re: "Small" Program Challenge. Wanja Gayk <brixomatic@yahoo.com> - 2012-06-17 15:22 +0200
    Re: "Small" Program Challenge. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-17 15:24 -0700
      Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-17 18:25 -0400
        Re: "Small" Program Challenge. Arne Vajhøj <arne@vajhoej.dk> - 2012-06-17 20:31 -0400
          Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-17 20:55 -0400
            Re: "Small" Program Challenge. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-17 20:40 -0700
              Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-17 23:43 -0400
              Re: "Small" Program Challenge. Lew <noone@lewscanon.com> - 2012-06-17 21:25 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-18 00:45 -0400
                Re: "Small" Program Challenge. Lew <lewbloch@gmail.com> - 2012-06-18 12:47 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-18 15:57 -0400
                Re: "Small" Program Challenge. Lew <lewbloch@gmail.com> - 2012-06-18 13:31 -0700
                Re: "Small" Program Challenge. Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-06-18 16:05 -0500
                Re: "Small" Program Challenge. Lew <lewbloch@gmail.com> - 2012-06-18 14:18 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-18 19:50 -0400
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-18 19:48 -0400
                Re: "Small" Program Challenge. David Lamb <dalamb@cs.queensu.ca> - 2012-06-19 08:07 -0400
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-19 15:26 -0400
                Re: "Small" Program Challenge. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-18 09:04 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-18 13:09 -0400
                Re: "Small" Program Challenge. markspace <-@.> - 2012-06-18 11:06 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-18 14:46 -0400
                Re: "Small" Program Challenge. markspace <-@.> - 2012-06-18 13:22 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-18 19:51 -0400
                Re: "Small" Program Challenge. Wanja Gayk <brixomatic@yahoo.com> - 2012-06-20 13:11 +0200
                Re: "Small" Program Challenge. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-22 12:54 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-22 18:30 -0400
                Re: "Small" Program Challenge. Lew <lewbloch@gmail.com> - 2012-06-25 12:59 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-25 16:49 -0400
                Re: "Small" Program Challenge. Lew <lewbloch@gmail.com> - 2012-06-18 12:44 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-18 16:01 -0400
                Re: "Small" Program Challenge. Lew <lewbloch@gmail.com> - 2012-06-18 13:36 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-18 20:01 -0400
                Re: "Small" Program Challenge. Lew <lewbloch@gmail.com> - 2012-06-18 18:25 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-18 22:01 -0400
                Re: "Small" Program Challenge. Gene Wirchenko <genew@ocis.net> - 2012-06-18 19:04 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-18 22:12 -0400
                Re: "Small" Program Challenge. Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-06-19 12:36 +0000
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-19 15:28 -0400
                Re: "Small" Program Challenge. Gene Wirchenko <genew@ocis.net> - 2012-06-19 09:12 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-19 15:30 -0400
                Re: "Small" Program Challenge. Gene Wirchenko <genew@ocis.net> - 2012-06-19 15:04 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-19 18:23 -0400
                Re: "Small" Program Challenge. Gene Wirchenko <genew@ocis.net> - 2012-06-19 15:32 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-19 19:09 -0400
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-19 19:10 -0400
                Re: "Small" Program Challenge. Lew <lewbloch@gmail.com> - 2012-06-19 17:19 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-19 20:42 -0400
                Re: "Small" Program Challenge. Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-06-19 20:01 -0500
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-19 21:12 -0400
                Re: "Small" Program Challenge. Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-06-19 20:32 -0500
                Re: "Small" Program Challenge. Lew <noone@lewscanon.com> - 2012-06-19 22:01 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-20 21:15 -0400
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-20 21:05 -0400
                Re: "Small" Program Challenge. Wanja Gayk <brixomatic@yahoo.com> - 2012-06-23 13:42 +0200
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-23 12:12 -0400
                Re: "Small" Program Challenge. Wanja Gayk <brixomatic@yahoo.com> - 2012-06-23 23:10 +0200
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-23 17:14 -0400
                Re: "Small" Program Challenge. Lew <noone@lewscanon.com> - 2012-06-19 22:15 -0700
                Re: "Small" Program Challenge. Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-06-20 10:34 +0000
                Re: "Small" Program Challenge. Lew <lewbloch@gmail.com> - 2012-06-20 10:45 -0700
                Re: "Small" Program Challenge. Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-06-21 08:13 +0000
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-21 17:18 -0400
                Re: "Small" Program Challenge. Lew <lewbloch@gmail.com> - 2012-06-21 15:30 -0700
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-21 20:28 -0400
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-20 21:22 -0400
                Re: "Small" Program Challenge. "javax.swing.JSnarker" <gharriman@boojum.mit.edu> - 2012-06-20 21:19 -0400

csiph-web