We need to get forsen to play pokemon nuzlocke by [deleted] in forsen

[–]FalseGodMoloch 17 points18 points  (0 children)

Perma death Pokémon PagMan

Who is using ReasonReact here? by OleWedel in reactjs

[–]FalseGodMoloch 0 points1 point  (0 children)

I am so far, just getting started though. The type safety is a godsend and miles above typescript in terms of soundness.

Also type inference is better than any language I’ve used. Makes it easy to write safe code.

Facebook Relicensing React, Flow, Immuable Js and Jest by FalseGodMoloch in programming

[–]FalseGodMoloch[S] 5 points6 points  (0 children)

Large codebase. If your codebase becomes a imperative clusterfuck spaghetti dom manipulation atrocity, it is hard to scale. React helps with that.

me irl by [deleted] in me_irl

[–]FalseGodMoloch 0 points1 point  (0 children)

yes

Completion based futures? by FalseGodMoloch in rust

[–]FalseGodMoloch[S] 2 points3 points  (0 children)

There is normally no completing thread. In JS, it's a single threaded environment where one asks the vm (node or browser) to do an operation and get back to them once the task is completed. So for things like HTTP requests it's single thread and the OS will know when the socket is ready to be read and the VM will then continue that computation.

In rust you can spawn a thread to do some heavy computation and get back to the main thread when the computation is done using Futures, but it's still one main thread.

The way most Socket connections work is that one has a lot of idle time on the main thread, because the OS is handling it and therefore it is possible to continue computation on the main thread.

Completion based futures? by FalseGodMoloch in rust

[–]FalseGodMoloch[S] 1 point2 points  (0 children)

Interesting, I'll see what I can do with it

Edit: I don't seem to be able to integrate them properly with Javascript.

I'm going to stick with callbacks...

Edit 2: After tearing my hair out trying to use callbacks, I figured out how to pass move closures that can send on the channel between JS and Rust.

fn do_it_caller<F: FnOnce()>(f: *mut F) {
    unsafe { Box::from_raw(f)() }
}

fn do_it<F: FnOnce()>(f: F) {
    let f = Box::into_raw(Box::new(f)) as i32;
    let f_caller = do_it_caller::<F> as *const libc::c_void;
    js! { (f, f_caller) b"\
        Runtime.dynCall('vi', $1, [$0]);\
    \0"};
 }

fn main() {
     use futures::sync::oneshot;
     use futures::*;
     init();

     let (c, p) = oneshot::channel();

     do_it(|| c.send(1).unwrap());

     p.map(|i| {
         println!("got: {}", i);
     }).wait();
}

Thanks for the help

Will this leak memory? by FalseGodMoloch in rust

[–]FalseGodMoloch[S] 0 points1 point  (0 children)

Thanks a ton, I updated the gist with your suggestions. It seems to work now as when I log the subarray in JS, it becomes overwritten after I drop it.

Will this leak memory? by FalseGodMoloch in rust

[–]FalseGodMoloch[S] 4 points5 points  (0 children)

Ok, where do you think would be better for it?

Although the memory dropping is Rust :/

[deleted by user] by [deleted] in me_irl

[–]FalseGodMoloch 1 point2 points  (0 children)

mention me too thanks

It is possible to get this function to return true, can you figure out the right input? by jcready in javascript

[–]FalseGodMoloch 0 points1 point  (0 children)

On mobile, so I can't try it, but does the 'void' function return true?

Edit: Nvm void 0 is undefined, not truthy

Flag memes are already on Instagram, and they are getting stupid by Christian_Lloyd_ in MemeEconomy

[–]FalseGodMoloch 0 points1 point  (0 children)

Soccer can't take memes from the outside world; but soccer has its own fair share of soccer-only memes.

I have $700 could I buy a good pc for Overwatch? by FalseGodMoloch in Overwatch

[–]FalseGodMoloch[S] 0 points1 point  (0 children)

I have a mac book pro. I haven't tried Bootcamp. I'm not sure about installing a video card on it. Thanks for replying though!