Pre-SIP: a syntax for aggregate literals

I was working on a SIP draft when I realized that one of my motivating use cases, zio-k8s, won’t actually work with the approach as discussed so far :frowning:.

An example zio-k8s definition might look as follows:

val deployment =
  Deployment(
    metadata = ObjectMeta(name = "foo"))

Now ideally we should be able to write this like so:

val deployment =
  Deployment(
    metadata = #(name = "foo"))

But this doesn’t work, because the type of the metadata field isn’t actually ObjectMeta, it is Optional[ObjectMeta], where Optional is from the ZIO prelude. The first example still compiles because there is an implicit conversion from A to Optional[A]. But in the the second example, #(name = "foo") would be desugared to Optional(name = "foo"), which doesn’t work.

I have an idea for how to fix it, but I’d be interested in hearing the community’s thoughts about this issue first.