An issue with using C++20 modules would be cherry-picking into older ATS
releases.  We could use a cheesy-but-usable macro processor I originally
wrote back in the 80s to allow module declaration files to also be used as
old-fashioned header files:
---
$(module_once) // expands to nothing in C++20
$(export_module parent1 parent2 name) // expands to nothing in C++17 or
older, arbitrary number of parents, or none
$(export) void foo();
$(module parent1 parent2 name)
$(import parent1 parent2 name)
---
$(name arg1 arg2 ....) is a macro call.  In C++20 these would expand to:
---
export module parent1_parent2_name;
export void foo();
module parent1_parent2_name;
import parent1_parent2_name;
---
In C++17 or older these would expand to:
---
#pragma once
void foo();
#include <parent1/parent2/name.h>
#include <parent1/parent2/name.h>
---

---------- Forwarded message ---------
From: Masakazu Kitajo <notificati...@github.com>
Date: Thu, Sep 26, 2019 at 3:49 AM
Subject: Re: [apache/trafficserver] ProxySession cleanup: moving inline
functions to .h (#5908)
To: apache/trafficserver <trafficser...@noreply.github.com>
Cc: Walt Karas <wka...@verizonmedia.com>, Mention <
ment...@noreply.github.com>


Just for a note and I'm not sure at all, but Module that will be supported
on C++20 might resolve some of this complication.
https://www.infoq.com/news/2019/07/cpp20-draft-finalized/

Module support will be orthogonal to namespaces and will enable the
structuring of large codebases into logical parts without requiring the
separation of header and source files.

Reply via email to