March 15, 2020
On Sunday, 15 March 2020 at 16:31:35 UTC, Vladimir Panteleev wrote:
> On Sunday, 15 March 2020 at 10:29:11 UTC, Denis Feklushkin wrote:
>> What do you think about this? Is that good idea?
>
> Sounds like what Walter wanted to do in the first place:
>
> https://github.com/dlang/druntime/pull/2616#issuecomment-496312793
> https://github.com/dlang/druntime/pull/2616#issuecomment-503503846

Yes, it seems like that.

Just in case, to exclude discrepancies, I detail purpose of my proposal:
My proposal is about exclude any version() from platform-independent code. It is too hard to maintain all versions in one module file because it is too many types of platforms is available. (Really, I think we have near of infinity number of them, if we treat as version various sets of types aliases, etc.)

March 16, 2020
On Sunday, 15 March 2020 at 18:05:50 UTC, Denis Feklushkin wrote:
> On Sunday, 15 March 2020 at 16:31:35 UTC, Vladimir Panteleev wrote:
>> On Sunday, 15 March 2020 at 10:29:11 UTC, Denis Feklushkin wrote:
>>> What do you think about this? Is that good idea?

https://github.com/dlang/druntime/pull/2994
March 17, 2020
On Monday, 16 March 2020 at 22:30:05 UTC, Denis Feklushkin wrote:
> On Sunday, 15 March 2020 at 18:05:50 UTC, Denis Feklushkin wrote:
>> On Sunday, 15 March 2020 at 16:31:35 UTC, Vladimir Panteleev wrote:
>>> On Sunday, 15 March 2020 at 10:29:11 UTC, Denis Feklushkin wrote:
>>>> What do you think about this? Is that good idea?
>
> https://github.com/dlang/druntime/pull/2994

Problem:

It is need to set default import directory depending on the platform. (Like currently compiler does default import for Phobos.) Otherwise Phobos and all other software isn't builds because platform specific code isn't imported.
March 17, 2020
On Tuesday, 17 March 2020 at 03:08:41 UTC, Denis Feklushkin wrote:
> On Monday, 16 March 2020 at 22:30:05 UTC, Denis Feklushkin wrote:
>> On Sunday, 15 March 2020 at 18:05:50 UTC, Denis Feklushkin wrote:
>>> On Sunday, 15 March 2020 at 16:31:35 UTC, Vladimir Panteleev wrote:
>>>> On Sunday, 15 March 2020 at 10:29:11 UTC, Denis Feklushkin wrote:
>>>>> What do you think about this? Is that good idea?
>>
>> https://github.com/dlang/druntime/pull/2994
>
> Problem:
>
> It is need to set default import directory depending on the platform. (Like currently compiler does default import for Phobos.) Otherwise Phobos and all other software isn't builds because platform specific code isn't imported.

Rather than setting the import directory, I think a much nicer solution is something like this:
https://github.com/weka-io/mecca/blob/master/src/mecca/platform/os/package.d
This works for different OS types, different CPU types, etc. And it removes the need to specify a whole list of specific import directories for each OS/cpu combination in the config file (please keep LDC crosscompilation in mind).

-Johan

March 17, 2020
On Tuesday, 17 March 2020 at 16:25:22 UTC, Johan wrote:
>
> Rather than setting the import directory, I think a much nicer solution is something like this:
> https://github.com/weka-io/mecca/blob/master/src/mecca/platform/os/package.d
> This works for different OS types, different CPU types, etc. And it removes the need to specify a whole list of specific import directories for each OS/cpu combination in the config file (please keep LDC crosscompilation in mind).
>
> -Johan

How is this different from using version?
March 17, 2020
On Tuesday, 17 March 2020 at 17:12:39 UTC, IGotD- wrote:
> On Tuesday, 17 March 2020 at 16:25:22 UTC, Johan wrote:
>>
>> Rather than setting the import directory, I think a much nicer solution is something like this:
>> https://github.com/weka-io/mecca/blob/master/src/mecca/platform/os/package.d
>> This works for different OS types, different CPU types, etc. And it removes the need to specify a whole list of specific import directories for each OS/cpu combination in the config file (please keep LDC crosscompilation in mind).
>>
>> -Johan
>
> How is this different from using version?

It isn't. But it puts `version` in only a few places, instead of spread across many different files.
We shouldn't be replacing version, but utilize it.

-Johan

March 17, 2020
On Tuesday, 17 March 2020 at 17:12:39 UTC, IGotD- wrote:
> On Tuesday, 17 March 2020 at 16:25:22 UTC, Johan wrote:
>>
>> Rather than setting the import directory, I think a much nicer solution is something like this:

Yes, already implemented in new PR: https://github.com/dlang/druntime/pull/2997

>> https://github.com/weka-io/mecca/blob/master/src/mecca/platform/os/package.d
>> This works for different OS types, different CPU types, etc. And it removes the need to specify a whole list of specific import directories for each OS/cpu combination in the config file (please keep LDC crosscompilation in mind).
>>
>> -Johan
>
> How is this different from using version?

I used version (CRuntime_Abstract) to import platform dependent code.

This strategy looks good, but again there is a problem that is not directly related to the code: changing one module required changing only 8 lines in the code, but 15 lines in build scripts. And this is not all of needed changes - LDC uses its own cmake build scripts.

And each module will require approximately same changes. It will be like a disaster. Thus, at first stage we need to clear up build scripts.

March 17, 2020
On Tuesday, 17 March 2020 at 17:38:41 UTC, Denis Feklushkin wrote:
>
> I used version (CRuntime_Abstract) to import platform dependent code.
>
> This strategy looks good, but again there is a problem that is not directly related to the code: changing one module required changing only 8 lines in the code, but 15 lines in build scripts. And this is not all of needed changes - LDC uses its own cmake build scripts.
>
> And each module will require approximately same changes. It will be like a disaster. Thus, at first stage we need to clear up build scripts.

This is where something like

import core.sys.<compiletime identifier>.semaphore;

would be an absolute great help.
March 17, 2020
On Tuesday, 17 March 2020 at 19:34:45 UTC, IGotD- wrote:

>> And each module will require approximately same changes. It will be like a disaster. Thus, at first stage we need to clear up build scripts.
>
> This is where something like
>
> import core.sys.<compiletime identifier>.semaphore;
>
> would be an absolute great help.

This is not fundamental difference with version()
March 17, 2020
On 2020-03-17 18:38, Denis Feklushkin wrote:
> On Tuesday, 17 March 2020 at 17:12:39 UTC, IGotD- wrote:
>> On Tuesday, 17 March 2020 at 16:25:22 UTC, Johan wrote:
>>>
>>> Rather than setting the import directory, I think a much nicer solution is something like this:
> 
> Yes, already implemented in new PR: https://github.com/dlang/druntime/pull/2997

That PR kind of misses the point. What I did with Mecca was to manage to remove, more or less, all version identifiers from outside of the `platform` package.

If you're doing this for druntime I recommend you have a package for each platform. Currently you still have all version identifiers in the file for Posix.

-- 
/Jacob Carlborg