Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 09-05-2006
Sameerrele's Avatar
Sameerrele Sameerrele is offline
Registered User
 
Name: Sameer Rele
Organization: TRG
Project: SOA
 
Join Date: Aug 2006
Location: New York
Posts: 18
Overloading functions in slice

I am trying to understand Ice and the underlying architecture and would appreciate any help in the following matter

My slice file is
module com
{
module xxx
{
module foo
{
module service
{
interface SomeService
{
bool isValidTradeDate(string country, string date ) ;
bool isValidTradeDate(string country, string date, string dateFormat ) ;
};
};
};
};
};


As you can see I am trying to overload the function isValidTradeDate by passing dateformat as extra parameter

When I run
c:\Ice-3.1.0\bin\slice2java --output-dir c:\kill\src someservice.ice

I get the following error

someservice.ice:12: redefinition of operation `isValidTradeDate' as operation `isValidTradeDate'


How do I overload a function? Is it supported?

If this is a stupid question please educate me.

Thanks
__________________
Sameer Rele
Global Enterprise Solutions Architect

The Rohatyn Group
280 Park Avenue, 27th Floor - West
New York, NY 10017
Tel : (212) 984 2946
sameer.rele@rohatyngroup.com
Reply With Quote
  #2 (permalink)  
Old 09-05-2006
mes's Avatar
mes mes is online now
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 976
Hi Sameer,

Slice does not support overloaded operations because not all target languages support function overloading (such as Python). You'll need to use a different name for each version of the operation.

Take care,
- Mark
Reply With Quote
  #3 (permalink)  
Old 09-05-2006
Sameerrele's Avatar
Sameerrele Sameerrele is offline
Registered User
 
Name: Sameer Rele
Organization: TRG
Project: SOA
 
Join Date: Aug 2006
Location: New York
Posts: 18
Mark,

Thanks for the prompt reply

Regards
__________________
Sameer Rele
Global Enterprise Solutions Architect

The Rohatyn Group
280 Park Avenue, 27th Floor - West
New York, NY 10017
Tel : (212) 984 2946
sameer.rele@rohatyngroup.com
Reply With Quote
  #4 (permalink)  
Old 09-05-2006
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
Quote:
Originally Posted by mes
Hi Sameer,

Slice does not support overloaded operations because not all target languages support function overloading (such as Python). You'll need to use a different name for each version of the operation.

Take care,
- Mark
In addition, allowing operation overloading would also make the Ice protocol much more complicated, because you could not only simply transfer the operation name, but would have to transfer the signature of the operation as well, so that the server knows which version of the operation to call.
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
Code for unmarshaling functions aseco Help Center 1 04-15-2005 08:50 AM
Limitations of Overloading operations Venkat Seeth Help Center 5 02-18-2005 11:19 AM
Static Functions acbell Help Center 5 02-17-2005 10:54 PM
Idle functions possible? coke Help Center 1 01-26-2005 04:34 PM
Need these functions: motoyang Comments 1 11-23-2004 04:24 PM


All times are GMT -4. The time now is 11:53 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.