Article View: borland.public.jbuilder.java.language
Article #14890Re: Illogical constructor behaviour?
From: Tor Iver Wilhelmsen
Date: Mon, 26 Jul 1999 00:00
Date: Mon, 26 Jul 1999 00:00
30 lines
1968 bytes
1968 bytes
Tom.Eugelink@OVSoftware.com writes:
> The last one, 2b, I do not agree with: I am making a difference in
> initialization by placing the initialisation code outside of the
> constructor. So then it is defendable to also treat it differently.
But the only _reasonable_ way to treat it would be to flag it as an
error: Either you have some automagic which moves it into the
constructor in a known manner (as today), _or_ you define that all
initialization need ne explicified by the programmer where they want
it - in the constructor or an invoked method.
Creating your own initialization mechanism in order to control
sequencing (that is, have no initialization in the constructor itself)
can be confusing to someone else taking over the project... :-)
(As an aside: The language lets you do a lot of things in "shorthand"
which is turned into some rather ugly code in the .class files: For
instance, the statement
int[] foo = { 1, 2, 3 };
is turned into the bytecode equivalents of doing
int[] _tmp = new int[3];
_tmp[0] = 1;
_tmp[1] = 2;
_tmp[2] = 3;
foo = _tmp;
)
Technical Details
Message-ID:
<upv1fol0d.fsf@sds.no>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3789a7ea.1163072@forums.inprise.com> <uzp1241hv.fsf@sds.no> <378adee2.3105084@forums.inprise.com> <uhfn8aph8.fsf@sds.no> <378c7224.5379925@forums.inprise.com> <MPG.11f734ffaf88e14d989683@forums.inprise.com> <3792d12a.4122557@forums.inprise.com> <upv1osstw.fsf@sds.no> <379424a2.91026959@forums.inprise.com> <u1ze3g3bj.fsf@sds.no> <3796c981.4100195@forums.inprise.com> <uogh59kck.fsf@sds.no> <379c0a08.3224616@forums.inprise.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,c150801d0979e255 X-Google-Attributes: gidf74b3,public From: Tor Iver Wilhelmsen <tor.wilhelmsen@sds.no> Subject: Re: Illogical constructor behaviour? Date: 1999/07/26 Message-ID: <upv1fol0d.fsf@sds.no> X-Deja-AN: 505311882 Sender: towi@SDSA1761 References: <3789a7ea.1163072@forums.inprise.com> <uzp1241hv.fsf@sds.no> <378adee2.3105084@forums.inprise.com> <uhfn8aph8.fsf@sds.no> <378c7224.5379925@forums.inprise.com> <MPG.11f734ffaf88e14d989683@forums.inprise.com> <3792d12a.4122557@forums.inprise.com> <upv1osstw.fsf@sds.no> <379424a2.91026959@forums.inprise.com> <u1ze3g3bj.fsf@sds.no> <3796c981.4100195@forums.inprise.com> <uogh59kck.fsf@sds.no> <379c0a08.3224616@forums.inprise.com> Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language