Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
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?
Steven
@crides
Sort of? If you are just calling the function, because the returned IO () monad is not evaluated/lifted the function call is optimized out. You need to use seq in this case
If you're embedded, you can also turn off optimization
rustrust
@rustrust
i am playing around in the gluon repl, and if i say this: type Op = | Add | Sub | Div | Mul the repl will just sit there after i hit return (on both debug and release)
i added some extra lines of code after that, like so:
type Op = | Add | Sub | Div | Mul
let io = import! std.io
io.print "foo"
and so then that will print foo0 (i'm not quite sure where the 0 comes from)
but if i say :info Op, it says that binding Op is not defined
Markus Westerlind
@Marwes
The repl doesn't support defining types atm unfortunately
elonzyy
@elonzyy
alt
I did a basic brep modeller using rust+wasm+gluon. Anybody interested?
Rohan Sircar
@rohan-sircar
@Marwes Hi, https://gluon-lang.org does not seem to be working.
Rohan Sircar
@rohan-sircar
It's working now. I assume you fixed it?

I can finally read the book now heh.

Another way of calling a function is through infix notation since gluon implements all operators as just functions.

Ah, that's a lot like scala

Markus Westerlind
@Marwes
I reverted to a verison that works better so the docs will be a bit out of date
Rohan Sircar
@rohan-sircar
Okay. I can't seem to find how to print an integer anywhere.
Markus Westerlind
@Marwes
Having some issues getting DNS working via terraform but a more stable site can be found at https://c85hocb4n1.execute-api.us-east-1.amazonaws.com/ (I may need to recreate it if I make to big a mistake but it should be up from now on)
Rohan Sircar
@rohan-sircar

I did a basic brep modeller using rust+wasm+gluon. Anybody interested?

I'd like to play around with it. Do you mind uploading it?

Rohan Sircar
@rohan-sircar
This works :)
let { channel } = import! std.channel
let { send, recv } = import! std.channel

let { sender, receiver } = channel "start"

let mysend _sender =
    let _ = send _sender "message hello 1"
    let _ = send _sender "message hello 2"
    let _ = send _sender "message hello 3"
    let _ = send _sender "message hello 4"
    ()

mysend sender

let f receiver_ =
    match recv receiver_ with
    | Ok s -> io.println ("received message: " ++ s) *> f receiver_
    | Err e -> io.println "no more messages"

f receiver
> gluon hello.glu 
received message: message hello 1
received message: message hello 2
received message: message hello 3
received message: message hello 4
no more messages
Rohan Sircar
@rohan-sircar
@Marwes This does not work. Am I doing something wrong?
let x = prim.spawn ( \_ ->  
        let _ = io.println "hello from thread1"
        ()
        )

let y = prim.spawn ( \_ ->  
        let _ = io.println "hello from thread2"
        ()
        )

prim.join (io.wrap x)
$ gluon hello.glu
Threads cannot be deep cloned yet
Stacktrace:

0: <unknown>
elonzyy
@elonzyy
@rohan-sircar let me tidy it up a bit. I'll push it to GitHub this weekend
Rohan Sircar
@rohan-sircar
@elonzyy Nice, highly appreciated.
human154
@human154
I would like to contribute a bit to the docs. I'm new to all this. Where exactly is the "Gluon Book" source? I couldn't find it under gluon-lang.org on GitHub. Any guidance (on finding it) and otherwise is appreciated!
human154
@human154
human154
@human154
@Marwes Is there a way to accelerate development by contributing small amounts of money?
Rohan Sircar
@rohan-sircar
Hey @elonzyy , just reminding you ;)
elonzyy
@elonzyy
@rohan-sircar Thank you for reminding me :) I've pushed to https://github.com/muscad-io/MusCAD
It is still very primitive. But at least it draws geometry by specifying points array. I'm currently working on the boolean solver.
Rohan Sircar
@rohan-sircar
Nice, I'll check it out.
Markus Westerlind
@Marwes
Where does those urls come from? The link to the book on https://gluon-lang.org/ is https://gluon-lang.org/doc/crates_io/book/index.html
Daniel
@Zuzuk-null
Hi everyone
Markus Westerlind
@Marwes
Hello!