C++ Logo

sg15

Advanced search

Re: "logical name" of importable headers

From: Gabriel Dos Reis <gdr_at_[hidden]>
Date: Mon, 6 Jun 2022 19:21:31 +0000
[Daniel]
> Right, I was looking at that, but that format currently doesn't cover
> the distinctions we were making before, particularly around "should
> this header unit only be accessible through the specific token?"
> "should it be found by include directory lookup and then map to a
> header unit regardless of the token used?".

I don't get it. What do you mean by "only accessible through the specific token"?

> That's the question I'm trying to answer.

The question needs elaboration 😊

> Specifically, the input to the compiler would be a map from the token
> used after include or import to the header file and the bmi for that
> header unit.

I think is what MSVC does... no?


-- Gaby

-----Original Message-----
From: Daniel Ruoso <daniel_at_[hidden]>
Sent: Monday, June 6, 2022 8:19 AM
To: Gabriel Dos Reis <gdr_at_microsoft.com>
Cc: sg15_at_[hidden]; Boris Kolpackov <boris_at_codesynthesis.com>
Subject: Re: [SG15] "logical name" of importable headers

Em seg., 6 de jun. de 2022 às 10:39, Gabriel Dos Reis
<gdr_at_[hidden]> escreveu:
> I don't know if I answered that question earlier; if I did then my
> apologies for the repeat.
> MSVC uses header-units.json:
> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcpp%2Fbuild%2Freference%2Fheader-unit-json-reference%3Fview%3Dmsvc-170&amp;data=05%7C01%7Cgdr%40microsoft.com%7C2f53c0c38b5b49815f5908da47cfed9f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637901255620110619%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=9nQ8sGwz3TLWy5O7W%2BmsMJL2lhXmChaPRfGl%2F1ptLSA%3D&amp;reserved=0

Right, I was looking at that, but that format currently doesn't cover
the distinctions we were making before, particularly around "should
this header unit only be accessible through the specific token?"
"should it be found by include directory lookup and then map to a
header unit regardless of the token used?". That's the question I'm
trying to answer.

At this point, I'm proposing we take a more aggressive stance on this
particular problem.

My proposal is that we recommend a convention where the assignment of
header units takes precedence over the include directory lookup.

Specifically, the input to the compiler would be a map from the token
used after include or import to the header file and the bmi for that
header unit.

Essentially, any token listed as a header unit is no longer subject to
search in the include directories, and is just straight out mapped to
the specific header file for inclusion and bmi for importation. And it
becomes a straight error to attempt to map the same token to different
headers.

IMHO, that simplifies a lot of the semantics on how distributed
libraries need to advertise their headers, and maybe it even gets us
to a point where a library doesn't need a `-I` anymore.

daniel

Received on 2022-06-06 19:21:34