Index

Show enters and exits. Hide enters and exits.

09:28:37danlucrafttest, yo
09:28:45dbussinkdanlucraft: yoyoyo
09:29:15danlucraftI really need to rewrite the log server
11:02:59dbussinkdanlucraft: crash prone?
11:03:08danlucraftonce a month?
11:03:53danlucraftI'd like to be able to use it on multiple channels more easily too
11:04:03danlucraftand pull out stats for individual users
11:07:23dbussinkdanlucraft: yeah, a nice interface for that would be cool tool
11:07:44danlucraftjust got to find the time.....
11:07:51dbussinkmore like how irc clients look like, with a channel list etc.
11:07:59danlucraftyeah, that kind of thing
11:08:13dbussinkthere's also irclogger.com but the interface is ugly
11:08:17danlucrafteven though its so incredibly simple, I think these logs look very attractive
11:08:18danlucraftright
11:08:50dbussinkyour's definitely look a lot nicer :0
11:08:51dbussink:)
11:09:03danlucraftcheers :)
12:20:32eransis there a command in rubinius (or in Ruby in general) that can get the byte code at runtime, similar to Python's func_code ?
12:20:42erans(oh, and hello everyone :-) )
12:21:19eransis someone awake here?
12:33:26kronos_vanoerans, give an example pls
12:33:43eransin Python if I write a function like:
12:33:47eransdef doit(a, b)
12:33:51erans return a + b
12:34:01eransI can then call doit.func_code to get the byte code of that function
12:34:23eransI read that YARV and Rubinius are 2 Ruby VMs that generates byte code (which is different between the two)
12:34:40eransthe question is whether I can get that byte code the same way I do so in Python
12:40:28eransthere was a module called "yasm" that did that in YARV
12:41:19eransbut I read YARV is the default VM for Ruby 1.9, so it probably should be in the default 1.9.1 release, right?
12:41:26cyndisCompiledMethod#decode seems to return the opcodes
12:42:06eransis that a function? class? what?
12:42:20cyndismethod(:my_method).executable.decode
12:42:57cyndisthey are not returned as a bytecode stream, though, but as a decoded array
12:43:08eranshow can I get a byte stream
12:43:15eransfrom which I can save it and run it somewhere else?
12:43:41eransI'm rather new to Ruby and originally a Pythonist, so, lets say I have this code:
12:43:44eransclass Test
12:43:50eransdef doit
12:43:53eransputs "hello"
12:43:54eransend
12:43:54eransend
12:44:00eransHow do I get the code of "doit" ?
12:44:46cyndisthat i haven't found out yet, your best bet is probably to wait until the core devs in america wake up
12:45:04eransok
12:45:29eransthanks cyndis
12:45:45eransso the executable.decode is relevant?
12:45:53eransif so, how do I run it on the sample I gave above
12:45:54erans?
12:46:38eranshmm
12:46:38eransok
12:46:41cyndisTest.instance_method("doit").executable.decode
12:46:42eransI figured that on Rubinius
12:46:43erans:-)
12:46:44eransthanks
12:46:47cyndisnp :)
12:47:03eransDo you happen to know if something like this is also available in YARV?
12:47:13cyndisnope, haven't used 1.9 that much
12:48:11eransk
12:48:13eransthanks
13:00:09kronos_vanoerans, http://pastie.org/851547
13:00:18kronos_vanofor example
13:00:53eranskronos_vano: this works in Rubinius or YARV?
13:01:02kronos_vanorubinius
13:01:06kronos_vanobin/rbx
13:01:09eransok
13:01:11kronos_vanoand go...
13:01:13kronos_vano:)
13:01:26eransand can I take that piece of byte code and be able to run it somewhere else?
13:01:43eransi.e. do an "encode" operation?
13:01:47kronos_vanohm, about it dunno
13:03:34eransokk
13:03:36eransthanks
17:05:06evandbussink: no, bin/rbx should not take irb options directly.
17:14:17evanyou can pass them in directly already if you really want
17:14:24evanbin/rbx -- --simple-prompt
17:14:39evanor, more clearly, bin/rbx -S irb --simple-prompt
17:14:57brixenevan: defined?("#{puts}") calls puts in 1.8 but not 1.9
17:15:04brixenevan: I'm inclined to follow 1.9
17:15:06evanawesome!
17:15:10evando it.
17:15:12brixenyeah, how fun eh?
17:15:15brixenk
17:15:35evan2560 tests, 10659 assertions, 18 failures, 20 errors
17:15:38evanthats for actionpack
17:15:40evanalmost there!
17:16:26brixenwow, sweet!
17:16:48evansome are bad tests, like the one i'm working on now is a hash ordering bug
17:21:54rueIt seems disjoint
18:27:21evanbrixen: poke
18:28:19brixenyes
18:28:34brixens/yes/ouch/
18:28:48evani can't figure out how the stages work in the compiler
18:28:53evanwhere is @input set?
18:29:00brixenok
18:29:10evani'm trying to figure out what code looks into a VariableScope to populate the locals
18:29:26evani see there is an accessor for input
18:29:43brixenwhere are you starting from?
18:29:46evanwell
18:29:49evani'm in compiler.rb
18:29:53evanin compile_eval
18:30:03brixenk
18:30:09evani see that the root is an AST::EvalExpression
18:30:15evanand there is an input method there
18:30:22evanbut that can't be the same input method
18:30:24brixenline 84
18:30:32evanthat can't be the same
18:30:46evanas sets the input used in stages.rb:139
18:31:23brixen220
18:31:58brixencompiler = new :string, :compiled_method => the first stage is the StringParser
18:32:03evanok...
18:32:32brixenwhat's the code look like?
18:32:35evanis the Generator stage used?
18:32:41evanthe code is the code in compiler
18:32:42brixenyes
18:32:45evanhow?
18:32:46evanwher?
18:32:50evani can't see how
18:33:03evanby this next_stage thing?
18:33:08brixenrun_next
18:33:17brixenstages are a linked list of objects
18:33:25brixencreated when you create the compiler
18:33:35brixenthe first stage starts process and calls run_next
18:33:38brixenuntil the end
18:33:58evanthis seems very brittle
18:34:02evanon line 139
18:34:06evanit's setting variable_scope on @input
18:34:15evanand @input is supposed to be a stage
18:34:27evanbut there is no variable_scope method on any stage except for Generator
18:34:29brixen@input is data
18:34:37brixenwhy would @input be a stage?
18:34:42evani dunno.
18:34:50evanwhy does run not take input as an argument?
18:35:21brixenbecause the api for run could differ
18:35:31brixenthe stage sets up data and calls run
18:35:48brixenit could be different, but before we ask why, I'd like to understand the problem
18:36:00evani'm just trying to get my head around it
18:36:15brixenwell, there are 3 basic things: stages, data, processors
18:36:23brixendata flows through the stages and is modified
18:36:38brixenAST becomes an opcode stream, etc
18:36:53brixenin between, stuff may process the data but not transform it, like the printers
18:37:17brixendifferent data structures may need more stuff, like the variable_scope structure
18:37:35evanok
18:37:36brixenthe compiler is an abstration of a certain set of stages
18:37:41brixenlinked from beginning to end
18:37:54brixenstring -> AST is one type of compiler
18:38:03brixenstring -> compiled_method is another type
18:38:20brixenwhich passes through AST, symbolic bytecode, encoded_bytecode
18:38:21brixenetc
18:38:35brixenthe run/run_next api is for simplicity
18:39:15brixengenerally stages have an API on both sides, to insert a stage (like a printer), it just needs to accept the previous stages ouput and provide the next stages input
18:39:22evanok
18:39:26evanhere is part of my confusion
18:39:45evanline 84 of compiler.rb
18:40:00evanoh, thats StringParser#input
18:40:04brixenyes
18:40:11evani think it's confusing because thats just compiler.parser
18:40:19evanbut it happens to return a StringParser only
18:40:27brixenwell, the parser may be different
18:40:38brixenStringParser takes different input than FileParser
18:40:41evanoh
18:41:00evanthe Compiler#initialize decides on a parser
18:41:10brixenyes
18:41:21brixenline 79 of compiler.rb sets up the compiler
18:41:24evanso
18:41:44evani think this a bit confusing because of the use of symbolic names for things at random places
18:42:01evanlike #initializing taking the names of 2 stages
18:42:01brixenthe symbolic names are an indirection
18:42:04evanrather than 2 stage classes
18:42:16brixenI did not want concrete classes there
18:42:36brixenyou could substitute a different kind of StringParser
18:42:40brixenie different class
18:43:01brixensee stages.rb 8-11
18:43:19brixenstages register themselves symbolically to the compiler
18:43:33evanright
18:43:36brixenthe compiler should not care if it's a StringParser or a NetworkStringParser
18:43:37evanhm,
18:43:41evanok, i think I get it.
18:43:55evanwhy did you not want concrete classes?
18:43:57brixenit just knows that to create a compiler from :string to something, it starts with the :string stage
18:44:06brixenbecause it was a total pain before
18:44:10evanbecause you wanted to be able to say "no, :string is AwesomeStringParser now" ?
18:44:13brixenI couldn't inject stufff
18:44:15brixenyes
18:44:34brixenthat's related to how you can inject printers anywhere in the stage pipeline
18:45:17brixena "compiler" becomes just a series of stages
18:45:50evanso run and run_next take no args so that a stage can see the data and not do anything with it
18:45:51brixenyou can tweak anything and not a single line of compile_eval should have to change
18:45:56evanand it is automatically passed to the next stage
18:46:11brixenwell, that was to let the API between stages be more complex
18:46:23brixena stage would take 5 inputs, or whatever
18:46:44brixenthe previous stage has to match up outputs or settings with what the next stage expects
18:46:54brixenbut that's between 2 stages, nothing to do with the compiler
18:46:58evanok
18:47:02evanso in compile_eval
18:47:09evani can only reason that there are 2 stages
18:47:14evanStringParser and Packager
18:47:17evanbut there must be others
18:47:24brixenwell, you can ask for any stage
18:47:31brixenyou might get nil back
18:47:31evanbecause Packager takes other stuff
18:47:36evanumm..
18:47:37brixenif the stage doesn't exist
18:47:39evani don't see how that helps.
18:47:45brixenhelps what?
18:47:48evani'm trying to figure this specific case out
18:47:52evanin compile_eval
18:47:57evanwhat stages are composed
18:48:06brixenthat depends! :)
18:48:40evanle sigh.
18:48:49brixenlook at stages.rb
18:48:54evani'm there.
18:48:55brixenline 216
18:49:08brixenStringParser is a :string stage
18:49:14evanok, yes, next_stage
18:49:15evanok
18:49:21brixenit, by default, says that Generator comes next
18:49:30brixen*it doesn't have to be Generator* though
18:49:39brixenthat can be changed by something else
18:49:47brixenbut if you didn't change it, Generator is next
18:49:48evanlook on line 105
18:49:51evanof compiler.rb
18:50:00brixenline 124 of stages.rb
18:50:10brixenGenerator is a :bytecode stage
18:50:17brixenby default, Encoder comes next
18:50:24evanthats creating a StringParser and passing it :compiled_method
18:50:39evanso it goes straight from StringParser to Packager?
18:50:43brixenno
18:50:49brixenlook at 130 in stages.rb
18:50:58evanis confused.
18:50:58brixenall stages are a Stage
18:51:02evancall me.
18:51:03brixenc'mon
18:51:25evanooooh
18:51:26evanfuck me.
18:51:33evana stage takes the LAST stage to run
18:51:35evannot the next stage to run.
18:51:38evanas an argument.
19:18:04rueA bit YAreGNI, but helpful overview
20:33:40dbussinkevan: still fighting with rails tests or getting there?
20:34:00evangetting there
20:34:06evanchipping away
20:40:12dbussinkevan: hitting any big issues or all small edge cases?
20:45:13evansmallish stuff
20:45:18evannot too bad
20:45:23evanjust takes time to track them down
20:45:24evanoff to lunch!
20:53:10dbussinkevan: are you fixing stuff in regexp?
20:53:23dbussinkevan: since i seem to have a reproducable crash in them
21:12:55evandbussink: oh yes!
21:13:01evanwhy haven't you put in a ticket about your crash?
21:13:02evani need it!
21:13:13dbussinkhehe, i'm gathering some more information :)
21:13:23dbussinkit's basically http://github.com/evanphx/rubinius/issues#issue/135 continued
21:14:40dbussinkevan: https://gist.github.com/af3041fb06a7aa6a3c31
21:16:13mahargwhy is webrick even still around
21:17:16dbussinkmaharg: it's the standard pure ruby web server
21:17:23dbussinkso that's not that weird
21:18:25dbussinkmaharg: and debugging without mongrel c parts or a whole event machine environment makes it easier
21:18:28rueThere is no full replacement, I suppose, though Rack could be with a simple top layer.
21:19:15dbussinkevan: how helpful is that gist? if you need more specific info on some objects i can provide it :)
21:33:31kronos_vanohates 1.9 string encodings hell
21:39:24brixenkronos_vano: so you generally agree with http://is.gd/9xK00 ?
21:39:51evanticket 135 is basically useless
21:40:12evanit's never provided any details
21:40:19evando you have the reliably?
21:40:21kronos_vanobrixen, I think yes
21:40:34kronos_vanoand you?
21:40:51brixenkronos_vano: it was interesting to hear all that, I haven't written any encoding programs yet
21:41:14brixenkronos_vano: but I can certainly see the points, especially the different program behavior on different systems
21:41:39brixenkronos_vano: I'd rather encodings were a library personally
21:41:58brixenand I wouldn't allow utf-8 scripts either
21:42:02dbussinkevan: i've added a link to a gist with a backtrace
21:42:13dbussinkevan: and it reliably crashes in gdb for me
21:42:27dbussinkevan: on a request on /posts in that example
21:42:32evanis that an empty rails 2.3.5 app?
21:42:37evani need all the details
21:43:10dbussinkevan: all the steps are in there, create an empty 2.3.5 app, create a scaffold, migrate it, hit the web server on that table
21:43:19dbussinkevan: and boom
21:43:54evandbussink: you're DEV=1 output can't be right
21:43:58evandid you do vm:clean first?
21:44:17evanoh oh
21:44:18evanduh.
21:44:19dbussinki did a rake clean before
21:44:22evanit's a runaway recursion.
21:44:25evanlook how long the backtrace is.
21:44:34dbussinkyeah, noticed that too
21:44:44evananything over 1000 frames is 99.99% of the time a runaway recursion
21:45:01dbussinkthe backtrace in gdb is not the same each time, but each time it's huge :)
21:45:14evanright
21:45:18dbussinkso at some moment it probably corrupts something due to the recursion
21:45:19evanhm
21:45:25evanthe stack
21:45:33evanat some point, you get a segfault because there is no more stack
21:45:47evanand then gdb inspecting the stack does not go well
21:46:52evanmmm
21:46:54evanit's in a seperate thread
21:47:09evani wonder if the stack depth check guard broke for threads other than the primary one
21:47:19evani'll look shortly
21:47:29evandbussink: btw, why did you say this was Regexp related?
21:47:32dbussinknp, the repro should be relatively easy
21:47:44dbussinkevan: first time it crashed 2x in a row inside regexp handling
21:47:52dbussinkbut that was a coincedence then :)
21:47:55evanwith a giant stack?
21:48:18dbussinkyeah, giant stack monster was hiding there too
21:49:15evanhah
21:49:18evank :)
21:50:07dbussinkevan: but i'm going to head for bed, if you need more info i can help out tomorrow :)
21:51:10dbussinknite!
21:52:11maharg"What other language requires you to understand this level of complexity just to work with strings?!"
21:52:16mahargany that allows multiple encodings?
21:52:24mahargit's not a unique issue to ruby
21:52:25evandbussink: np. nite!
21:52:49maharginternationalization is hard and there are no easy answers
21:53:53evanbeing an american and native english speaker, i'm not knowledgable enough about encodings to know whats right
21:54:04evanpersonally, i'll happily defer to someone that has to deal with encodings daily.
21:56:06dbussinkprobably only people in countries with non western writing like japan and china
21:56:23dbussinkeveryone else can basically shove most of it in utf-8 without too much hassle
21:56:48brixenthe thing is, 1.9 does some things that are not obvious and you need to learn them all to understand code you read
21:57:01brixenlike when a symbol or string literal has a particular encoding
21:57:17brixenboundary transcoding on IO objects with eg r:from:to is nice
21:57:33brixenand it's probably sufficient to do most things
21:57:48brixenutf-8 for writing code is extraneous
21:58:08brixenwe don't *need* snowman characters in code
21:58:19evansure we do.
21:58:27brixenheh
21:58:27evani need a biohazard local variable.
21:58:33brixenindeed
21:58:39evanso people know it's important
21:58:47dbussinki even hate code in dutch
21:59:44evani think stating that a file of code that be ANY encoding sounds scary.
21:59:45evanpersonally.
21:59:54evanbut I'm a wimp.
22:00:45mahargI think the problem there is an issue of a babel effect. I don't want to get a gem with japanese encoded variable names in it. My ability to discern even gibberishy english variables is still higher than my ability to discern foreign glyphs even when meaningful.
22:01:17mahargit's perhaps unfortunate that roman characters are lingua franca in programming, but that boat sailed a long time ago
22:01:38brixenthe third roman conquest, programming languages :)
22:01:42dbussinkmaharg: i write all my code in english, i find reading code in any other language is weird
22:01:48dbussinkeven it's my mother tongue
22:02:05dbussinkmicrosoft did that to excel, which is really horrible
22:02:17dbussinkif / then statements translated make me shiver
22:02:42evandbussink: i'd use that if they provide a swedish chef translation too
22:03:14mahargrue: sure it is. ascii-7 or ascii-8 present a much more limited character set to work from, one that excludes foreign glyphs.
22:03:14evanbork i == 9; york puts "bork bork bork"; smork
22:03:15dbussinkevan: hehe, don't think microsoft accepts community translations of vba :P
22:03:30dbussinkshould write al alternative grammer for mri that does that :)
22:03:38dbussinkshould be easy ;)
22:03:54evanthe idea of a heavily diverse glyph set for source code has been tried
22:03:59evanjust look at APL
22:04:05evanit failed miserably.
22:11:27evanoh the joys of rails metaprogramming optimizations
22:11:33evanthey expose so many little bugs
22:12:05evanlike, it appears that we're over escaping a regexp somewhere, and rails is doing #{regexp.inspect} to insert the regexp into some dynamic code
22:12:09evanwhich then fails to parse.
22:19:38evanbrixen: compile -S rocks.
22:23:54brixensweet
22:24:01evanlooks like
22:24:04brixenI've been using it a ton on the defined? stuff too
22:24:10evan /admin\/.+/
22:24:14evanisn't coming through right
22:24:18evanthere is extra escaping in it
22:24:22brixenhmm
22:24:23evantracking it down now
22:24:32evantry it, you'll see it comes out with
22:24:39evan"admin\\/.+" as the source
22:25:11brixenhm yeah
22:25:32evani see the extra escaping in -A, -B, and -S
22:25:39evanso i'm assuming that it's melbourne doing it at this point
22:25:56evansince -A should show the string straight from the parser
22:26:01brixenyeah
22:26:56rueSure that is not just inspect?
22:27:05evanhm
22:27:09evanthats a good point.
22:27:11evanhm.
22:27:46brixenhm
22:28:50evanrue is right
22:28:53evanit's just inspect
22:28:57brixenum
22:29:04evanit's String#inspect rather
22:29:11brixenI get strlen 9 printing directly from process_regex
22:29:18brixenshould have 8 chars no?
22:29:27brixena d m i n \/ . +
22:29:40evanthats 9
22:29:45evansee, this is the confusion
22:29:49brixen\/ is one
22:29:52evana d m i n \ / . +
22:29:53evanno
22:29:54evanit's 2
22:30:00brixenhuh?
22:30:19brixen?\/ => 47
22:30:25brixenit should be one or it is one?
22:30:32brixen\/ should be one char in a string
22:30:32evanneither.
22:30:33evan:)
22:30:38evanno no
22:30:39evanit's not one.
22:30:57brixenhah
22:31:02brixenyou lost me
22:31:03evan>> /admin\/.+/.source.split("")
22:31:03evan=> ["a", "d", "m", "i", "n", "\\", "/", ".", "+"]
22:31:13evanthats from irb.
22:31:24brixenfor mri or rbx?
22:31:30evanmri
22:31:32evanBUT rbx is the same
22:31:32brixenok
22:31:36evani think i found the bug
22:31:38evanone sec.
22:31:51brixenso it has nothing to do with #inspect
22:32:11brixenwith #inspect misrepresenting the string I mean
22:32:31evanString#inspect, yes.
22:32:38evanRegexp#inspect is a different story.
22:33:18evanoh fun.
22:33:21evanle sigh.
22:33:44evan%r!admin/.+/!.source => "admin/.+"
22:34:01evan /admin\/.+/.source => "admin\/.+"
22:34:23brixenlovely
22:34:40evanso you'd think that \/ would become just / in the source
22:34:44evanbut it seems to maintain it.
22:40:18evanonig must handle it properly or something
22:40:28evani don't think we're striping out the extra \ in there
22:40:29evananyways
22:40:35evanit's primarily a Regexp#inspect bug.
22:47:50brixendefined? is so wack
22:50:19evanrue|Work: must be.
22:50:29evanbrixen: yes! it's it's own little runtime.
22:50:54evanhow meta. using a Regexp in Regexp#inspect to escape the output properly
22:52:27mahargso if defined?("#{blah}") doesn't call blah, what exactly are you testing is defined?
22:53:15brixenmaharg: what are you testing if it *does* call #blah?
22:53:16binary42maharg: a string literal.
22:53:38brixenbinary42: well, a string, it's not really a literal but should result to a string
22:53:53brixenmaharg: 1.8 and 1.9 disagree about calling #blah there
22:53:59mahargI don't honestly know what you're testing either way heh
22:54:03mahargor why you would
22:54:03binary42brixen: defined? to me is expression classification.
22:54:05brixenbut in general, defined? calls methods
22:54:35brixendefined?(f.b::IO) and all manner of other call types
22:54:52brixendefined?(f.b == 2)
22:54:53maharghuh, I didn't realize defined? returned more info than a boolean
22:54:54brixenetc
22:55:30brixendefined?((a, b = 1, 2)) => "assignment"
22:55:41mahargthat is some seriously wacky introspection
22:55:58mahargalmost like the sort of thing people drool over in C++ template metaprogramming
22:56:16evanin 1.8, defined? is a sub interpreter
22:56:17binary42Yeah. I don't see the point of things like assignment checks.
22:56:20brixenit is seriously wacky agreed
22:56:29evana whole different AST interpreter
23:02:55brixenoh fun
23:03:20brixenif there is an autoload for :Foo, defined?(Foo) => "constant" but the autoload is not triggered
23:03:30evanUG.
23:03:38brixenI bet rails uses this
23:03:40brixensomewhere
23:03:45evanprobably
23:03:49brixenI shudder at the thought
23:03:52brixenle sigh
23:03:57evanignore that one
23:04:03evanthats going to require a bunch more work i think.
23:04:29brixenI'm trying to forget the things I know about defined? now
23:04:48brixenwe'll let jruby run into them first :)
23:06:41evanheh
23:07:03evanthis is a fun regexp:
23:07:11evan%r!(^|[^\\])/!
23:08:09evanwhats that match?
23:08:14evanthis is your quiz for the day.
23:10:31brixenthe character before a /?
23:11:15evanand?
23:12:41evani guess it's pretty easy actually
23:12:52evanit also matches a / at the beginning
23:13:08evanusing ^ in an or seemed cute
23:13:22brixenyes $1 may be ""
23:14:43evanuseful!
23:15:48maharggsub(%r{(^"|"$)}, "'")
23:16:13brixenhm, somehow I ended up with a file named :w
23:16:20evanbrixen: hehe
23:16:27evanthat happens to me sometimes
23:16:46brixenahh, I see
23:16:59brixenforgot I typed :w and typed it again
23:24:08evanoh rails tests, you're so crazy.