Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 11-26-2003
chaukmean chaukmean is offline
Registered User
 
 
Join Date: Nov 2003
Posts: 8
Semantics of pass by value for interface

Hi,

I'm a bit confused with the semantics of pass by value for an interface.
For a class, the semantics of pass by value and pass by reference (proxy) is easily understandable.
For an interface (remote) that is not implemented by a class, what is the meaning of transmitting this interface by value.
All examples from the documentation use the pass by reference for an interface but it is not stated that the pass by value is forbidden.
Furthermore, the slice compiler doesn't reject such definitions.

Chauk-Mean.
Reply With Quote
  #2 (permalink)  
Old 11-26-2003
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
It is always possible to derive a class from an interface, therefore transferring an interface must be allowed by Slice. Consider:

interface MyOps implements MyObj
{
// My operations...
};

class MyObjImplOne implements MyObj
{
// State...
};

class MyObjImplTwo implements MyObj
{
// Different state...
};

In this case, you have two different implementations for MyObj, with different state. In such case you might want to do something like this:

MyObj getMyObj();

The server could send you either of the two, as long as you have a factory for both in your client.
Reply With Quote
  #3 (permalink)  
Old 11-27-2003
chaukmean chaukmean is offline
Registered User
 
 
Join Date: Nov 2003
Posts: 8
Thanks for the reply.

I was initially surprised by the interface that is able to implement something :-) !

But what makes me understand the whole thing is that "an interface can always be implemented by a class".

I suggest that the ICE documentation contains some additional information regarding this feature, something in the SCLICE class description like :
"As a SLICE interface can be implemented by a SCLICE class, it is legal to pass a SLICE interface by value. A runtime exception may be thrown if the type doesn't actually support the pass by value semantics."

Furthermore, in order to ease the understanding for CORBA programmers like me, I suggest to add the following clarification in the section comparing SLICE and CORBA IDL :
"In CORBA, an interface is always passed by reference and a valuetype is always passed by value. A valuetype may be passed by reference through one of its supported interface.
Conversely, SLICE interface and class can be passed by value and by reference (through the use of the proxy operator *)."

Chauk-Mean.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
name.Endpoints semantics mwilson Help Center 1 07-18-2005 05:11 PM
nonmutating semantics precision needed annekat Help Center 4 08-05-2004 05:20 AM
bug when pass a class by value damingyipai Bug Reports 2 04-02-2004 03:51 AM
semantics of slice2java --depend manfred Bug Reports 0 05-21-2003 03:49 AM
Documentation : At-most-once Semantics dipakyadav Bug Reports 4 02-21-2003 06:16 AM


All times are GMT -4. The time now is 11:40 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.