Show enters and exits. Hide enters and exits.
| 16:59:21 | evan | morning |
| 17:01:01 | rue | Good 70,92h |
| 17:02:09 | evan | :) |
| 17:17:48 | brixen | morning |
| 17:22:35 | evan | brixen: thoughts? http://gist.github.com/325369 |
| 17:24:12 | evan | all those specs seem unnecessary |
| 17:27:03 | brixen | hmm |
| 17:27:23 | brixen | yes |
| 17:27:40 | brixen | specs for methods should spec expected args |
| 17:27:48 | brixen | no specs for "undefined" methods |
| 17:28:17 | brixen | generally |
| 17:28:32 | brixen | the spec for interpolation calling #to_s is borderline |
| 17:28:55 | brixen | I don't see a point in the NoEach specs |
| 17:29:08 | brixen | just spec that #each is called |
| 17:30:49 | evan | right, and thats done above. |
| 17:31:08 | evan | but why the specs for ArgumentError? |
| 17:31:16 | evan | they seem entirely unnecessary |
| 17:31:44 | evan | oh, I removed the #to_s one because the spec ABOVE it tests that #to_s is called. |
| 17:32:47 | brixen | ah ok |
| 17:33:03 | evan | so, let me discuss briefly why i hit these |
| 17:33:03 | brixen | yes, ArgumentError specs for arity are a no-no |
| 17:33:31 | evan | i changed our Kernel#method_missing to be able to detect a private call |
| 17:33:32 | evan | ie |
| 17:33:46 | evan | "foo 1" now raises a NameError, like in MRI. |
| 17:33:55 | brixen | ahh |
| 17:34:06 | evan | BUT it complicates things |
| 17:34:27 | evan | because, for instance, our Enumerable calls each as "each { ... }" |
| 17:34:34 | evan | and thusly will raise a NameError if there is no #each |
| 17:34:39 | evan | where as MRI does not do that |
| 17:34:47 | evan | because rb_funcall always raises NoMethodError |
| 17:35:00 | brixen | hmm |
| 17:35:08 | evan | so it's a choise of never raising NameError |
| 17:35:17 | evan | or raising NameError a lot more often than MRI does |
| 17:36:25 | brixen | well, since a NoMethodError is_a NameError, seems like it shouldn't be too bad to substitute NameError |
| 17:36:37 | evan | agreed |
| 17:36:41 | evan | that was my thinking |
| 17:36:47 | evan | the only wrinkle is people that do |
| 17:36:50 | evan | rescue NoMethodError |
| 17:36:57 | brixen | hmm |
| 17:37:04 | evan | that is a latent bug |
| 17:37:09 | brixen | yeah |
| 17:37:16 | evan | so we could always just deal with it if it's reported |
| 17:37:29 | rue | Illustrating, once again, the dangers of both inconsistent error usage and the precariousness of caring about which error exactly occurred |
| 17:37:40 | evan | rue: *nod* |
| 17:37:47 | brixen | evan: well, what about setting up an exception that would be called if dispatch failed |
| 17:38:08 | brixen | can you know ahead of time, "if nothing interferes, if this fails, raise NameError" |
| 17:38:27 | evan | not sure what you mean |
| 17:38:47 | brixen | I'm trying to sort out when to call NME and when NE |
| 17:38:53 | evan | ah. |
| 17:38:55 | brixen | er raise |
| 17:39:25 | brixen | so that sending #each {} would raise NME |
| 17:39:26 | evan | by setting up to you mean a config variable? |
| 17:39:27 | brixen | eg |
| 17:39:35 | evan | ah. |
| 17:39:37 | evan | ug. |
| 17:39:51 | evan | you'd just change #ecah {} to self.each {} |
| 17:39:56 | evan | and now in raises NME |
| 17:39:57 | brixen | well, you have that exception state vs current exception now |
| 17:40:01 | brixen | just thinking out loud |
| 17:40:04 | evan | if you wan to control it |
| 17:40:05 | evan | sure |
| 17:40:08 | evan | you've got control |
| 17:40:14 | brixen | hm |
| 17:40:15 | evan | just use self. to use NME |
| 17:40:30 | evan | which we can do in Enumerable |
| 17:40:44 | brixen | sure |
| 17:40:46 | evan | it's just a little gross having to use the verbose syntax |
| 17:40:47 | brixen | but that's confusing |
| 17:41:05 | brixen | it's gross and nothing explicit about why we're doing self.blah here and there |
| 17:41:14 | evan | yep |
| 17:41:20 | brixen | but I dislike the latent bugs from not supporting MRI oddities |
| 17:41:22 | brixen | le sigh |
| 17:41:54 | brixen | like defined?(X) not calling #const_missing, but defined?(A::X) calling it |
| 17:42:09 | evan | well, that makes sense to me |
| 17:42:23 | brixen | defined?(X) still does total search, it just doesn't call #const_missing |
| 17:42:31 | evan | right. |
| 17:42:40 | brixen | and if A doesn't define it, Module#const_missing is called |
| 17:42:46 | brixen | the exception is just swallowed |
| 17:42:56 | dbussink | evan: looks like someone has a reliable crash: http://github.com/evanphx/rubinius/issues#issue/204 |
| 17:43:26 | evan | dbussink: wtf is this code. |
| 17:43:27 | evan | :( |
| 17:44:03 | evan | ok |
| 17:44:11 | evan | well, i'm off for the rest of the day shortly |
| 17:44:14 | evan | so i'll look at that tomorrow |
| 17:44:30 | dbussink | evan: looks like it crashes during gc |
| 17:44:34 | dbussink | ok, have a nice day :) |
| 17:44:37 | evan | yep, i see. |
| 17:44:58 | brixen | evan: so, for defined?(), would you prefer 2 primitives, or one primitive that takes a flag for when to call #const_missing? |
| 17:45:09 | brixen | er defined?(A) et al |
| 17:45:30 | evan | seems like a flag |
| 17:45:33 | brixen | k |
| 17:45:34 | evan | if thats the only difference |
| 17:45:38 | brixen | that's what I was thinking |
| 17:45:52 | brixen | well, I think that's the only difference |
| 17:46:18 | brixen | I've got 246 expectations now |
| 17:46:29 | brixen | 5f/4e to fix |
| 17:47:20 | evan | sweet! |
| 17:47:52 | brixen | originally 43 expectations, so we have a wee bit more coverage now |
| 17:48:07 | evan | hehe |
| 17:48:45 | brixen | I refactored defined?() in general for when it needs to produce values yesterday |
| 17:49:05 | brixen | I'll finish up defined?() for constants now that I can see more clearly |
| 17:49:09 | evan | rad. |
| 17:49:36 | evan | i'm still pushing on rails 3 |
| 17:49:42 | brixen | sweet |
| 17:49:42 | evan | got activemodel to pass |
| 17:49:45 | brixen | nice! |
| 17:51:27 | evan | le sigh. |
| 17:51:41 | evan | more subclasses violating the contract of the superclass |
| 17:52:17 | evan | subclass Array, override #sort! to take an argument, then call #sort |
| 17:52:25 | evan | our #sort does dup.sort! |
| 17:52:31 | brixen | ugh |
| 17:52:34 | evan | thus hitting the subclasses #sort! |
| 17:52:39 | evan | and raising an ArgumentError |
| 17:54:18 | evan | people really need to use their own method names |
| 17:54:36 | evan | and stop reusing the superclasses method names when the method IS NOT THE SAME. |
| 17:54:46 | brixen | names are hard, let's use Ruby's |
| 17:54:46 | evan | there is absolutely no reason for this method to be called #sort! |
| 17:55:07 | dbussink | evan: rails3 stuff? |
| 17:55:15 | evan | yep |
| 17:55:32 | dbussink | evan: you should bitch wycats to get rid of it :) |
| 17:55:36 | evan | i do. |
| 17:55:38 | evan | :D |
| 17:56:10 | evan | in this case, it's actually mail |
| 17:56:13 | evan | it does |
| 17:56:18 | evan | class PartsList < Array |
| 17:56:23 | evan | then mucks about. |
| 17:56:35 | evan | pretty needlessly. |
| 17:56:48 | dbussink | the wonders of c implementation hiding this |
| 17:58:49 | evan | yeah |
| 17:59:03 | evan | well, I think i'll have to write a blog post about this. |
| 18:00:09 | dbussink | evan: i guess PartsList could also very well have an array internally and duck type where needed right? |
| 18:02:29 | rue | I think there was a post about Composition > Inheritance already :) |
| 18:04:18 | evan | dbussink: yep. |
| 18:04:43 | evan | if it IS an Array, fine, subclass, but don't break the superclass method contracts |
| 18:05:03 | evan | in this case |
| 18:05:12 | evan | even if they didn't have #sort! take another arg |
| 18:05:14 | evan | we still have a problem |
| 18:05:20 | evan | because they use #sort in their #sort! |
| 18:05:27 | evan | but our #sort is implemented with #sort |
| 18:05:35 | evan | so that is a design flaw in our code too. |
| 18:05:54 | evan | er. our #sort is implemented with #sort! |
| 18:06:20 | evan | i think we'll need to do a little renaming and using some internal helpers and aliases |
| 18:06:25 | evan | for this pattern |
| 18:06:27 | evan | well, i'm off |
| 18:06:33 | evan | be back later tonight |
| 18:07:31 | brixen | yeah, generally we can't implement our methods using other API methods |
| 18:07:41 | brixen | that lead to a lot of troubly with Hash too |
| 18:07:50 | brixen | troubly? |
| 18:07:53 | brixen | anyway :) |
| 18:09:04 | dbussink | brixen: sound troubly to me |
| 18:09:11 | brixen | heh |
| 18:10:19 | jvoorhis | hello |
| 18:10:41 | jvoorhis | evan: this reminded me of our conversation about my 'functional' version of ruby-llvm: http://www.yosefk.com/blog/api-users-api-wrappers.html |
| 18:10:51 | jvoorhis | (the version that is no more) |
| 20:33:34 | kstephens1 | http://github.com/evanphx/rubinius/issues#issue/204 : is generated code, sorry for the lack of formatting. :) |
| 20:34:37 | kstephens1 | I'm writing a performance survey of common ruby code idioms and how they perform across different Ruby implementations. |
| 20:35:27 | benschwarz | evan: ! |