Re: attributes in CORBA IDL

At 08:11 AM 6/30/2003, Philippe Le Hegaret wrote:
>On Mon, 2003-06-30 at 00:03, Sanjiva Weerawarana wrote:
> > "Savas Parastatidis" <Savas.Parastatidis@newcastle.ac.uk> writes:
> > >
> > > That was exactly what I was trying to get across. WSDL is the IDL for
> > > Web Services. With WSDL you can write interfaces as you can with IDL.
> > > WSDL is not the place to specify specific operations.
> > >
> > > .savas.
> >
> > Sorry, I don't understand what you're saying.
> >
> > In IDL, if you say "attribute string foo" its simply another way
> > of saying "string getFoo ()" and "void setFoo (string)".
>
>Not exactly, this depends on the bindings in use. Java doesn't support
>attributes in interfaces, so it will get translated into get/set.  C#
>will expose them as properties (with set{} throwing an exception for
>readonly ones).

Not not exactly :-)

The IDL specification says that use of the key word "attribute" is 
equivalent to defining a getter and setter operation. What is left to the 
language binding is the signature of the getter and setter (if not 
readonly) as operations.  That is, they have the same semantics as defining 
an IDL operation with the "correct" name and signature. In languages like 
Java, which support overloading, most of the language bindings generate 
overloading methods. In languages like C which don't, they generate 
something like long _get_foo() and void _set_foo(long l).

The semantics are defined to be the SAME AS if an IDL operation were defined.

The real reason it's left to the language bindings is to make sure that 
there are no name clashes in the target programming language.

I will quote from the IDL spec itself since people keep misinterpreting:

"An interface can have attributes as well as operations; as such, 
attributes are defined as
part of an interface. An attribute definition is logically equivalent to 
declaring a pair of
accessor functions; one to retrieve the value of the attribute and one to 
set the value of
the attribute."

And later:
"The actual accessor function names are language-mapping specific. The 
attribute name
is subject to OMG IDL's name scoping rules; the accessor function names are
guaranteed not to collide with any legal operation names specifiable in OMG 
IDL."

This really is very simple and straightforward. Don't keep trying to 
complicate it by bringing in other definitions of what attributes may or 
may not be or mean.

It really is pure syntactic sugar, nothing more, nothing less.

jeff

> > Without such an approach, there's no way to implement a stub
> > so that it knows what to do when someone wants to read the attribute.
> >
> > WSDL as the IDL for Web services should presumably support the same
> > model for attributes: an attribute x in WSDL means that the service
> > offers getx() and maybe setx() (if the attr is readonly).
>
>... or an HTTP GET (and PUT if the attribute is not read-only).
>
>Philippe

Received on Monday, 30 June 2003 22:18:32 UTC