11/25/2012 3:05 AM, Manu пишет:
On 24 November 2012 23:18, Andrej Mitrovic <[email protected]
<mailto:[email protected]>> wrote:
I used to be *for* putting WinAPI bindings into druntime/phobos. But
seeing how some pull requests take months to be merged, and Walter's
ultra stance on not adding any aliases that help with code readability
(A vs W functions), and the obsessive requirement for Phobos to be
composed out of massive single modules, I'm beginning to think that
keeping the API out of Phobos might actually be a good idea.
I'm sure it would be merged. And aren't the windows bindings in druntime?
WINAPI is decades old, it will never change, it will never need revision
after being done properly. I think it's safe to have in the std library
(and it's already there, it's just incomplete).
WINAPI is growing constantly. Take a look:
http://msdn.microsoft.com/en-us/library/hh920508(v=vs.85).aspx
That's only the ones starting on W added in Vista vs XP:
http://msdn.microsoft.com/en-us/library/hh920517(v=vs.85).aspx
So you can't sync once and forget.
More importantly one can't hope to test them all properly after
translation. (I mean as in mapped properly not for their functionality
that's M$ job).
Basically it's a constant job for someone motivated. If we put it in
druntime we need to keep an unconstrained flow of fixes/updates from
authors.
The A/W matter... I really think the version should be respected and the
aliases maintained.
You can't make a change like that after decades because you think you
know better... Win32 is effectively a legacy API, and people have
decades of experience, and existing code written with it.
Just make sure *-W is the default alias as UTF-16 is what the kernel
uses internally anyway. (or a lame subset of UTF-16)
Here's a crazy thought: if WinAPI is needed by Phobos functions why
not just distribute WinAPI with the zipped distribution? You could put
it in a special subfolder, e.g.:
dmd2/src/dmd
dmd2/src/druntime
dmd2/src/phobos
dmd2/src/bindings <-- put it in here
And then in sc.ini or dmd.conf add an import to the bindings folder,
and distribute a precompiled static library of the bindings alongside
phobos.lib. The -version switches might have to be sorted out, but
that has to be a simpler problem than rewriting bindings from scratch.
They're already in core.sys.windows, that's a perfectly good place for it.
+1
Looking a WINAPI bindings project I couldn't help but wonder why it's
not pulled into druntime or is a part of druntime. Guess that must be
license issues?
--
Dmitry Olshansky