On Mon, 13 May 2013 09:03:08 +0200 Jacob Carlborg <d...@me.com> wrote:
> On 2013-05-12 23:16, Nick Sabalausky wrote: > > > I *could* push that to the main mysql-native master repo right now > > <https://github.com/rejectedsoftware/mysql-native>. But I'm hesitant > > for one reason: > > > > 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. > > > > That is the only breaking change, but depending how your code uses > > mysql-native, it can be a very significant breaking change. > > Why don't you just relay on a version flag? Is it really necessary to > change this at runtime? > As this is intended as a "core-ish" low-level lib for any MySQL-client needs, I didn't want to unduly preclude any potential use-cases, even if it's not a typical use-case. However, since it isn't a typical use-case, maybe what I'll do is this: - Use new names for all of the newly templated types: Ex: 'Connection' becomes 'ConnectionX!mySQLSocketVibeD' and 'ConnectionX!mySQLSocketPhobos'. - Require a -version to specify which socket type is the default, and then set up backwards-compatible aliases. So for example, if '-version=MySQLN_DefaultSocketVibeD' is used, then 'Connection' (for example) is defined as an alias to 'ConnectionX!mySQLSocketVibeD'. - If a unified socket interface ever emerges, and obviates the needs for the templates, then these -version idents can just simply be ignored and output "that -version is no longer needed" pragma messages.