[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-dbus
Subject:    Re: novehrady discussions
From:       Matthias Ettrich <ettrich () trolltech ! com>
Date:       2003-08-29 15:57:29
Message-ID: 200308291757.29223.ettrich () trolltech ! com
[Download RAW message or body]

On Friday 29 August 2003 12:00, Waldo Bastian wrote:
>
> DCOP allows overloading but it is cumbersome in combination with scripting
> languages that don't have strong typing. Life is easier without
> overloading.
>

Even then the second argument remains: having the argument types mangled into 
the function name allows to lookup a method and check the types at the same 
time. 

But I'm not sure I agree with Waldo. Scripting languages have dynamic types, 
and overloads are a static way of expressing similar things in a C++ 
interface without creating dynamic code (like e.g. using a variant).

Imagine an interface with two overloads:

 setValue(string)
 setValue(int)

The script could just pick the first one (or the second one) and it wouldn't 
matter. An interpreter typically has no problems casting back and forth 
between int and string.

Overloads are also very useful to express default arguments. A script 
interpreter should have no problems picking the right function from the dbus 
interface based on the number of arguments, even if it does not support 
overloads itself, only calls with a variable number of arguments.


Matthias

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic