Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Chase Gilliam
    @Ch4s3
    Ok, so I updated the code, but running thermite:build fails to compile ruru, as does cargo build
    I get the following output:
    rake thermite:build
    checking for cargo... yes
    /usr/local/bin/cargo build --release
       Compiling ruru v0.9.2
    /Users/chase/.cargo/registry/src/github.com-88ac128001ac3a9a/ruru-0.9.2/src/dsl.rs:152:72: 152:84 error: `$return_type:ty` is followed by `$body:block`, which is not allowed for `ty` fragments
    /Users/chase/.cargo/registry/src/github.com-88ac128001ac3a9a/ruru-0.9.2/src/dsl.rs:152             ($($arg_name: ident: $arg_type: ty),*) -> $return_type: ty $body: block
                                                                                                                                                                  ^~~~~~~~~~~~
    error: aborting due to previous error
    error: Could not compile `ruru`.
    
    To learn more, run the command again with --verbose.
    rake aborted!
    Command failed with status (101): [/usr/local/bin/cargo build --release...]
    /Users/chase/.rvm/gems/ruby-2.4.0/gems/thermite-0.8.0/lib/thermite/cargo.rb:41:in `block in run_cargo'
    /Users/chase/.rvm/gems/ruby-2.4.0/gems/thermite-0.8.0/lib/thermite/cargo.rb:40:in `chdir'
    /Users/chase/.rvm/gems/ruby-2.4.0/gems/thermite-0.8.0/lib/thermite/cargo.rb:40:in `run_cargo'
    /Users/chase/.rvm/gems/ruby-2.4.0/gems/thermite-0.8.0/lib/thermite/cargo.rb:58:in `run_cargo_build'
    /Users/chase/.rvm/gems/ruby-2.4.0/gems/thermite-0.8.0/lib/thermite/tasks.rb:121:in `block in define_build_task'
    /Users/chase/.rvm/gems/ruby-2.4.0@global/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
    /Users/chase/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
    /Users/chase/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
    Tasks: TOP => thermite:build
    (See full trace by running task with --trace)
    Dmitry Gritsay
    @d-unseductable
    What’s the Rust version? rustc --version
    Chase Gilliam
    @Ch4s3
    rustc 1.9.0 (e4e8b6668 2016-05-18)
    this may be the problem..
    Chase Gilliam
    @Ch4s3
    Looks like switching to rustup and installing the latest got me to the point where my own crappy code is what's failing to compile
    I think at this point I just need to get better at rust so that I can write my wrapper
    @d-unseductable Were should I look for general Rust help beyond "the book"?
    Dmitry Gritsay
    @d-unseductable
    @Ch4s3, this repo has many books, arcticles and videos
    Also #rust-beginners channel on IRC, rust-lang/rust room on Gitter and this topic on Reddit
    Chase Gilliam
    @Ch4s3
    Awesome thanks!
    Dmitry Gritsay
    @d-unseductable
    You’re welcome!
    Stephen Becker IV
    @sbeckeriv
    hey i am wondering how i can use a ruby Set object. I can seem to figure it out. set is just a wrapper around a hash.
    Dmitry Gritsay
    @d-unseductable
    Hey @sbeckeriv! Yes, looks like Set is implemented in pure ruby, so it should not need special bindings
    Dmitry Gritsay
    @d-unseductable
    It can be used like this:
    // Create a new set
    let set = Class::from_existing("Set").new_instance(vec![]);
    
    // Add `1`
    set.send("add", vec![Fixnum::new(1).to_any_object()]);
    
    // Convert to array
    let array = set.send("to_a", vec![]).try_convert_to::<Array>().unwrap();
    Stephen Becker IV
    @sbeckeriv
    thanks!
    Dmitry Gritsay
    @d-unseductable
    No problem!
    Keith Yeung
    @KiChjang
    hey everyone, i'm sort of confused as to how Thread::call_without_gvl works, and in particular what the 2nd parameter unblock_func is used for
    Keith Yeung
    @KiChjang
    the example gives it a closure that does nothing, but according to the docs in thread.cin MRI, it looks like it's supposed to interrupt func in some way and tell it to stop execution
    Steve Loveless
    @turboladen
    is ruru abandoned? haven’t seen much on it lately...
    Stephen Becker IV
    @sbeckeriv
    https://github.com/malept/thermite 0.13 was released yesterday and added "Support for building static libraries"
    Steve Loveless
    @turboladen
    ooo
    that’s awesome
    Tasos Laskos
    @Zapotek
    @d-unseductable Is Ruru still alive? Even the website is down: http://www.this-week-in-ruru.org/
    Daniel P. Clark
    @danielpclark
    @Zapotek development has resumed in the repo.
    Steve Loveless
    @turboladen
    Awesome!
    Marc Siegel
    @ms-ati
    @d-unseductable Is there some existing documentation how the following 3 items interact in Ruru:
    1. Ruby VM GVL
    2. Ruby Heap
    3. Rust Heap

    Q1: Do the parameters in a Rust method count as references to prevent the Ruby VM from garbage collecting the parameters while the Rust method is running without GVL?

    Q2: Does calling let mut hsh = Hash::new(); in Rust allocate the object on the Ruby heap, or a separate heap?

    Q3: Does Ruru call finalizer on the above Hash automatically when its ownership scope ends? Or is it subject to garbage collection at a later time?

    Q4: Are Ruby objects instantiated from Rust different in any way from the Ruby objects passed into Rust as parameters, or returned from Rust to Ruby?

    ...apologies if I've missed where the above are documented!
    Steve Loveless
    @turboladen
    i’m no ruru expert, but i do believe all of the ruby stuff from ruru is essentially delegated to ruby’s C API via the ruby-sys crate. not sure if that helps at all
    ruru types are just wrappers around the ruby C types
    Marc Siegel
    @ms-ati
    Hmm
    So there needs to be some statement about memory-VM model, don't you think? How does ruby-sys code executed without GVL become safe? I suspect it does not, and only pure Rust code would be safe?
    Steve Loveless
    @turboladen
    i do believe all of the code you write with ruru is, by default, executed using the GVL.
    afaik, ruru is really just a wrapper around ruby’s C API. …which will let you opt out of using the GVL if you want to, but you have to be explicit about that
    i don’t disagree that some docs on the topic would be helpful though :)
    Daniel P. Clark
    @danielpclark
    What's the ruru equivalent of Class#allocate ?
    Daniel P. Clark
    @danielpclark
    I found a rough way to do it
    let mut path_instance = Class::from(
        Class::from_existing("Pathname").send("allocate", None).value()
    );
    Joseph Giralt
    @joegiralt
    Hi all, i have a question. I'm currently in the process of writing a gem that inspired by lodash/fp. I did this just to really wrap my mind currying and functional programming. while i was in the process of doing this i came across ruru. i thought about replacing each daft_funkt function with a native rust function but I'm not sure if there would be any performance benefit to doing so. Is this just a awful idea? Am I on to something here? More importantly, is this even possible?
    Steve Loveless
    @turboladen
    @joegiralt I’m no ruru expert, but I’d wager that your functions would need to do a fair amount of work in Rust code to make the tradeoff worth it. In other words, if you make a Ruby library that calls Rust, but it just calls Ruby code right back, you’ll not get a ton of benefit. However, if your Ruby calls Rust and you have Rust code do some things in Rust, that’s where you’ll see the biggest benefit.
    And for me, the ruru that I’ve done ends up with both native Rust code and Ruby code for working with the same Ruby objects—that code ends up in two different places (Rust files and Ruby files), which can make maintaining things more work.
    Joseph Giralt
    @joegiralt
    one of the beautiful things about Fp is it allows you to compose functions
    Steve Loveless
    @turboladen
    It has, however, ended up with some great performance gains and some nice type safety.
    Joseph Giralt
    @joegiralt
    that's good to know.
    thanks for the response!
    Steve Loveless
    @turboladen
    welcome!
    you might try some benchmarking? maybe that’ll show that it’s worth it?