Index

Show enters and exits. Hide enters and exits.

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