-
Notifications
You must be signed in to change notification settings - Fork 147
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
Question about proper way to marshal multi-parameter type constructors #719
Comments
The generated code accounted for this but by moving it in we get a simpler interface. Fixes gluon-lang#719
Fixed with #720. Best I can tell these implementations could be automatically derived though? Why did you feel the need to implement them manually? |
Thanks for the quick response. I'm working on writing a wrapper for the winit library and that's where I came across this problem. Since I'm wrapping types that are from an external crate my understanding is that I cannot derive Getable or Pushable due to the fact that all of the fields of these types also need to be Getable or Pushable but I can't implement that trait on the external types due to orphan rules. |
Yeah, that is a big problem I want to tackle at some point by adding attributes to the derive macros like serde's Would also like to be able to point a build script at a plain rust file and have bindings be generated for all (or a subset) of the public functions in it |
<a name="v0.12.0"></a> ## v0.12.0 (2019-07-06) #### Bug Fixes * Remove Userdata and Trace impls for RwLock and Mutex ([e90f02b](gluon-lang@e90f02b)) * Add missing negate function from the prelude ([0091f47](gluon-lang@0091f47)) * Refer to registered types by their full name ([a2daace](gluon-lang@a2daace), breaks [#](https://github.com/gluon-lang/gluon/issues/)) * Handle newtypes with a public field ([d1fef96](gluon-lang@d1fef96), closes [gluon-lang#713](gluon-lang#713)) * Don't ICE on unapplied, aliased constructors ([2a44a0d](gluon-lang@2a44a0d)) * **check:** * Propagate metadata through parens ([bd767c0](gluon-lang@bd767c0)) * Bring nested implicit instances into scope ([ad82bde](gluon-lang@ad82bde)) * Don't lose type information in catch-all ([d2a3fbf](gluon-lang@d2a3fbf), closes [gluon-lang#702](gluon-lang#702), [gluon-lang#703](gluon-lang#703), [gluon-lang#704](gluon-lang#704), [gluon-lang#705](gluon-lang#705)) * **codegen:** Return exactly the same type on VmType derive on enum ([375d3e9](gluon-lang@375d3e9)) * **compiler:** Don't panic when matching a tuple against an alias ([777bd31](gluon-lang@777bd31), closes [gluon-lang#749](gluon-lang#749)) * **std:** * cleaned up statet.glu exports ([5d8864f](gluon-lang@5d8864f)) * export wrap_monad from transformer.glu ([0e9d7bc](gluon-lang@0e9d7bc)) * **vm:** * Check if a collection is needed when creating a child thread ([86e4b9f](gluon-lang@86e4b9f)) * Automatically remove the elements added to pushed data ([8cd5152](gluon-lang@8cd5152), closes [gluon-lang#719](gluon-lang#719)) #### Performance * Use NonNull for garbage collected pointers ([9c66ede](gluon-lang@9c66ede)) * Don't recurse into already visited records to find implicits ([b50061f](gluon-lang@b50061f)) * Avoid recursing into non-implicit types ([c35b29e](gluon-lang@c35b29e)) * Use SmallVec in Partition ([d8c549b](gluon-lang@d8c549b)) * Use a scoped collections over a persistent in implicit resolution ([d13097e](gluon-lang@d13097e)) * Memoize implicit attribute lookups (-3%) ([254af75](gluon-lang@254af75)) * Speedup Symbol::module ([9566a37](gluon-lang@9566a37)) * Avoid creating function types unnecessarily ([170f467](gluon-lang@170f467)) * **compiler:** * Shrink the core::Expr type to 40 bytes (from 72) ([779d1b6](gluon-lang@779d1b6)) * Copy elements directly into arena ([cd2dd36](gluon-lang@cd2dd36)) #### Features * Add gc::Mutex ([d6e1246](gluon-lang@d6e1246)) * Automatically unroot values stored in `Gc` allocated values ([6ebc398](gluon-lang@6ebc398), closes [gluon-lang#746](gluon-lang#746)) * Add derive for Traverseable ([844418d](gluon-lang@844418d)) * Allow mutable references to be passed to gluon ([602220b](gluon-lang@602220b)) * Add std.env ([b561c8d](gluon-lang@b561c8d)) * Implement woobly type propagation ([a0b8452](gluon-lang@a0b8452)) * **codegen:** Add the newtype attribute ([4085463](gluon-lang@4085463)) * **completion:** * Match on the symbols in type declarations ([9d28ba1](gluon-lang@9d28ba1)) * Return scoped symbols in the all_symbols query ([94a385a](gluon-lang@94a385a)) * Match on the symbols in type declarations ([8fe083a](gluon-lang@8fe083a)) * Return scoped symbols in the all_symbols query ([1ad302b](gluon-lang@1ad302b)) * **doc:** Link to the github source ([da75875](gluon-lang@da75875)) * **vm:** Allow references to be passed through ([3a92b17](gluon-lang@3a92b17)) #### Breaking Changes * Refer to registered types by their full name ([a2daace](gluon-lang@a2daace), breaks [#](https://github.com/gluon-lang/gluon/issues/))
754: Version 0.12.0 r=Marwes a=Marwes <a name="v0.12.0"></a> ## v0.12.0 (2019-07-06) #### Bug Fixes * Remove Userdata and Trace impls for RwLock and Mutex ([e90f02b](e90f02b)) * Add missing negate function from the prelude ([0091f47](0091f47)) * Refer to registered types by their full name ([a2daace](a2daace), breaks [#](https://github.com/gluon-lang/gluon/issues/)) * Handle newtypes with a public field ([d1fef96](d1fef96), closes [#713](#713)) * Don't ICE on unapplied, aliased constructors ([2a44a0d](2a44a0d)) * **check:** * Propagate metadata through parens ([bd767c0](bd767c0)) * Bring nested implicit instances into scope ([ad82bde](ad82bde)) * Don't lose type information in catch-all ([d2a3fbf](d2a3fbf), closes [#702](#702), [#703](#703), [#704](#704), [#705](#705)) * **codegen:** Return exactly the same type on VmType derive on enum ([375d3e9](375d3e9)) * **compiler:** Don't panic when matching a tuple against an alias ([777bd31](777bd31), closes [#749](#749)) * **std:** * cleaned up statet.glu exports ([5d8864f](5d8864f)) * export wrap_monad from transformer.glu ([0e9d7bc](0e9d7bc)) * **vm:** * Check if a collection is needed when creating a child thread ([86e4b9f](86e4b9f)) * Automatically remove the elements added to pushed data ([8cd5152](8cd5152), closes [#719](#719)) #### Performance * Use NonNull for garbage collected pointers ([9c66ede](9c66ede)) * Don't recurse into already visited records to find implicits ([b50061f](b50061f)) * Avoid recursing into non-implicit types ([c35b29e](c35b29e)) * Use SmallVec in Partition ([d8c549b](d8c549b)) * Use a scoped collections over a persistent in implicit resolution ([d13097e](d13097e)) * Memoize implicit attribute lookups (-3%) ([254af75](254af75)) * Speedup Symbol::module ([9566a37](9566a37)) * Avoid creating function types unnecessarily ([170f467](170f467)) * **compiler:** * Shrink the core::Expr type to 40 bytes (from 72) ([779d1b6](779d1b6)) * Copy elements directly into arena ([cd2dd36](cd2dd36)) #### Features * Add gc::Mutex ([d6e1246](d6e1246)) * Automatically unroot values stored in `Gc` allocated values ([6ebc398](6ebc398), closes [#746](#746)) * Add derive for Traverseable ([844418d](844418d)) * Allow mutable references to be passed to gluon ([602220b](602220b)) * Add std.env ([b561c8d](b561c8d)) * Implement woobly type propagation ([a0b8452](a0b8452)) * **codegen:** Add the newtype attribute ([4085463](4085463)) * **completion:** * Match on the symbols in type declarations ([9d28ba1](9d28ba1)) * Return scoped symbols in the all_symbols query ([94a385a](94a385a)) * Match on the symbols in type declarations ([8fe083a](8fe083a)) * Return scoped symbols in the all_symbols query ([1ad302b](1ad302b)) * **doc:** Link to the github source ([da75875](da75875)) * **vm:** Allow references to be passed through ([3a92b17](3a92b17)) #### Breaking Changes * Refer to registered types by their full name ([a2daace](a2daace), breaks [#](https://github.com/gluon-lang/gluon/issues/)) Co-authored-by: Markus Westerlind <marwes91@gmail.com>
I've been trying to marshall a type constructor with 2 parameters and it appears that the stack is not aligning correctly. I'm probably not using the Getable and Pushable traits correctly, any pointers would be great. Here is some example code outlining the issue:
I get the error 'ValueRef is not an Userdata' and it looks like one of the arguments passed to the 'Two' constructor is causing a misalignment of the stack. I modified gluon locally to print out the data that is trying to get interpreted as Userdata and it shows Float(0.0). Here is the output of running the script:
The text was updated successfully, but these errors were encountered: