JvSynchronize nitpick

Per Bothner per@bothner.com
Wed Mar 29 08:27:00 GMT 2000

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/

More information about the Java mailing list