Skip to content
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

enable using all features of array types #23

Conversation

PatrickVienne
Copy link
Contributor

@MetalBlueberry

as requested, separated out in a separate PR the change to enable array types as in JS

@PatrickVienne PatrickVienne force-pushed the feature/patrickvienne/enable_array_types branch from d29a64d to 8017dac Compare May 18, 2024 22:05
@PatrickVienne PatrickVienne force-pushed the feature/patrickvienne/enable_array_types branch from 8017dac to e2823e1 Compare May 18, 2024 22:07
@PatrickVienne
Copy link
Contributor Author

Enable using array types:

examples/scatter/scatter.html

image

@PatrickVienne
Copy link
Contributor Author

@MetalBlueberry
ready for review

@MetalBlueberry
Copy link
Owner

I see the problem here, but I think we can find a better solution than just using interface everywhere.

here is one proposal I just came up with. but it looks promissing.

We can provably predefine most of the types.

OR would it work with generics? maybe a generic function will solve our problems 😊

@PatrickVienne
Copy link
Contributor Author

PatrickVienne commented May 19, 2024

@MetalBlueberry
thanks for checking it and your suggestions.
Not sure how generics could help here unfortunately since we can have valuetype (string, int, float), we can have arrays ([]string, []int, []float) and then the pointers as well, which we need to represent nil

So it's almost like we need something like

type ArrayElement struct {
    IsValid bool  // if false -> value is marshalled as 'nil'
    Text     string
    Num    float64
}

// type to use for arrayOK types
type Array []ArrayElement

I'm not convinced yet of this solution as well though.

@MetalBlueberry
Copy link
Owner

This has been merged already, Thank you ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants