Skip to content
This repository has been archived by the owner on Feb 20, 2019. It is now read-only.

StaticOnly should be used to choose the runtime strategy #418

Open
jvican opened this issue Apr 29, 2016 · 1 comment
Open

StaticOnly should be used to choose the runtime strategy #418

jvican opened this issue Apr 29, 2016 · 1 comment

Comments

@jvican
Copy link
Member

jvican commented Apr 29, 2016

Right now, we force the user to both select the runtime strategy and import StaticOnly so that only static picklers are used. However, the import StaticOnly should already decide to use one the runtime strategy that doesn't fallback to runtime generation when looking up tags. We may also want to add another implicit StaticOnlyWithLookup that will use the only-lookup runtime strategy.

Current limitation: the runtime strategy is defined in the package internal, that is initialized at boot time. As it's a top-level member, it can't depend on a user-imported implicit.

@jsuereth
Copy link
Contributor

So, I have a few thoughts here:

  1. staticOnly is meant to be about the generated picklers themesleves. i.e. DO NOT use any reflection in the code generated for the picklers. (These should be scala-js friendly).
  2. Whether to delegate to runtime lookup of picklers should probably be a separate flag. I agree with you that it should be controlled. By default, i think picklers are designed to be in "hybrid" form where you can lookup picklers at runtime, but prefer to generate static picklers. BUT the user should be able to (easily) turn that off and force all static-types everywhere, including the gymnastics involved in figuring out these types on both sides of a communication channel.

So basically, I'm ok adding a RuntimeLookup flag with NoRuntimeLookup as something that can be imported in-tandem with StaticOnly. I can also update the docs to reflect this if you think it's a good idea.

@jvican jvican added the ready label May 9, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants