On Sunday, 12 May 2013 at 21:16:33 UTC, Nick Sabalausky wrote:
There is need for mysql-native
<https://github.com/rejectedsoftware/mysql-native> to support both
Vibe.d's sockets and Phobos sockets.

Since Phobos's and Vibe.d's sockets have incompatible APIs, my design converts most of the types in mysql-native into templates. For example,
'Connection' becomes either 'Connection!mySQLSocketVibeD' or
'Connection!mySQLSocketPhobos'. The type 'Command' becomes either 'Command!mySQLSocketVibeD' or 'Connection!mySQLSocketPhobos'. And the
same goes for most other types, such as Row, ResultSet, etc.


Does "incompatible APIs" preclude a design like this?

-----
interface MysqlSocket {
    // ...
}

class PhobosSocket : MysqlSocket {
    this(std.socket.Socket _backend) {
        // ...
    }
    // ...
}

class VibeSocket : MysqlSocket {
    this(vibe.core.net.TCPConnection _backend) {
        // ...
    }
}
-----

Sorry if I've overlooked anything obvious,
NMS

Reply via email to