This issue is a follow-up from http4s/http4s#3433.
I've struggled with this a bit and think it's quite problematic to embed string interpolations to uri"" and path"" of http4s (actually, it's so for every interpolated macros based on literally):
- At the moment, compilation fails if invalid strings have been passed (underlying
validate is calling at compile time).
- Say
val foo = "/foo/bar"
val someuri = uri"https://example.com$foo"
means that we should check the value of foo at the runtime (generally, foo could be some computation, not a constant value). So bringing embedded string interpolations means we should proceed with runtime values at compile time (because of 1). I'm not that much a Scala macros astronaut, but am feeling it's probably impossible.
UPD: speaking more accurately, compile-time checking is only possible for the literal part of the passed string.
If anyone has insights about that, please share them here.
This issue is a follow-up from http4s/http4s#3433.
I've struggled with this a bit and think it's quite problematic to embed string interpolations to
uri""andpath""ofhttp4s(actually, it's so for every interpolated macros based onliterally):validateis calling at compile time).means that we should check the value of
fooat the runtime (generally,foocould be some computation, not a constant value). So bringing embedded string interpolations means we should proceed with runtime values at compile time (because of 1). I'm not that much a Scala macros astronaut, but am feeling it's probably impossible.UPD: speaking more accurately, compile-time checking is only possible for the literal part of the passed string.
If anyone has insights about that, please share them here.