OpenBSD port of dmd?

Jose Armando Garcia jsancio at gmail.com
Sat Mar 17 09:16:31 PDT 2012


On Sat, Mar 17, 2012 at 7:10 AM, Sean Kelly <sean at invisibleduck.org> wrote:
> Pretty much. I'd expect to see:
>
> version (linux) {
>    // optimized impl
> } else version (OSX) {
>    version = UseDefault;

Speaking of version specification, in this particular example is
version(UseDefault) only define on this module? The Language reference
doesn't seem to mention anything explicitly about this. It does have
the following:

"Predefined version identifiers are global, i.e. they apply to all
modules being compiled and imported."

Does this mean that the opposite is true? 'version = UseDefault' is
only define in the module defined.

Thanks,
-Jose

> } else {
>    static assert(false, "unknown platform");
> }
> version (UseDefault) {
>    ...
> }
>
> This way, new platforms have to be evaluated, but once they are they can all share whatever common implementation is the default.
>
> On Mar 17, 2012, at 3:31 AM, Alix Pexton <alix.DOT.pexton at gmail.DOT.com> wrote:
>
>> I think Walter and Andrei are both right, just about different things.
>>
>> I think Walter is right that there is no such thing as a default implementation when it comes to compatibility with the host environment, and asserting is the best course of action.
>>
>> I think Andrei is right that when a particular environment has some advantageous alternate implementation of a feature it can be used while leaving the default for the cases where said feature is unavailable.
>>
>> Walter is concerned with compatibility, Andrei with opportunistic optimisation.
>>
>> Knowing how to tell the difference is the real trick, and that is often a much harder thing to pin down. Code that potentially needs to be different on every platform should assert when the platform is unrecognised. Code which is specialised for just a few platforms and has a "known good" default can use else to provide said default. When unsure, assert is the more cautious option.
>>
>> A...


More information about the Digitalmars-d mailing list