Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 'to_wstring(T)' in module. #2259

Closed

Conversation

DanielaE
Copy link
Contributor

FMT_STRING(x) doesn't work in modules yet because of FMT_STRING_IMPL. In this particular case, this alternative implementation might even be superior?

@DanielaE DanielaE force-pushed the feature/support-to_wstring-in-module branch from 85d43c6 to 051a5ad Compare April 28, 2021 05:31
@DanielaE DanielaE marked this pull request as ready for review April 28, 2021 05:57
@alexezeder
Copy link
Contributor

Is it the only place where FMT_STRING cannot be used with modules? For example, FMT_STRING also used in ranges.h:

out = format_to(out, FMT_STRING("{}"), " ... <other elements>");

FMT_STRING(x) doesn't work in modules yet because of FMT_STRING_IMPL

Does it mean that you want to make it work in the future? 🙂
IMHO, it's not worth it, as well as FMT_COMPILE, since you also mentioned that macro here:

The macro-based interfaces FMT_STRING and FMT_COMPILE are not yet implemented. Macros cannot get exported from modules.

As far as I can see, there is no need to export FMT_COMPILE macro from {fmt} module because _cf literal makes it obsolete.

It's a little more complicated with FMT_STRING - there is no literal for that. Still, there are (or will be, IDK, @vitaut knows it better) Compile-time format string checks by default that has one flaw (as I see it) - no other option but to have implicit fallback without checks for non-statically named arguments. FMT_STRING doesn't have this flaw because it handles this explicitly.

Aside from the concern with FMT_STRING, looks like {fmt} module can be fully functional without these macros. So probably macro-based interface can just be omitted. What do you think?

@DanielaE
Copy link
Contributor Author

DanielaE commented Apr 28, 2021

At present, ranges.h is not part of modularized {fmt}.

I do have an implementation of FMT_STRING and FMT_COMPILE which is based on udl-based compile-time literal arguments. I still haven't looked into possible other solutions like immediate functions. Unfortunately, the current implementation is not yet supported in msvc's modules implementation (may be 16.10-pre3 will do). Even more unfortunately, no other compiler is even able to survive attempts to compile fmt.cc. Without the modules-related lines in there, every compiler should be fine and compile {fmt} into a single object file, with them an advanced compiler chould create a BMI, too.

@vitaut
Copy link
Contributor

vitaut commented Apr 28, 2021

Thanks for the suggestion but don't think it's necessary since this is an internal use of FMT_STRING that doesn't require this macro to be exported.

@vitaut vitaut closed this Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants