Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

mruby hacking guide

ksss
April 19, 2014

mruby hacking guide

大江戸Ruby会議04 Ninja Talks
http://regional.rubykaigi.org/oedo04/

ksss

April 19, 2014
Tweet

More Decks by ksss

Other Decks in Programming

Transcript

  1. about me { name: "Yuki Kurihara", twitter: "@_ksss_", github: "ksss",

    commit: "mruby(59)", since: "Feb 26, 2014" }
  2. “Bad programmers worry about the code. Good programmers worry about

    data structures and their relationships.” Linus Torvalds
  3. RString struct RString { MRB_OBJECT_HEADER; mrb_int len; union { mrb_int

    capa; struct mrb_shared_string *shared; } aux; char *ptr; };
  4. RString struct RString { MRB_OBJECT_HEADER; union { struct { mrb_int

    len; union { mrb_int capa; struct mrb_shared_string *shared; } aux; char *ptr; } heap; char ary[RSTRING_EMBED_LEN_MAX + 1]; } as; };
  5. 昔のHash#each #call-seq: # hsh.each {|k, v| block} -> hsh #

    hsh.each -> an_enumerator def each(&block) self.keys.each{|k| block.call([k, self[k]]) } self end
  6. !?

  7. 昔のHash#each #call-seq: # hsh.each {|k, v| block} -> hsh #

    hsh.each -> an_enumerator def each(&block) self.keys.each{|k| block.call([k, self[k]]) } self end
  8. hash[a]=1 a 1 0 1 0 1 0 1 0

    hash function empty del
  9. hash[b]=2 b 1 hash function a b 1 0 0

    0 0 0 1 0 1 2 empty del
  10. hash[b]=2 b 1 hash function del b 1 0 0

    1 0 0 1 0 - 2 empty del
  11. FOE