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


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

Re: Forward references

Path csiph.com!aioe.org!.POSTED!not-for-mail
From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: Forward references
Date Sun, 2 Oct 2016 19:59:53 -0400
Organization Aioe.org NNTP Server
Lines 27
Message-ID <nss71q$btl$1@gioia.aioe.org> (permalink)
References <C-20161002162949@ram.dialup.fu-berlin.de>
NNTP-Posting-Host PBuS014lhzVyHjLbXmo/ZQ.user.gioia.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com comp.lang.java.programmer:35695

Show key headers only | View raw


On 10/2/2016 11:45 AM, Stefan Ram wrote:
>   An old C compiler from the 70s is a one-pass compiler IIRC,
>   so it does not do "forward references".
>
>   I am used so much to this, that I actually was not sure
>   whether in Java the following program is correct:
>
> class A implements B {}
>
> interface B {}

>   In the first line, we use an interface that will be
>   define only later!
>
>   Turns out, Java accepts this.

I am not surprised.

javac take a sort of global approach to compilation.

And I am pretty sure that you have written code where
A refer to B and B refer to A. And it worked fine
without any special declarations.

Arne

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


Thread

Re: Forward references Arne Vajhøj <arne@vajhoej.dk> - 2016-10-02 19:59 -0400

csiph-web