-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
druntime: replaces top level version(..) branching by tags #24
Conversation
soooo i like the idea of replacing version... but i don't really like this approach. (and not just cuz it would break the build on my computer lol) I tried to do something similiar with simpledisplay back in the day and i regret it. so im simpledisplay, there's a top-level interface and then a platform mixin. so like adapting the idea here it would look like
And then the impl thing defines mixin templates with the platform specifics. (You don't even strictly need to define the names top level, since the impl can mix them in too, or you could use a private holder struct, all kinds of things). The nice thing about this is you do get a reasonably consistent cross-platform interface. The compiler will tell you if you messed up a required function, you get one definition of default params, documentation, etc., you can even deliberately expose platform-specific things through that The bad thing is there's so much duplication and jumping around to figure out what does and doesn't actually work. Adding new features gets tedious as you do it over and over again. The And that module can also be imported by other code to build on the same idea. Did you consider this kind of static if thing instead? |
Will such mixin approach cause problems with protected/package attributes?
Why?
More?
Hmmm....
This means what we still need some non-cross-platform build code for switching modules |
I don't think the mixin was actually a good solution; I regret using it and prefer to branch inside the function. I wouldn't separate the files at all.
This example was meant to show something I regret, not something I'm suggestion - my suggestion is to import the config module that has the tags then static if on them. But even if we did htis, there'd be no build code, you'd just
no build system swap |
How to build druntime for platforms that not supported officially in this case? |
by hitting |
Something like externDFunc!("core.event.Event.setEvent",
void function(void*) nothrow @nogc @safe);
externDFunc!("core.event.Event.clearEvent",
void function(void*) nothrow @nogc @safe); ? I tried it, it's disgusting By the way, there is another advantage of my approach: if it doesn't work everything can be returned back by a script: all touched files located at same places of files hierarchy, so we will be able just merge it into version branches again |
no, i'd just leave the implementation empty, or put a runtime |
My goal is to make possible to implement any platform support without changing druntime sources. Without forks that adds support WebAsm or SerenityOS, so that a next fashioned breakthrough platform can be implemented in two weeks |
I am not sure that documentation and default arguments is a big problem: Current documentation also contains a lot of footnotes due to differences in platforms, no matter how much we want to maintain an abstracted interface. Therefore, it would be correct to generate documentation for different modules separately. And it can also be displayed beautifully in the web interface Default arguments... It depends on what kind of argument it is. At one hand, baheviour of defaults may be covered by the tests. At other hand - that is why they are made by default. Can we get automatically generated list of functions with default arguments? Maybe there are only a few of them and we shouldn’t worry about |
My problem is that all this stuff is duplicated over several files so if you update one of the generic pieces it means several edits. |
Let's hope on testing (and a spontaneous reduction of the number of such places during of code generalization) For now files like |
It is not advisable to avoid duplication everywhere. But for Also, as side effect, becomes obvious pointlessness of the handler checks before each |
Is CI disabled? |
it ran on my PR (even though it is a waste of time, i actually do want to disable it on PR things) but maybe not yours cuz you ... might have to rebase n master to get the ci script. |
This is how ldc2.conf file looks:
|
11613de
to
4c32a76
Compare
Gonna try the approach from the other PRs instead. |
For continuity: @adamdruppe probably means here PRs #45 #48 #49 |
event_awaiter involved to this as first module More info: opendlang/opend#24
Same patch as for dlang, but with
initialldc2 supportMore info:
dlang/dmd#15887
dlang/dmd#15822
https://forum.dlang.org/post/[email protected]