Skip to content

Conversation

@qudix
Copy link

@qudix qudix commented Apr 25, 2025

  • use std::format, remove fmt


template <typename... Args>
NEVER_INLINE void error(CapricaFileLocation location, fmt::format_string<Args...> msg, Args&&... args) {
ALWAYS_INLINE void warning(CapricaFileLocation location, size_t warningNumber, std::string_view msg, Args&&... args) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shift means we no longer have the ability to get compile-time checking of format strings for warnings and errors :( Is it really worth losing that just to shift to std::format?

Copy link
Author

@qudix qudix Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't work on it for too long, but switching over to std::format_string<Args...> resulted in a compile time error I couldn't quite figure out from the macros.

error C7595: 'std::basic_format_string<char,caprica::identifier_ref &>::basic_format_string': call to immediate function is not a constant expression

I would say that in the short term it's not really a big deal, and it results in one less third-party dependency. Regardless I'll look into it some more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually thinking on it more using string_view and passing that to vformat as I did here does at least do compile time argument checking, but not compile time format checking because that's not a thing until c++26.

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.

2 participants