Label: ♦english ♦feature planning

[223] Planned feature: binding interface as prototype

Comment
(As you can probably see, usually I am too lazy to write down my ideas. I used to keep them in my mind for plenty of time until they become clear enough to be written down quickly as implementation codes. But from time to time, I am asked what is the development plans for Dao or what are the planned features. So I might begin to write down some ideas down from time to time. Hope that there will be some interesting feedbacks.)

The following I am going to write is already ready for implementation. It will be a type called interface , which can be related to prototype oriented programming.

An interface is defined as a set of member methods which can be called upon an object. Similar to class , interface will support inheritance, and can declare member methods. But it will not allow implementation of its member methods.

Example,
interface  InterfaceA
{
    routine  Method1();
    routine  Method2(  id  :  int);
}
interface  InterfaceB  :  InterfaceA
{
    routine  Method3();
}

Then one can bind an interface to a class or wrapped C/C++ type (possibly also tuple type) by,
bind  InterfaceA  to  MyClass
bind  InterfaceB  to  MyCxxType

So that, the compatibility of MyClass with InterfaceA will be checked at compiling time. Then at running time, when an instance of MyClass is passed to something that need InterfaceA type, it will only be necessary to check if InterfaceA has been bind to MyClass . In this way, detailed checking of the member methods of MyClass against the interface will not be necessary. In places an InterfaceA is needed, anything (unrelated classes or C/C++ types) has InterfaceA bound to can be used. For running time binding of interfaces, there will be a standard method std.bind() .

Other planned things include more support for operator overloading and bindings to OpenSSL library etc.
Comments

Change picture:

Choose file:

123 4
56 78910 11
121314151617 18
192021222324 25
2627282930

klabim: ... Ok, I found it. It can be so easy by reading the documentation :- ). I have overseen the keyword glob ... (Aug.21,18:09)

klabim: sharing vars between scripts Hi, how can I share a variable between 2 scripts in an embedded environment? For example: script 1: ... (Aug.21,17:55)

This site is powered by Dao
Copyright (C) 2009,2010, daovm.net.
Webmaster: admin@daovm.net