Date: Mon, 9 Apr 2018 10:32:29 -0400
On 04/09/2018 09:09 AM, Boris Kolpackov wrote:
> Jens Maurer <Jens.Maurer_at_[hidden]> writes:
>
>> The current proposal to support macros in modules does not allow the
>> contents of a later import be influenced by macros defined by a former
>> import.
> You mean the module interface is immutable to macros defined in the
> importing translation unit? Yes, allowing this would be pure lunacy.
>
>
>> It's just that modules can make macros available to importing
>> translation units, and will be visible there.
> The following will still be possible, right?
>
> #import foo // Exports macro FOO.
>
> #ifdef FOO
> # import bar
> #endif
>
> Or even this:
>
> #import FOO
>
> This will require the back-and-forth between the build system and the
> compiler I mentioned earlier.
No, that would not be possible. The "Another take on Modules" proposal
[1] explicitly guards against this; see section 3.3 (Preprocessor impact).
Tom.
[1]: http://wg21.link/p0947
> Jens Maurer <Jens.Maurer_at_[hidden]> writes:
>
>> The current proposal to support macros in modules does not allow the
>> contents of a later import be influenced by macros defined by a former
>> import.
> You mean the module interface is immutable to macros defined in the
> importing translation unit? Yes, allowing this would be pure lunacy.
>
>
>> It's just that modules can make macros available to importing
>> translation units, and will be visible there.
> The following will still be possible, right?
>
> #import foo // Exports macro FOO.
>
> #ifdef FOO
> # import bar
> #endif
>
> Or even this:
>
> #import FOO
>
> This will require the back-and-forth between the build system and the
> compiler I mentioned earlier.
No, that would not be possible. The "Another take on Modules" proposal
[1] explicitly guards against this; see section 3.3 (Preprocessor impact).
Tom.
[1]: http://wg21.link/p0947
Received on 2018-04-09 16:41:51