dyno icon indicating copy to clipboard operation
dyno copied to clipboard

Use a less generic user-defined literal

Open samkellett opened this issue 7 years ago • 4 comments

Due to issues with using user-defined literals without exposing the whole namespace and interfaces generally being defined in a header, it's pretty much required to release dyno::literals into your own namespace. The problem here is that _s is far too generic, could the user-defined literal be _dyno?

samkellett avatar Dec 15 '17 16:12 samkellett

I acknowledge that this problem is a pain. You can also use DYNO_STRING(foo) instead of "foo"_s. Does that solve your problem, or are you set on using the UDLs but just want a less generic one?

ldionne avatar Dec 18 '17 02:12 ldionne

I'd definitely prefer the UDL over the macro. The macro feels like a significant step backwards considering how cutting edge this library is.

Seeing as the macro actually has similar namespacing issues (worse, of course, due to the global namespace pollution not being opt-in) which are solved with a C-style DYNO_ prefix, I think it would make sense for the UDLs to follow the same approach. At least until the language is fixed in this respect.

samkellett avatar Dec 18 '17 08:12 samkellett

Would you suggest the dyno::literals namespace be dropped in that case?

I've made the change of _s to _dyno on a branch locally and it's a trivial change for me to make. The only thing keeping me from pushing it is that it's uglier to write "some_method"_dyno than "some_method"_s.

ldionne avatar Jan 01 '18 18:01 ldionne

Would you suggest the dyno::literals namespace be dropped in that case?

no because if the UDL is defined inside only the dyno namespace the user is required to do a using namespace dyno in a header file to be able to create a public interface.

i don't think _dyno is that ugly tbh.

samkellett avatar Jan 03 '18 11:01 samkellett