Show enters and exits. Hide enters and exits.
| 07:20:19 | halorgium | hmm, is this code meant to work? |
| 07:20:21 | halorgium | k = ["a", "b", "c"]; k.each {|x| k.delete(x); puts x.inspect} |
| 07:21:37 | halorgium | https://gist.github.com/40c3a4f31a2be3d58403 |
| 08:22:16 | cyndis | halorgium: mutation while iterating officially has undefined behavior |
| 08:24:31 | halorgium | cyndis: yer, merb uses it ;) |
| 08:25:11 | halorgium | another fun bug: http://github.com/evanphx/rubinius/issues#issue/402 |
| 08:33:26 | cyndis | it seems that rbx does all the logic in Struct.new and never calls #initialize |
| 08:34:25 | halorgium | yer |
| 08:34:51 | halorgium | do you know the prescribed way of using the json gem with rbx? |
| 08:35:22 | cyndis | afaik the native json gem doesn't work, but json-pure and yajl-json's json compatibility do work |
| 08:36:52 | halorgium | might have to make a meta-gem which depends and changes $: so json/ext isn't attempted |
| 08:37:28 | cyndis | ah, it seems that git json now works on rubinius |
| 08:37:29 | halorgium | is there a way to say "this gem is for rbx only" ? |
| 08:37:44 | cyndis | nope |
| 08:38:25 | cyndis | (that is, evanphx/json, it seems :) |
| 08:39:41 | halorgium | yer, saw that change |
| 08:39:55 | halorgium | so it was just a header issue |
| 08:41:17 | cyndis | yep. |
| 09:13:43 | dbussink | halorgium: guess that usage should change in merb then |
| 09:33:43 | halorgium | dbussink: yer, it is amazing it works in MRI ;) |
| 09:34:10 | dbussink | halorgium: well, the behavior of mri is the standard usually |
| 09:34:20 | dbussink | but matz actually defined this as undefined behavior |
| 09:34:27 | halorgium | dbussink: nah, i mean the merb impl |
| 09:34:36 | dbussink | so it might change in mri at some point too |
| 09:34:46 | halorgium | it kinda works by mistake |
| 09:41:23 | halorgium | cyndis: Struct looks crazy to me, that initialize is somehow copied from the Struct subclass to instances of the Struct-subclass in MRI |
| 09:56:58 | dbussink | hmm, doing X < Struct is probably recipe for weirdness |
| 10:03:18 | halorgium | dbussink: tis weird cause the Struct and Struct.new(:x) share the same class |
| 10:10:50 | halorgium | heh, Struct.method_defined?(:[]) && Struct.method(:[]) |
| 10:10:50 | halorgium | NameError: undefined method `[]' for Struct |
| 10:54:40 | halorgium | is it possible to traverse the ancestry of a method? |
| 10:56:22 | dbussink | halorgium: you mean going up to modules / superclasses where a method is also defined? |
| 10:58:16 | halorgium | something like: Y.ancestors.map {|x| pp((x.instance_method(:initialize) rescue nil))} |
| 10:58:20 | halorgium | ;) |
| 11:07:14 | halorgium | heh, 1.methods is busted :/ |
| 11:15:19 | dbussink | halorgium: if you find issues like that, best is to open an issue on github for it |
| 11:15:24 | dbussink | so it's not forgotten |
| 11:21:44 | halorgium | dbussink: finding alot of random issues :) |
| 11:22:01 | dbussink | halorgium: just poking at things? |
| 11:22:10 | halorgium | dbussink: trying to get things working |
| 11:22:24 | halorgium | mainly trying to understand how Struct works now |
| 11:22:42 | halorgium | can i turn a R::CompiledMethod into ruby? |
| 11:22:47 | dbussink | halorgium: i removed some stuff locally here that at least fixes the initialized issue |
| 11:23:10 | dbussink | i removed the self.specialize_initialize in kernel/delta/struct.rb to test |
| 11:23:12 | halorgium | you mean the specialize |
| 11:23:16 | halorgium | yer |
| 11:23:51 | halorgium | dbussink: that seemed like a optimization or something |
| 11:24:01 | dbussink | i have no idea why it's there, because all specs still pass |
| 11:24:10 | dbussink | that's my guess too yeah |
| 11:26:17 | halorgium | dbussink: http://github.com/halorgium/rubinius/tree/metadata |
| 11:26:23 | halorgium | does that patch look sane? |
| 11:26:30 | halorgium | i should probably write the fail test |
| 11:27:23 | dbussink | i don't really get what you're trying to do exactly yeah :) |
| 11:27:37 | dbussink | but you can't turn a compiledmethod back into ruby afaik |
| 11:27:39 | halorgium | dbussink: fix CompiledMethod metadata ;) |
| 11:27:49 | halorgium | dbussink: oh, that patch is unrelated |
| 11:28:42 | halorgium | if you get the InstructionSequence, you basically have the sexp for the method |
| 11:29:14 | halorgium | that plus the Literals might allow it |
| 11:31:37 | halorgium | => #<Method: Rubinius::InstructionSequence#show (defined in Rubinius::InstructionSequence at lib/compiler/iseq.rb:311)> |
| 11:31:44 | halorgium | far too much useful information :P |
| 11:31:56 | dbussink | hehe, it allows for a lot of inspection yeah :) |
| 11:32:39 | halorgium | is there a opcode registry? |
| 11:33:10 | halorgium | ah, Encoder |
| 11:35:28 | dbussink | halorgium: i have the idea you feel like you're in a playground :P |
| 11:36:54 | halorgium | dbussink: i had forgotten how insane rbx was :P |
| 11:37:02 | halorgium | trying to get a monster app running with it |
| 11:37:09 | dbussink | hitting many issues then? |
| 11:37:15 | dbussink | or does it use a lot of exotic stuff? |
| 11:37:34 | halorgium | mostly edge cases |
| 11:37:40 | halorgium | like the merb fail |
| 11:38:06 | halorgium | do you know where CompiledMethod#add_metadata is tested? |
| 11:39:07 | dbussink | probably nowhere |
| 11:39:27 | dbussink | not all those internals are all specced completely |
| 11:40:17 | dbussink | if you want to add some, it would belong in spec/core/compiledmethod/ |
| 11:41:02 | dbussink | halorgium: but you want to add to_sexp to a instruction sequence? |
| 11:42:04 | halorgium | perhaps |
| 11:42:36 | halorgium | do you know what [:find_const, 1] means? |
| 11:42:42 | halorgium | as in, what does the 1 mean? |
| 11:42:57 | halorgium | literals are: => #<Rubinius::Tuple: :__class__, :STRUCT_ATTRS, :length, :<=, :ArgumentError, nil, "Expected ", :size, :to_s, ", got ", :raise, #<Rubinius::CompiledMethod initialize file=kernel/common/struct.rb>, :each_with_index> |
| 11:44:05 | halorgium | ah |
| 11:44:16 | halorgium | looks like an Opcode has @args=[:index] |
| 11:44:28 | dbussink | halorgium: you should check out vm/instructions.def for the instructions and documentation |
| 11:44:32 | dbussink | what they do to the stack etc. |
| 11:44:34 | dbussink | what they expect |
| 11:45:17 | halorgium | dbussink: yer, it looks like it is in ruby |
| 11:45:24 | halorgium | Rubinius::InstructionSet.opcodes.find {|x| x.opcode == :find_const} |
| 11:48:00 | dbussink | halorgium: well, if you want to create a sexp you need to reconstruct nesting etc. too |
| 11:48:09 | dbussink | it's just a flat list of opcodes you get from an iseq |
| 11:48:57 | halorgium | yer, but they have stack transformations too |
| 11:49:11 | dbussink | that's true, so it should be possible then yeah |
| 11:49:27 | dbussink | any specific goal for this or just playing with it? |
| 11:49:41 | dbussink | i'd love to have something that can turn a proc / block into a sexp :P |
| 11:51:27 | halorgium | suck |
| 11:51:28 | halorgium | PrimitiveFailure: Tuple#[] primitive failed |
| 11:55:00 | dbussink | halorgium: where is that happening? |
| 11:59:53 | halorgium | dbussink: https://gist.github.com/ac8d4e1346d3139064b7 |
| 12:00:05 | halorgium | dbussink: oh, it was happening when i was haxing Tuplez |
| 12:03:17 | halorgium | dbussink: added the inner block |
| 12:11:58 | halorgium | i wonder how much work it would be to get the ruby2ruby sexp processor to handle these opcodes |
| 12:13:23 | halorgium | ah, interesting |
| 12:14:52 | dbussink | halorgium: is it easy to add? |
| 12:16:23 | halorgium | dbussink: add what? |
| 12:18:04 | dbussink | halorgium: to use the ruby2ruby sexp processor to handle this |
| 12:18:21 | halorgium | oh, not sure |
| 12:18:41 | halorgium | dbussink: i just found out i reimplemented CompiledMethod#decode :) |
| 12:20:04 | dbussink | hehe, but i'm going to head off |
| 12:20:28 | dbussink | going to watch the world cup final at a friend tonight |