-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to specify discriminator name #6
Comments
Great job otherwise, btw 🙇 |
Could you provide a little bit more context what you would like to do and why? One of the explicit decisions I made is to make data structures for values opaque to the user. The reason was to experiment with different representations (and I already changed it twice). But again, would love to learn more about your usecase |
Yeah, sorry for the delay. Put simply, I'd like to be able to tell |
No worries! Got it. I made a design decision that the shape of the union values is opaque to developer (partially because that how it works in rust/swift etc). Fun history story: const U = Union({a: of(null), b: of<string>()})
const val = U.b('aha!'); This union value was originally represented as this: ['b', 'aha!'] then ['b', ['aha!']] now // objects are faster because of shape optimizations
{k:'b', p:['aha!']} And I'm benchmarking {k:'b', p0:'aha!', p1: undefined, p2: undefined, l:1} This might be faster because internally I'm using So going back to the issue: I didn't know at the time what would be the fastest internal implementation of the library api. The worst part is that this state is very dynamic and might change at any given moment. So I don't want to expose internal api because it will stop any perf explorations. Hope that makes sense and answers your question. |
Sorry for my somewhat off-topic comment @twop but I just had to say that I've been reading your issue replies on this repo and you've given me yet another reason to love the open source community. I'm really looking forward to using this, and seeing if it fits well with what I need, but either way, love your work! I hope you keep doing what you're doing! |
@MiracleBlue Thank you so much for such kind words <3 |
My pleasure!
I have a few possibilities. I've always been a fan of modelling data with
data types ever since my first encounter with them in purescript. I also
get very annoyed at how limiting typescript feels since PS was actually how
I first really embraced a type system. Right now I'm working on a sort of
css in js library, and I'm working on it's parsing system, as well as
caching. I've actually started the caching stuff, playing around with
different approaches to dealing with stateful yet serializeable information
in a nicely FP way. It was actually a search I did on github for IORef that
eventually led me here (indirectly). Since posting my comment I actually
have started seeing so many little opportunities to model things the way I
really want to using ts-union and I especially love the work you've done on
making the pattern matching a really nice experience, which I expect I'm
going to rely on quite a bit in the parser. This might even lead me to
completely rethink the approach I took with the object literal walking
utility (the styles are generated from object literals)
…On Tue, 24 Dec. 2019, 6:41 pm Simon, ***@***.***> wrote:
@MiracleBlue <https://github.com/MiracleBlue> Thank you so much for such
kind words <3
Curious to know more about your use case, please give feedback if you will
have time and energy
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6?email_source=notifications&email_token=AAAFWSFKLEXULLKYPRC4BJTQ2G4LBA5CNFSM4IYI4EL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHSWSYI#issuecomment-568682849>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAFWSDN25CSMMCIMQFIS3DQ2G4LBANCNFSM4IYI4ELQ>
.
|
@MiracleBlue But for that probably plugin compiler API is a prerequirement: Do you have a sketch API? for that? P.S. probably it makes more sense to move conversation to somewhere else. my twitter handle @twopSK if that is a convenient medium for you. |
I'm submitting a ...
[ ] bug report
[ x ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project
Summary
Something
unionize
has and can be of use if you need to deal with well established contract like FSA. Currently, I'd need to manually extend the result object influencing performance and - potentially, but hopefully not - breaking some existent behaviours.The text was updated successfully, but these errors were encountered: