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
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.
Markus Westerlind
@Marwes
Ah, seen that sometimes as well Opened gluon-lang/gluon#846
ikaeon
@ikaeon
Thanks. I got around the problem by not importing(use) Pushable and apply the full Path gluon::vm::api::Pushable
I have been trying to share a BTreeMap<String,AsxTimeseries> between gluon and rust. I have removed all the compile errors but the gluon script panics at the moment.
ikaeon
@ikaeon
I am trying to return a BTreeMap<String,String> from a rust function but I keep getting panics: thread 'main' panicked at 'context', /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/gluon_vm-0.15.1/src/thread.rs:2901:30 if I have multiple items in the BTreeMap or thread 'main' panicked at 'Attempted to pop Frame { offset: 0, state: Unknown, excess: false } but id was expected', /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/gluon_vm-0.15.1/src/thread.rs:1936:13 if the BTreeMap has only 1 item and no panic if a empty(BTreeMap::new()) is returned. I have been at this for a couple of days now because I really am interested in trying out Gluon but I just cannot make it work.
Markus Westerlind
@Marwes
Can you open an issue with the full backtrace and whatever else information you can provide (ideally a standalone example)
BTreeMap conversion is a bit complicated so hard to say exactly what went wrong
ikaeon
@ikaeon
Ok, done. Thanks. Sorry I simply assumed I done something wrong as I am not a programmer just a unskilled factory worker.
Abcd Efgh
@efgha4351_gitlab
Another language, which is a possible alternative to Gluon, is Slider, available at http://mrsename.blogspot.com/
Steven
@crides
gluon-lang.org seems to be down?
Sean Leffler
@sdleffler
Hey y'all! I looked away from Gluon for a year and it turned into embedded Haskell... I'm impressed as hell. :D Anyways was curious to know if there's currently any support for coroutine-ish stuff, like a coroutine monad or such in the stdlib or even builtin? Or whether any such is planned. I'm looking at designing a little DSL in Gluon which would end up as a monadic list of actions, and I'd love to be able to have state be yielded back to Rust to be continued on another frame of my game project. I suppose I'd probably be best off returning Functions from Gluon? Cheers!
Sean Leffler
@sdleffler
Also, a simpler question: I'd like to be able to use something like Haskell's undefined or Rust's unimplemented!()/panic!() in that they effectively have the type forall a . a. I tried implementing my own little undefined as an infinite loop but Gluon complained about some stricter requirements for the last expression of a recursive binding. Is there something for this that I'm missing which is already in the stdlib?
Markus Westerlind
@Marwes
You can use error : String -> a. Since gluon is not lazily evaluate you can't define undefined in a useful way. Not sure exactly what the error is without some example code
Markus Westerlind
@Marwes
So there is an effect monad which I think should fit the "couroutine" case well, however there is currently no way to drive an effect monad from the rust side
(at least none exposed and documented for users)
rustrust
@rustrust
calling io.print "a" and then io.print "b" in a gluon script only prints "b" . is this expected behavior?