[PATCH] Move optional into the experimental namespace (first bit of the TSes)
Marshall Clow
mclow.lists at gmail.com
Tue Nov 12 15:56:09 PST 2013
On Nov 12, 2013, at 3:33 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> I assume the intent is to implement this paper:
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3793.html
>
> So, assuming that include/experimental/optional was copied from include/optional (the diff doesn't say where the 'old' lines come from here)…
Yes.
> You included the inline namespace in the library synopsis comment; it shouldn't be there.
Ok.
> bad_optional_access should be in namespace std::experimental, not in namespace std.
I went back and forth about that. I agree - it _should_ be there.
However:
The destructor for bad_optional_access lives in libc++.dylib. (due to a peculiarity in the Itanium ABI).
If I put bad_optional_access in namespace std, then users do not need a new dylib when optional moves from std::experimental to std.
> For headers in include/support, the source files are in src/support. Should optional.cpp be moved to src/experimental/optional.cpp?
Good question.
Header folder structure is an interface.
Source folder structure is not.
I don't see that this is necessary; but if other people really want it, I have no objection to changing it.
> Bikeshedding on the name __TSLibraryFundamentals:
> * Should this contain a version number? We may want an ABI break at some point, and it might be nicer to have always had the version number in the name.
Yes! Crap - there was supposed to be a _v1 on the end of that.
> * Other library-internal names in libc++ seem to use __lower_case_names
> Maybe __library_fundamentals_1?
That's fine - I can live with either one.
> Somewhat related to versioning, do we want to provide some way for people to opt into/out of individual TSes? For instance, I might want to test that my code compiles as standard C++14 (with no TSes), or to use the fundamentals TS but not the filesystem TS, since the latter has security issues.
The easy answer is not to include <filesystem>
The other answer is that's why I created the __TSLibraryFundamentals namespace.
People can hoist just one TS worth of names with "using namespace std::experimental:: __TSLibraryFundamentals;" (or whatever)
> How will we handle TSes that affect existing headers, rather than adding new ones? (Do we have any of those yet?)
Jeffrey should weigh in here, but I think that current plan is to not change existing headers.
> How will we handle TSes that need both frontend and library changes, such as the array extensions TS? It might be nice to have a single flag to the compiler ("-fsomething" or "-std=c++14+fundamentals+arrays" or something) to enable TSes for language and library as appropriate. Any ideas?
No more than you've just said.
For library-only TSes (Library Fundamentals, Networking, Filesystem), I don't think there needs to be anything done for the compiler.
For Arrays, I think a "-f ArrayTS" or something like that would work, (that flag should only work if -std=c++1y or later).
Thanks!
-- Marshall
>
> On Tue, Nov 12, 2013 at 1:48 PM, Marshall Clow <mclow.lists at gmail.com> wrote:
> Along with C++14, the standard committee is working on several "Technical Specifications", designed to bring features that for one reason or another weren't able to be in C++14 to people before the next version of the standard (C++17??). Those of you who remember TR1 (from about 2005) - this is a similar process under a new name.
>
> There are several being worked on:
> * Library Fundamentals
> * Arrays of Runtime Bound
> * Networking
> * Concepts
> * Filesystem
>
> This patch takes the implementation of <optional> that Howard wrote and committed into libc++ (before the committee removed the feature from C++14), and moves it into the new "experimental" area, which is where these TSes will live until they are enshrined in a future version of the standard.
>
> That area can be described as:
> namespace std::experimental (feel free to alias this to something shorter in your code)
> files live in the "experimental/" directory.
>
> If you're already using the <optional> in libc++, you'll have to change your code to:
> #include <experimental/optional>
> and
> std::experimental::optional<T>
>
> It's a big patch, but it's just renaming things; if I actually changed some code, then I did it wrong.
>
> -- Marshall
>
> Marshall Clow Idio Software <mailto:mclow.lists at gmail.com>
>
> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
> -- Yu Suzuki
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-- Marshall
Marshall Clow Idio Software <mailto:mclow.lists at gmail.com>
A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
-- Yu Suzuki
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131112/ef211845/attachment.html>
More information about the cfe-commits
mailing list