<div dir="ltr">Hi everyone,<br><br>I come to you bearing a plea for talks with a twist. You may have read recently that Array#each has being reimplemented in ruby<br><br>An earlier version of this [idea][1] should be pretty understandable to the average rubyist:<br><br>```<br>def each<br>  unless block_given?<br>    return to_enum(:each) { self.length }<br>  end<br>  i = 0<br>  while i < self.length<br>    yield self[i]<br>    i = i.succ<br>  end<br>  self<br>end<br>```<br><br>There's some handwaving dealing with blocks/chaining enumerators but other than that it is just yielding elements from the array one at a time<br><br>What was actually [merged][2] is quite different:<br><br>```<br>def each<br>  Primitive.attr! :inline_block<br>  Primitive.attr! :use_block<br><br>  unless defined?(yield)<br>    return Primitive.cexpr! 'SIZED_ENUMERATOR(self, 0, 0, ary_enum_length)'<br>  end<br>  _i = 0<br>  value = nil<br>  while Primitive.cexpr!(%q{ ary_fetch_next(self, LOCAL_PTR(_i), LOCAL_PTR(value)) })<br>    yield value<br>  end<br>  self<br>end<br>```<br><br>While the structure is still similar - do enumerator things if no block is given, else yield the array elements in order - the meat is very different and almost looks like inlining chunks of c into ruby.<br><br>I think there is a really interesting talk (or several) arising from this: what does this actually mean / do? Is this really writing ruby? Why is this a good thing to do in the first place? <br><br>However I've done plenty of speaking at LRUG, most recently just 6 weeks ago, so rather than submit you all to me droning along I'd like to throw this idea back to the community for someone else to turn into a talk. <br>Depending on the scope this could be a 5-10 minutes or 20 minutes+ - it all depends on how deeply you want to probe.<br><br>If wanted, I'm happy to offer any help you might need (this could just be throwing ideas around for directions in which to take it, talking through technical details, listening to early versions of the talk - whatever helps). <br>I hope this helps someone get over that first hurdle of working out what to speak about.<br><br>Please do get in touch with <a href="mailto:talks@lrug.org">talks@lrug.org</a> whether you'd like help or not - there's no sense in duplication of effort<br><br>Best,<br><br>Fred<br><br><br><br>[1]: <a href="https://github.com/ruby/ruby/pull/6687/files#diff-a82de4e9dc81d7299580f290adb1aa3c2a6a9c6e02d4d9ff9123c206ec2cd818R44">https://github.com/ruby/ruby/pull/6687/files#diff-a82de4e9dc81d7299580f290adb1aa3c2a6a9c6e02d4d9ff9123c206ec2cd818R44</a> )<br>[2]: <a href="https://github.com/ruby/ruby/blob/e49d68bf2732cf467a1532283de4a1716e238677/array.rb#L44">https://github.com/ruby/ruby/blob/e49d68bf2732cf467a1532283de4a1716e238677/array.rb#L44</a><br></div>