Java initializer block syntax
Damien Cassou
damien.cassou at gmail.com
Wed Oct 10 09:29:03 UTC 2007
Hi,
thanks to all. I absolutely do not want Smalltalk to have this
"feature" :-). I was just wondering.
If I asked here, it's because I noticed that people who know Java very
well are often Smalltalkers :-).
Bye
2007/10/9, Jason Johnson <jason.johnson.081 at gmail.com>:
> Well, that's basically instance variable declarations and methods to
> initialize them as I recall. That is, I don't think you can call a
> "side effects only" function there.
>
> But in any case, what brings it up? Are you wishing Smalltalk had
> this? Because personally I like the way Smalltalk world works as
> apposed to the C++/Java world of magic functions getting implicitly
> called in orders one must memorize.
>
> In Smalltalk there are (normally) functions getting called on creation
> but you don't have to memorize it, it's in the code where you can read
> it.
>
> On 10/9/07, Damien Cassou <damien.cassou at gmail.com> wrote:
> > Hi,
> >
> > I discovered that the following syntax is valid Java code:
> >
> > class A {
> >
> > {
> > /* any java code here */
> > }
> >
> > }
> >
> >
> > This code will be executed just before the constructor. I haven't
> > found any use for this syntax, even in the case of subclasses.
> >
> > Does anyone have any idea or is it just useless?
> >
> > --
> > Damien Cassou
> >
> >
>
>
--
Damien Cassou
More information about the Squeak-dev
mailing list
|