typelevel / typelevel/literally
RFC: embedded string interpolations
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 113
- Forks
- 6
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 2
Description
This issue is a follow-up from https://github.com/http4s/http4s/issues/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
validateis 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked http4s issue and the discussion of uri"", path"", literally, and validate. The issue does not identify files, tests, or a settled implementation; a contribution would first need to establish whether runtime interpolation with compile-time validation of literal parts is feasible and define the intended scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100