This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: JvSynchronize nitpick


Paul Fisher <pnfisher@redhat.com> writes:

> CNI allows for a near seamless transition when switching between
> writing Java and C++ code.  The more seamless we can make that
> transition, the better.

The goal of CNI is seamless access to Java objects and methods
from C++, using *C++ syntax*.  The goal is not to make C++ look like Java.

> For instance, we add a length attribute and overload [] for arrays in
> CNI.  Why not allow the same natural Java construct for `synchronized'
> to be used in C++?

I don't understand where the "same natural Java construct" comes in.
Overloading operator[] is a standard C++ idiom, while
using a dummy object with a finalizer is the standard C++ idiom
for `try'-`finally', of which `synchronized' is a special case.

> We could simply say that `synchronized' is a reserved word when
> writing CNI, just as it is when writing Java.

We could, but I don't see why it would be a good idea.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]