• 0 Posts
  • 124 Comments
Joined 1 year ago
cake
Cake day: June 20th, 2023

help-circle





  • The inspector REPL evaluates as a statement-with-value (like eval), so the {} at the beginning is considered an empty block, not an object. This leaves +[], which is 0. I don’t know what would make Node differ, however.

    Edit: Tested it myself. It seems Node prefers evaluating this as an expression when it can, but explicitly using eval gives the inspector behavior:















  • I present to you quality variable names. (and a Mount Rustmore)

    (Reconfigure(f), 'c') => {
        let mut p: Vec<&str> = vec![];
        loop {
            match args.next() {
                Some(k) => {
                    if k == "=" {
                        match args.next() {
                            None => q("need value for Rc"),
                            Some(v) => u(
                                f,
                                |f| Box::new(
                                    |c| {
                                        f(c);
                                        c.set(p.iter().copied(), v);
                                        for e in p {
                                            unsafe {
                                                Box::<str>::from_raw(
                                                    std::mem::transmute(e)
                                                );
                                            }
                                        }
                                    }
                                )
                            )
                        };
                        break
                    } else {
                        p.push(Box::leak(k.into()));
                    }
                }
                None => error("need path element or = for Rc"),
            }
        }
    },