by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Aashish Welling
@omegablitz
I have a reproduction locally, I can send it over if that's helpful
I was meaning to take a look myself but hadn't gotten around to it yet
stephenfrechette
@stephenfrechette
Sorry if I appeared nagging, I really just meant if you've found any insight on it
Markus Westerlind
@Marwes
@iptq gluon-lang/gluon#832 Fixes the docs
Aashish Welling
@omegablitz
@Marwes do you have any ideas on why this fails: https://github.com/omegablitz/gluon-bug ? I get a TrailingData error on deserialization, but not sure if I'm doing something wrong.
Trying to serialize/deserialize this: https://pastebin.com/S33kvk3p
Snarpix
@Snarpix
Is it possible to dynamically create record type and value from Rust? When field names are known only at runtime?
Markus Westerlind
@Marwes
You can, the script itself will of course see a static type though
https://github.com/Marwes/gluon_specs/blob/master/src/lib.rs is the only place I have done it and it has a lot of other complexity
So it isn't well documented
Snarpix
@Snarpix
Thanks, I will take a look.
Currently I'm using function arguments, and I hope custom records can release the burden of correctly naming passed arguments.
Snarpix
@Snarpix

I am calling a function with runtime-typed args using call_any and want it to return a runtime-typed tuple.
But I failed to find a type that is both Getable and VmType, to specify as return type for call_any.
gluon_vm::api::ValueRef is almost a match: Getable but no VmType implementation.
Variants is also suitable, but unfortunately I can't get it from call_any.
I see two options:

  1. Implementing call_any myself, so it can return Variants
  2. Try to write a Deserializer for runtime-typed tuple

May be I have missed something?

Snarpix
@Snarpix
My bad. OpaqueValue<RootedThread, Hole>::get_variant will do the thing
Markus Westerlind
@Marwes
:+1:
Markus Westerlind
@Marwes

@omegablitz
@Marwes do you have any ideas on why this fails: https://github.com/omegablitz/gluon-bug ? I get a TrailingData error on deserialization, but not sure if I'm doing something wrong.
Trying to serialize/deserialize this: https://pastebin.com/S33kvk3p

https://github.com/gluon-lang/gluon/pull/834/files

Aashish Welling
@omegablitz
Ah okay, thanks!
inivekin
@inivekin
A bit of a beginner/general question about non-Sync+Send types - feel free to ignore if it bores you: I've been getting into hardware programming and thought it would be interesting to try to make simple gluon bindings to the Kaze library and see if I could a basic version of the clash-prelude haskell modules - but I've only done some basic stuff in gluon and the kaze library uses RefCell all over the place. I can't seem to find a clean way to handle values that aren't Sync + Send to Gluon. Is this where OpaqueValue can come in useful or is that really only useful for generics? Any examples of gluon code that might be enlightening to me for this?
Markus Westerlind
@Marwes
@inivekin !Sync data is something that I want to support but haven't gotten to yet. At the moment everything must be Send + Sync. gluon-lang/gluon#46
inivekin
@inivekin
Ah, good to know. Thanks.
Aashish Welling
@omegablitz
If I try to run an expression on the gluon vm while i have an ActiveThread reference from vm.current_context(), gluon deadlocks. Is this expected behavior?
I may be doing it horribly wrong, but I'm trying to evaluate an expression in between deserializing 2 blobs with the same DeSeed
A minimal example of the deadlock if it's helpful: https://github.com/omegablitz/gluon-bug/blob/master/src/main.rs
Aashish Welling
@omegablitz
I managed to work around the deadlock, but suspect I'm approaching this wrong as I'm getting very strange undefined behavior. I have a type Stateon a server that I'm trying to synchronize to a client. I previously have been doing this naively by reserializing my entireStatewhenever I want to synchronize an update, but now am trying to do this in a way that reuses references. My current approach is to repeatedly use the same SeSeed to reserialize my updated States, and then repeatedly use the same DeSeed to deserialize these updates. Is this approach at all on the right track?
Markus Westerlind
@Marwes

If I try to run an expression on the gluon vm while i have an ActiveThread reference from vm.current_context(), gluon deadlocks. Is this expected behavior?

Yes, though you can call drop and restore to release the lock temporarily https://docs.rs/gluon_vm/0.14.1/gluon_vm/thread/struct.ActiveThread.html#method.drop

Aashish Welling
@omegablitz
Thanks, I ended up modifying the way serialization/deserialization works in gluon for my use case, and it seems to be working wonderfully, props for making the codebase easy to understand :)
Also unrelatedly, just an FYI that the the gluon-lang site appears to be down
Markus Westerlind
@Marwes
:+1:
No idea why it went down but it is at least up again
Should really move it to ECS and setup an alarm for it really, instead of this raw EC2 instance + cron job
Aashish Welling
@omegablitz
looks like it's down again
:(
any reason not to host it on gh-pages?
Markus Westerlind
@Marwes
Yeah, I did some changes to build with musl + alpine linux but I broke it again
Sorry
Waiting for travis to build a new container
Aashish Welling
@omegablitz
no worries, was just letting you know in case u didn't
Markus Westerlind
@Marwes
Can't host it on gh-pages since the gluon code is executed server side
Aashish Welling
@omegablitz
oh yeah, i forgot about the code executor
i guess theoretically that could also be run clientside, but maybe not worth the effort
Markus Westerlind
@Marwes
I did hack together a build which ran the code with WASM once, super hacky though and bitrotted now
It all serves to dogfood gluon though, the backend is written in gluon so
(as much as possible)
ikaeon
@ikaeon
Thanks for the impressive work. I was trying to marshall a rust struct I already have in my rust code to be available to the gluon vm. But now the rust code has a type mismatch ^^^^^^^ expected &mut gluon_vm::thread::ActiveThread<'_>, found f32with compiling.
struct AsxTimeseries { date:Vec<u32>, open:Vec<f32>, high:Vec<f32>, low:Vec<f32>, close:Vec<f32>, volume:Vec<u32> }
Try this again
  #[gluon(vm_type = "asx")]    
  struct AsxTimeseries {    
    date:Vec<u32>,    
    open:Vec<f32>,    
    high:Vec<f32>,    
    low:Vec<f32>,    
    close:Vec<f32>,    
    volume:Vec<u32>    
  }
Sorry keep hitting enter for line breaks.
ikaeon
@ikaeon
My assumption was marshalling wouldn't change the existing rust code, it this the wrong approach?
Markus Westerlind
@Marwes

Do you have a standalone reproduction

#[gluon(vm_type = "asx")]    
  struct AsxTimeseries {    
    date:Vec<u32>,    
    open:Vec<f32>,    
    high:Vec<f32>,    
    low:Vec<f32>,    
    close:Vec<f32>,    
    volume:Vec<u32>    
  }

Works on master

at least
ikaeon
@ikaeon
Thanks Markus. The issue is/was the Pushable trait overloads Vec::push, so when I use Pushable all the previous std::Vec::push calls in the code break.