Could we get the assignment plugin to work with op...
# arrow-contributors
y
Could we get the assignment plugin to work with optics? so that we can do:
Copy code
blah.copy {
  a = x
  b = y
}
It feels doable, no? In fact, couldn't we already do this with delegated properties? I might investigate... Seems like it'd need contexts if we used delegated properties, and currently there's no context support for delegates. The assign approach may thus be better.
p
Wouldn't optics fit well with the same approach as dataframes?
y
Not sure what you fully mean there. Data frames has some funky type stuff to deal with its type changing all the time. No user type does that though so we're fine.
p
I mean taking the same approach with a compiler plugin to provide faux properties for assignment in the copy block
y
Oh I see! We're kinda pretty close already. I'm actually not 100% sure on how DataFrame does it, but my understanding is that a lot of it is simply code generation (although in their case they do it at the FIR level, and not by generating actual Kotlin). I'll investigate further because mimicking them may indeed be the best idea.
j
Arrow Optics is not a compiler plugin, no? It works via ksp so adding FIR support wouldn’t be straightforward
y
Yes, but a lot of what DataFrame does is through codegen, so I'm not worried. The FIR stuff seems to be for creating new types on the spot and refining return types
y
I was thinking that the pre-existing Kotlin assignment plugin maybe could work here. I have also made a less-restricted kotlin assignment plugin that should do the trick.