Show enters and exits. Hide enters and exits.
| 09:28:37 | danlucraft | test, yo |
| 09:28:45 | dbussink | danlucraft: yoyoyo |
| 09:29:15 | danlucraft | I really need to rewrite the log server |
| 11:02:59 | dbussink | danlucraft: crash prone? |
| 11:03:08 | danlucraft | once a month? |
| 11:03:53 | danlucraft | I'd like to be able to use it on multiple channels more easily too |
| 11:04:03 | danlucraft | and pull out stats for individual users |
| 11:07:23 | dbussink | danlucraft: yeah, a nice interface for that would be cool tool |
| 11:07:44 | danlucraft | just got to find the time..... |
| 11:07:51 | dbussink | more like how irc clients look like, with a channel list etc. |
| 11:07:59 | danlucraft | yeah, that kind of thing |
| 11:08:13 | dbussink | there's also irclogger.com but the interface is ugly |
| 11:08:17 | danlucraft | even though its so incredibly simple, I think these logs look very attractive |
| 11:08:18 | danlucraft | right |
| 11:08:50 | dbussink | your's definitely look a lot nicer :0 |
| 11:08:51 | dbussink | :) |
| 11:09:03 | danlucraft | cheers :) |
| 12:20:32 | erans | is 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:42 | erans | (oh, and hello everyone :-) ) |
| 12:21:19 | erans | is someone awake here? |
| 12:33:26 | kronos_vano | erans, give an example pls |
| 12:33:43 | erans | in Python if I write a function like: |
| 12:33:47 | erans | def doit(a, b) |
| 12:33:51 | erans | return a + b |
| 12:34:01 | erans | I can then call doit.func_code to get the byte code of that function |
| 12:34:23 | erans | I read that YARV and Rubinius are 2 Ruby VMs that generates byte code (which is different between the two) |
| 12:34:40 | erans | the question is whether I can get that byte code the same way I do so in Python |
| 12:40:28 | erans | there was a module called "yasm" that did that in YARV |
| 12:41:19 | erans | but 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:26 | cyndis | CompiledMethod#decode seems to return the opcodes |
| 12:42:06 | erans | is that a function? class? what? |
| 12:42:20 | cyndis | method(:my_method).executable.decode |
| 12:42:57 | cyndis | they are not returned as a bytecode stream, though, but as a decoded array |
| 12:43:08 | erans | how can I get a byte stream |
| 12:43:15 | erans | from which I can save it and run it somewhere else? |
| 12:43:41 | erans | I'm rather new to Ruby and originally a Pythonist, so, lets say I have this code: |
| 12:43:44 | erans | class Test |
| 12:43:50 | erans | def doit |
| 12:43:53 | erans | puts "hello" |
| 12:43:54 | erans | end |
| 12:43:54 | erans | end |
| 12:44:00 | erans | How do I get the code of "doit" ? |
| 12:44:46 | cyndis | that i haven't found out yet, your best bet is probably to wait until the core devs in america wake up |
| 12:45:04 | erans | ok |
| 12:45:29 | erans | thanks cyndis |
| 12:45:45 | erans | so the executable.decode is relevant? |
| 12:45:53 | erans | if so, how do I run it on the sample I gave above |
| 12:45:54 | erans | ? |
| 12:46:38 | erans | hmm |
| 12:46:38 | erans | ok |
| 12:46:41 | cyndis | Test.instance_method("doit").executable.decode |
| 12:46:42 | erans | I figured that on Rubinius |
| 12:46:43 | erans | :-) |
| 12:46:44 | erans | thanks |
| 12:46:47 | cyndis | np :) |
| 12:47:03 | erans | Do you happen to know if something like this is also available in YARV? |
| 12:47:13 | cyndis | nope, haven't used 1.9 that much |
| 12:48:11 | erans | k |
| 12:48:13 | erans | thanks |
| 13:00:09 | kronos_vano | erans, http://pastie.org/851547 |
| 13:00:18 | kronos_vano | for example |
| 13:00:53 | erans | kronos_vano: this works in Rubinius or YARV? |
| 13:01:02 | kronos_vano | rubinius |
| 13:01:06 | kronos_vano | bin/rbx |
| 13:01:09 | erans | ok |
| 13:01:11 | kronos_vano | and go... |
| 13:01:13 | kronos_vano | :) |
| 13:01:26 | erans | and can I take that piece of byte code and be able to run it somewhere else? |
| 13:01:43 | erans | i.e. do an "encode" operation? |
| 13:01:47 | kronos_vano | hm, about it dunno |
| 13:03:34 | erans | okk |
| 13:03:36 | erans | thanks |
| 17:05:06 | evan | dbussink: no, bin/rbx should not take irb options directly. |
| 17:14:17 | evan | you can pass them in directly already if you really want |
| 17:14:24 | evan | bin/rbx -- --simple-prompt |
| 17:14:39 | evan | or, more clearly, bin/rbx -S irb --simple-prompt |
| 17:14:57 | brixen | evan: defined?("#{puts}") calls puts in 1.8 but not 1.9 |
| 17:15:04 | brixen | evan: I'm inclined to follow 1.9 |
| 17:15:06 | evan | awesome! |
| 17:15:10 | evan | do it. |
| 17:15:12 | brixen | yeah, how fun eh? |
| 17:15:15 | brixen | k |
| 17:15:35 | evan | 2560 tests, 10659 assertions, 18 failures, 20 errors |
| 17:15:38 | evan | thats for actionpack |
| 17:15:40 | evan | almost there! |
| 17:16:26 | brixen | wow, sweet! |
| 17:16:48 | evan | some are bad tests, like the one i'm working on now is a hash ordering bug |
| 17:21:54 | rue | It seems disjoint |
| 18:27:21 | evan | brixen: poke |
| 18:28:19 | brixen | yes |
| 18:28:34 | brixen | s/yes/ouch/ |
| 18:28:48 | evan | i can't figure out how the stages work in the compiler |
| 18:28:53 | evan | where is @input set? |
| 18:29:00 | brixen | ok |
| 18:29:10 | evan | i'm trying to figure out what code looks into a VariableScope to populate the locals |
| 18:29:26 | evan | i see there is an accessor for input |
| 18:29:43 | brixen | where are you starting from? |
| 18:29:46 | evan | well |
| 18:29:49 | evan | i'm in compiler.rb |
| 18:29:53 | evan | in compile_eval |
| 18:30:03 | brixen | k |
| 18:30:09 | evan | i see that the root is an AST::EvalExpression |
| 18:30:15 | evan | and there is an input method there |
| 18:30:22 | evan | but that can't be the same input method |
| 18:30:24 | brixen | line 84 |
| 18:30:32 | evan | that can't be the same |
| 18:30:46 | evan | as sets the input used in stages.rb:139 |
| 18:31:23 | brixen | 220 |
| 18:31:58 | brixen | compiler = new :string, :compiled_method => the first stage is the StringParser |
| 18:32:03 | evan | ok... |
| 18:32:32 | brixen | what's the code look like? |
| 18:32:35 | evan | is the Generator stage used? |
| 18:32:41 | evan | the code is the code in compiler |
| 18:32:42 | brixen | yes |
| 18:32:45 | evan | how? |
| 18:32:46 | evan | wher? |
| 18:32:50 | evan | i can't see how |
| 18:33:03 | evan | by this next_stage thing? |
| 18:33:08 | brixen | run_next |
| 18:33:17 | brixen | stages are a linked list of objects |
| 18:33:25 | brixen | created when you create the compiler |
| 18:33:35 | brixen | the first stage starts process and calls run_next |
| 18:33:38 | brixen | until the end |
| 18:33:58 | evan | this seems very brittle |
| 18:34:02 | evan | on line 139 |
| 18:34:06 | evan | it's setting variable_scope on @input |
| 18:34:15 | evan | and @input is supposed to be a stage |
| 18:34:27 | evan | but there is no variable_scope method on any stage except for Generator |
| 18:34:29 | brixen | @input is data |
| 18:34:37 | brixen | why would @input be a stage? |
| 18:34:42 | evan | i dunno. |
| 18:34:50 | evan | why does run not take input as an argument? |
| 18:35:21 | brixen | because the api for run could differ |
| 18:35:31 | brixen | the stage sets up data and calls run |
| 18:35:48 | brixen | it could be different, but before we ask why, I'd like to understand the problem |
| 18:36:00 | evan | i'm just trying to get my head around it |
| 18:36:15 | brixen | well, there are 3 basic things: stages, data, processors |
| 18:36:23 | brixen | data flows through the stages and is modified |
| 18:36:38 | brixen | AST becomes an opcode stream, etc |
| 18:36:53 | brixen | in between, stuff may process the data but not transform it, like the printers |
| 18:37:17 | brixen | different data structures may need more stuff, like the variable_scope structure |
| 18:37:35 | evan | ok |
| 18:37:36 | brixen | the compiler is an abstration of a certain set of stages |
| 18:37:41 | brixen | linked from beginning to end |
| 18:37:54 | brixen | string -> AST is one type of compiler |
| 18:38:03 | brixen | string -> compiled_method is another type |
| 18:38:20 | brixen | which passes through AST, symbolic bytecode, encoded_bytecode |
| 18:38:21 | brixen | etc |
| 18:38:35 | brixen | the run/run_next api is for simplicity |
| 18:39:15 | brixen | generally 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:22 | evan | ok |
| 18:39:26 | evan | here is part of my confusion |
| 18:39:45 | evan | line 84 of compiler.rb |
| 18:40:00 | evan | oh, thats StringParser#input |
| 18:40:04 | brixen | yes |
| 18:40:11 | evan | i think it's confusing because thats just compiler.parser |
| 18:40:19 | evan | but it happens to return a StringParser only |
| 18:40:27 | brixen | well, the parser may be different |
| 18:40:38 | brixen | StringParser takes different input than FileParser |
| 18:40:41 | evan | oh |
| 18:41:00 | evan | the Compiler#initialize decides on a parser |
| 18:41:10 | brixen | yes |
| 18:41:21 | brixen | line 79 of compiler.rb sets up the compiler |
| 18:41:24 | evan | so |
| 18:41:44 | evan | i think this a bit confusing because of the use of symbolic names for things at random places |
| 18:42:01 | evan | like #initializing taking the names of 2 stages |
| 18:42:01 | brixen | the symbolic names are an indirection |
| 18:42:04 | evan | rather than 2 stage classes |
| 18:42:16 | brixen | I did not want concrete classes there |
| 18:42:36 | brixen | you could substitute a different kind of StringParser |
| 18:42:40 | brixen | ie different class |
| 18:43:01 | brixen | see stages.rb 8-11 |
| 18:43:19 | brixen | stages register themselves symbolically to the compiler |
| 18:43:33 | evan | right |
| 18:43:36 | brixen | the compiler should not care if it's a StringParser or a NetworkStringParser |
| 18:43:37 | evan | hm, |
| 18:43:41 | evan | ok, i think I get it. |
| 18:43:55 | evan | why did you not want concrete classes? |
| 18:43:57 | brixen | it just knows that to create a compiler from :string to something, it starts with the :string stage |
| 18:44:06 | brixen | because it was a total pain before |
| 18:44:10 | evan | because you wanted to be able to say "no, :string is AwesomeStringParser now" ? |
| 18:44:13 | brixen | I couldn't inject stufff |
| 18:44:15 | brixen | yes |
| 18:44:34 | brixen | that's related to how you can inject printers anywhere in the stage pipeline |
| 18:45:17 | brixen | a "compiler" becomes just a series of stages |
| 18:45:50 | evan | so run and run_next take no args so that a stage can see the data and not do anything with it |
| 18:45:51 | brixen | you can tweak anything and not a single line of compile_eval should have to change |
| 18:45:56 | evan | and it is automatically passed to the next stage |
| 18:46:11 | brixen | well, that was to let the API between stages be more complex |
| 18:46:23 | brixen | a stage would take 5 inputs, or whatever |
| 18:46:44 | brixen | the previous stage has to match up outputs or settings with what the next stage expects |
| 18:46:54 | brixen | but that's between 2 stages, nothing to do with the compiler |
| 18:46:58 | evan | ok |
| 18:47:02 | evan | so in compile_eval |
| 18:47:09 | evan | i can only reason that there are 2 stages |
| 18:47:14 | evan | StringParser and Packager |
| 18:47:17 | evan | but there must be others |
| 18:47:24 | brixen | well, you can ask for any stage |
| 18:47:31 | brixen | you might get nil back |
| 18:47:31 | evan | because Packager takes other stuff |
| 18:47:36 | evan | umm.. |
| 18:47:37 | brixen | if the stage doesn't exist |
| 18:47:39 | evan | i don't see how that helps. |
| 18:47:45 | brixen | helps what? |
| 18:47:48 | evan | i'm trying to figure this specific case out |
| 18:47:52 | evan | in compile_eval |
| 18:47:57 | evan | what stages are composed |
| 18:48:06 | brixen | that depends! :) |
| 18:48:40 | evan | le sigh. |
| 18:48:49 | brixen | look at stages.rb |
| 18:48:54 | evan | i'm there. |
| 18:48:55 | brixen | line 216 |
| 18:49:08 | brixen | StringParser is a :string stage |
| 18:49:14 | evan | ok, yes, next_stage |
| 18:49:15 | evan | ok |
| 18:49:21 | brixen | it, by default, says that Generator comes next |
| 18:49:30 | brixen | *it doesn't have to be Generator* though |
| 18:49:39 | brixen | that can be changed by something else |
| 18:49:47 | brixen | but if you didn't change it, Generator is next |
| 18:49:48 | evan | look on line 105 |
| 18:49:51 | evan | of compiler.rb |
| 18:50:00 | brixen | line 124 of stages.rb |
| 18:50:10 | brixen | Generator is a :bytecode stage |
| 18:50:17 | brixen | by default, Encoder comes next |
| 18:50:24 | evan | thats creating a StringParser and passing it :compiled_method |
| 18:50:39 | evan | so it goes straight from StringParser to Packager? |
| 18:50:43 | brixen | no |
| 18:50:49 | brixen | look at 130 in stages.rb |
| 18:50:58 | evan | is confused. |
| 18:50:58 | brixen | all stages are a Stage |
| 18:51:02 | evan | call me. |
| 18:51:03 | brixen | c'mon |
| 18:51:25 | evan | ooooh |
| 18:51:26 | evan | fuck me. |
| 18:51:33 | evan | a stage takes the LAST stage to run |
| 18:51:35 | evan | not the next stage to run. |
| 18:51:38 | evan | as an argument. |
| 19:18:04 | rue | A bit YAreGNI, but helpful overview |
| 20:33:40 | dbussink | evan: still fighting with rails tests or getting there? |
| 20:34:00 | evan | getting there |
| 20:34:06 | evan | chipping away |
| 20:40:12 | dbussink | evan: hitting any big issues or all small edge cases? |
| 20:45:13 | evan | smallish stuff |
| 20:45:18 | evan | not too bad |
| 20:45:23 | evan | just takes time to track them down |
| 20:45:24 | evan | off to lunch! |
| 20:53:10 | dbussink | evan: are you fixing stuff in regexp? |
| 20:53:23 | dbussink | evan: since i seem to have a reproducable crash in them |
| 21:12:55 | evan | dbussink: oh yes! |
| 21:13:01 | evan | why haven't you put in a ticket about your crash? |
| 21:13:02 | evan | i need it! |
| 21:13:13 | dbussink | hehe, i'm gathering some more information :) |
| 21:13:23 | dbussink | it's basically http://github.com/evanphx/rubinius/issues#issue/135 continued |
| 21:14:40 | dbussink | evan: https://gist.github.com/af3041fb06a7aa6a3c31 |
| 21:16:13 | maharg | why is webrick even still around |
| 21:17:16 | dbussink | maharg: it's the standard pure ruby web server |
| 21:17:23 | dbussink | so that's not that weird |
| 21:18:25 | dbussink | maharg: and debugging without mongrel c parts or a whole event machine environment makes it easier |
| 21:18:28 | rue | There is no full replacement, I suppose, though Rack could be with a simple top layer. |
| 21:19:15 | dbussink | evan: how helpful is that gist? if you need more specific info on some objects i can provide it :) |
| 21:33:31 | kronos_vano | hates 1.9 string encodings hell |
| 21:39:24 | brixen | kronos_vano: so you generally agree with http://is.gd/9xK00 ? |
| 21:39:51 | evan | ticket 135 is basically useless |
| 21:40:12 | evan | it's never provided any details |
| 21:40:19 | evan | do you have the reliably? |
| 21:40:21 | kronos_vano | brixen, I think yes |
| 21:40:34 | kronos_vano | and you? |
| 21:40:51 | brixen | kronos_vano: it was interesting to hear all that, I haven't written any encoding programs yet |
| 21:41:14 | brixen | kronos_vano: but I can certainly see the points, especially the different program behavior on different systems |
| 21:41:39 | brixen | kronos_vano: I'd rather encodings were a library personally |
| 21:41:58 | brixen | and I wouldn't allow utf-8 scripts either |
| 21:42:02 | dbussink | evan: i've added a link to a gist with a backtrace |
| 21:42:13 | dbussink | evan: and it reliably crashes in gdb for me |
| 21:42:27 | dbussink | evan: on a request on /posts in that example |
| 21:42:32 | evan | is that an empty rails 2.3.5 app? |
| 21:42:37 | evan | i need all the details |
| 21:43:10 | dbussink | evan: 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:19 | dbussink | evan: and boom |
| 21:43:54 | evan | dbussink: you're DEV=1 output can't be right |
| 21:43:58 | evan | did you do vm:clean first? |
| 21:44:17 | evan | oh oh |
| 21:44:18 | evan | duh. |
| 21:44:19 | dbussink | i did a rake clean before |
| 21:44:22 | evan | it's a runaway recursion. |
| 21:44:25 | evan | look how long the backtrace is. |
| 21:44:34 | dbussink | yeah, noticed that too |
| 21:44:44 | evan | anything over 1000 frames is 99.99% of the time a runaway recursion |
| 21:45:01 | dbussink | the backtrace in gdb is not the same each time, but each time it's huge :) |
| 21:45:14 | evan | right |
| 21:45:18 | dbussink | so at some moment it probably corrupts something due to the recursion |
| 21:45:19 | evan | hm |
| 21:45:25 | evan | the stack |
| 21:45:33 | evan | at some point, you get a segfault because there is no more stack |
| 21:45:47 | evan | and then gdb inspecting the stack does not go well |
| 21:46:52 | evan | mmm |
| 21:46:54 | evan | it's in a seperate thread |
| 21:47:09 | evan | i wonder if the stack depth check guard broke for threads other than the primary one |
| 21:47:19 | evan | i'll look shortly |
| 21:47:29 | evan | dbussink: btw, why did you say this was Regexp related? |
| 21:47:32 | dbussink | np, the repro should be relatively easy |
| 21:47:44 | dbussink | evan: first time it crashed 2x in a row inside regexp handling |
| 21:47:52 | dbussink | but that was a coincedence then :) |
| 21:47:55 | evan | with a giant stack? |
| 21:48:18 | dbussink | yeah, giant stack monster was hiding there too |
| 21:49:15 | evan | hah |
| 21:49:18 | evan | k :) |
| 21:50:07 | dbussink | evan: but i'm going to head for bed, if you need more info i can help out tomorrow :) |
| 21:51:10 | dbussink | nite! |
| 21:52:11 | maharg | "What other language requires you to understand this level of complexity just to work with strings?!" |
| 21:52:16 | maharg | any that allows multiple encodings? |
| 21:52:24 | maharg | it's not a unique issue to ruby |
| 21:52:25 | evan | dbussink: np. nite! |
| 21:52:49 | maharg | internationalization is hard and there are no easy answers |
| 21:53:53 | evan | being an american and native english speaker, i'm not knowledgable enough about encodings to know whats right |
| 21:54:04 | evan | personally, i'll happily defer to someone that has to deal with encodings daily. |
| 21:56:06 | dbussink | probably only people in countries with non western writing like japan and china |
| 21:56:23 | dbussink | everyone else can basically shove most of it in utf-8 without too much hassle |
| 21:56:48 | brixen | the 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:01 | brixen | like when a symbol or string literal has a particular encoding |
| 21:57:17 | brixen | boundary transcoding on IO objects with eg r:from:to is nice |
| 21:57:33 | brixen | and it's probably sufficient to do most things |
| 21:57:48 | brixen | utf-8 for writing code is extraneous |
| 21:58:08 | brixen | we don't *need* snowman characters in code |
| 21:58:19 | evan | sure we do. |
| 21:58:27 | brixen | heh |
| 21:58:27 | evan | i need a biohazard local variable. |
| 21:58:33 | brixen | indeed |
| 21:58:39 | evan | so people know it's important |
| 21:58:47 | dbussink | i even hate code in dutch |
| 21:59:44 | evan | i think stating that a file of code that be ANY encoding sounds scary. |
| 21:59:45 | evan | personally. |
| 21:59:54 | evan | but I'm a wimp. |
| 22:00:45 | maharg | I 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:17 | maharg | it's perhaps unfortunate that roman characters are lingua franca in programming, but that boat sailed a long time ago |
| 22:01:38 | brixen | the third roman conquest, programming languages :) |
| 22:01:42 | dbussink | maharg: i write all my code in english, i find reading code in any other language is weird |
| 22:01:48 | dbussink | even it's my mother tongue |
| 22:02:05 | dbussink | microsoft did that to excel, which is really horrible |
| 22:02:17 | dbussink | if / then statements translated make me shiver |
| 22:02:42 | evan | dbussink: i'd use that if they provide a swedish chef translation too |
| 22:03:14 | maharg | rue: 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:14 | evan | bork i == 9; york puts "bork bork bork"; smork |
| 22:03:15 | dbussink | evan: hehe, don't think microsoft accepts community translations of vba :P |
| 22:03:30 | dbussink | should write al alternative grammer for mri that does that :) |
| 22:03:38 | dbussink | should be easy ;) |
| 22:03:54 | evan | the idea of a heavily diverse glyph set for source code has been tried |
| 22:03:59 | evan | just look at APL |
| 22:04:05 | evan | it failed miserably. |
| 22:11:27 | evan | oh the joys of rails metaprogramming optimizations |
| 22:11:33 | evan | they expose so many little bugs |
| 22:12:05 | evan | like, 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:09 | evan | which then fails to parse. |
| 22:19:38 | evan | brixen: compile -S rocks. |
| 22:23:54 | brixen | sweet |
| 22:24:01 | evan | looks like |
| 22:24:04 | brixen | I've been using it a ton on the defined? stuff too |
| 22:24:10 | evan | /admin\/.+/ |
| 22:24:14 | evan | isn't coming through right |
| 22:24:18 | evan | there is extra escaping in it |
| 22:24:22 | brixen | hmm |
| 22:24:23 | evan | tracking it down now |
| 22:24:32 | evan | try it, you'll see it comes out with |
| 22:24:39 | evan | "admin\\/.+" as the source |
| 22:25:11 | brixen | hm yeah |
| 22:25:32 | evan | i see the extra escaping in -A, -B, and -S |
| 22:25:39 | evan | so i'm assuming that it's melbourne doing it at this point |
| 22:25:56 | evan | since -A should show the string straight from the parser |
| 22:26:01 | brixen | yeah |
| 22:26:56 | rue | Sure that is not just inspect? |
| 22:27:05 | evan | hm |
| 22:27:09 | evan | thats a good point. |
| 22:27:11 | evan | hm. |
| 22:27:46 | brixen | hm |
| 22:28:50 | evan | rue is right |
| 22:28:53 | evan | it's just inspect |
| 22:28:57 | brixen | um |
| 22:29:04 | evan | it's String#inspect rather |
| 22:29:11 | brixen | I get strlen 9 printing directly from process_regex |
| 22:29:18 | brixen | should have 8 chars no? |
| 22:29:27 | brixen | a d m i n \/ . + |
| 22:29:40 | evan | thats 9 |
| 22:29:45 | evan | see, this is the confusion |
| 22:29:49 | brixen | \/ is one |
| 22:29:52 | evan | a d m i n \ / . + |
| 22:29:53 | evan | no |
| 22:29:54 | evan | it's 2 |
| 22:30:00 | brixen | huh? |
| 22:30:19 | brixen | ?\/ => 47 |
| 22:30:25 | brixen | it should be one or it is one? |
| 22:30:32 | brixen | \/ should be one char in a string |
| 22:30:32 | evan | neither. |
| 22:30:33 | evan | :) |
| 22:30:38 | evan | no no |
| 22:30:39 | evan | it's not one. |
| 22:30:57 | brixen | hah |
| 22:31:02 | brixen | you lost me |
| 22:31:03 | evan | >> /admin\/.+/.source.split("") |
| 22:31:03 | evan | => ["a", "d", "m", "i", "n", "\\", "/", ".", "+"] |
| 22:31:13 | evan | thats from irb. |
| 22:31:24 | brixen | for mri or rbx? |
| 22:31:30 | evan | mri |
| 22:31:32 | evan | BUT rbx is the same |
| 22:31:32 | brixen | ok |
| 22:31:36 | evan | i think i found the bug |
| 22:31:38 | evan | one sec. |
| 22:31:51 | brixen | so it has nothing to do with #inspect |
| 22:32:11 | brixen | with #inspect misrepresenting the string I mean |
| 22:32:31 | evan | String#inspect, yes. |
| 22:32:38 | evan | Regexp#inspect is a different story. |
| 22:33:18 | evan | oh fun. |
| 22:33:21 | evan | le sigh. |
| 22:33:44 | evan | %r!admin/.+/!.source => "admin/.+" |
| 22:34:01 | evan | /admin\/.+/.source => "admin\/.+" |
| 22:34:23 | brixen | lovely |
| 22:34:40 | evan | so you'd think that \/ would become just / in the source |
| 22:34:44 | evan | but it seems to maintain it. |
| 22:40:18 | evan | onig must handle it properly or something |
| 22:40:28 | evan | i don't think we're striping out the extra \ in there |
| 22:40:29 | evan | anyways |
| 22:40:35 | evan | it's primarily a Regexp#inspect bug. |
| 22:47:50 | brixen | defined? is so wack |
| 22:50:19 | evan | rue|Work: must be. |
| 22:50:29 | evan | brixen: yes! it's it's own little runtime. |
| 22:50:54 | evan | how meta. using a Regexp in Regexp#inspect to escape the output properly |
| 22:52:27 | maharg | so if defined?("#{blah}") doesn't call blah, what exactly are you testing is defined? |
| 22:53:15 | brixen | maharg: what are you testing if it *does* call #blah? |
| 22:53:16 | binary42 | maharg: a string literal. |
| 22:53:38 | brixen | binary42: well, a string, it's not really a literal but should result to a string |
| 22:53:53 | brixen | maharg: 1.8 and 1.9 disagree about calling #blah there |
| 22:53:59 | maharg | I don't honestly know what you're testing either way heh |
| 22:54:03 | maharg | or why you would |
| 22:54:03 | binary42 | brixen: defined? to me is expression classification. |
| 22:54:05 | brixen | but in general, defined? calls methods |
| 22:54:35 | brixen | defined?(f.b::IO) and all manner of other call types |
| 22:54:52 | brixen | defined?(f.b == 2) |
| 22:54:53 | maharg | huh, I didn't realize defined? returned more info than a boolean |
| 22:54:54 | brixen | etc |
| 22:55:30 | brixen | defined?((a, b = 1, 2)) => "assignment" |
| 22:55:41 | maharg | that is some seriously wacky introspection |
| 22:55:58 | maharg | almost like the sort of thing people drool over in C++ template metaprogramming |
| 22:56:16 | evan | in 1.8, defined? is a sub interpreter |
| 22:56:17 | binary42 | Yeah. I don't see the point of things like assignment checks. |
| 22:56:20 | brixen | it is seriously wacky agreed |
| 22:56:29 | evan | a whole different AST interpreter |
| 23:02:55 | brixen | oh fun |
| 23:03:20 | brixen | if there is an autoload for :Foo, defined?(Foo) => "constant" but the autoload is not triggered |
| 23:03:30 | evan | UG. |
| 23:03:38 | brixen | I bet rails uses this |
| 23:03:40 | brixen | somewhere |
| 23:03:45 | evan | probably |
| 23:03:49 | brixen | I shudder at the thought |
| 23:03:52 | brixen | le sigh |
| 23:03:57 | evan | ignore that one |
| 23:04:03 | evan | thats going to require a bunch more work i think. |
| 23:04:29 | brixen | I'm trying to forget the things I know about defined? now |
| 23:04:48 | brixen | we'll let jruby run into them first :) |
| 23:06:41 | evan | heh |
| 23:07:03 | evan | this is a fun regexp: |
| 23:07:11 | evan | %r!(^|[^\\])/! |
| 23:08:09 | evan | whats that match? |
| 23:08:14 | evan | this is your quiz for the day. |
| 23:10:31 | brixen | the character before a /? |
| 23:11:15 | evan | and? |
| 23:12:41 | evan | i guess it's pretty easy actually |
| 23:12:52 | evan | it also matches a / at the beginning |
| 23:13:08 | evan | using ^ in an or seemed cute |
| 23:13:22 | brixen | yes $1 may be "" |
| 23:14:43 | evan | useful! |
| 23:15:48 | maharg | gsub(%r{(^"|"$)}, "'") |
| 23:16:13 | brixen | hm, somehow I ended up with a file named :w |
| 23:16:20 | evan | brixen: hehe |
| 23:16:27 | evan | that happens to me sometimes |
| 23:16:46 | brixen | ahh, I see |
| 23:16:59 | brixen | forgot I typed :w and typed it again |
| 23:24:08 | evan | oh rails tests, you're so crazy. |