<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Disqus - Latest Comments for marc_andre</title><link>http://disqus.com/by/marc_andre/</link><description></description><atom:link href="http://disqus.com/marc_andre/comments.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 15 Jun 2023 10:26:33 -0000</lastBuildDate><item><title>Re: Noinline &amp; Crossline, once for all
</title><link>https://cortinico.gitlab.io/blog/noinline-and-crossline-once-for-all#comment-6209067494</link><description>&lt;p&gt;I remain unconvinced by the example of `crossinline`. The solution is not to mark the parameter with `crossinline` but instead to use `try {} finally {}`, as &lt;br&gt;the flushing of the logger should also happen if the block throws an exception.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Thu, 15 Jun 2023 10:26:33 -0000</pubDate></item><item><title>Re: Correct Delegation with Ruby 2.6, 2.7 and 3.0</title><link>http://eregon.me/blog/2021/02/13/correct-delegation-in-ruby-2-27-3.html#comment-5268440925</link><description>&lt;p&gt;I'm in favor of empowering people and I defer to them to take informed decisions and accept risks.&lt;br&gt;For example, the risk of a method accepting keyword arguments to no longer accepting them seems negligible to me and far outweighs the ugliness of &lt;code&gt;ruby2_keywords&lt;/code&gt;.&lt;br&gt;We can agree to disagree on the accuracy that some code is "broken" and "incorrect" 😄&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Sun, 14 Feb 2021 12:52:42 -0000</pubDate></item><item><title>Re: Correct Delegation with Ruby 2.6, 2.7 and 3.0</title><link>http://eregon.me/blog/2021/02/13/correct-delegation-in-ruby-2-27-3.html#comment-5268339654</link><description>&lt;p&gt;You may want to specify that "incorrect" applies only for a generic &lt;code&gt;target&lt;/code&gt;. If you know that &lt;code&gt;target&lt;/code&gt; accepts keyword arguments then &lt;code&gt;(*a, **o)&lt;/code&gt; will work, or if &lt;code&gt;target&lt;/code&gt; does not accept any, then &lt;code&gt;(*a)&lt;/code&gt; will work.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Sun, 14 Feb 2021 11:26:39 -0000</pubDate></item><item><title>Re: The Pros and Cons of Ruby Refinements</title><link>https://rollout.io/blog/ruby-refinements/#comment-5159860766</link><description>&lt;p&gt;I'm glad to report that all the limitations you list are history. I hope to post about good uses of refinements&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Fri, 20 Nov 2020 22:08:37 -0000</pubDate></item><item><title>Re: Ruby refinements and the sorbet type checker</title><link>https://www.trippett.co.uk/2019/11/18/ruby-refinements-and-the-sorbet-type-checker/#comment-5159828112</link><description>&lt;p&gt;I do hope that Sorbet &amp;amp; RBS have actual support for refinements one day.&lt;/p&gt;&lt;p&gt;BTW, doing `h.reject { |k, _v| k.nil? }` is sinful; it's `O(n)`. Prefer `.except(nil)`, or `tap {|h| h.delete(nil)}` or something...&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Fri, 20 Nov 2020 21:30:18 -0000</pubDate></item><item><title>Re: Top 10 errors from 1000+ Ruby on Rails projects (and how to avoid them)</title><link>https://rollbar.com/blog//blog/top-10-ruby-on-rails-errors/#comment-4250045796</link><description>&lt;p&gt;For point #2: You may want to mention one can write `foo&amp;amp;.[](:key)&amp;amp;.[](:other)`, although clearly `dig` is nicer. BTW, the `dig` gem is dead, but my &lt;a href="https://github.com/marcandre/backports" rel="nofollow noopener" target="_blank" title="https://github.com/marcandre/backports"&gt;backports gem&lt;/a&gt; has it + many others...&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Thu, 20 Dec 2018 13:42:26 -0000</pubDate></item><item><title>Re: yield_self in Ruby 2.5 // Michał Łomnicki</title><link>http://mlomnicki.com/yield-self-in-ruby-25/#comment-3542273914</link><description>&lt;p&gt;Please note that `_` is a special name for unused variables (or any name starting with _). IMO it's best to reserve it for such uses.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Fri, 29 Sep 2017 10:31:39 -0000</pubDate></item><item><title>Re: How To Write Ruby Faster at the Source Code Level</title><link>https://thenewstack.io/how-to-write-ruby-faster-at-the-source-code-level/#comment-2039419746</link><description>&lt;p&gt;&amp;lt;shameless plug=""&amp;gt;Give my gem "fruity" a spin to compare code. It has a nice API and will estimate how long it should run to eliminate variance if possible&amp;lt;/plug&amp;gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Fri, 22 May 2015 09:54:58 -0000</pubDate></item><item><title>Re: How To Write Ruby Faster at the Source Code Level</title><link>https://thenewstack.io/how-to-write-ruby-faster-at-the-source-code-level/#comment-2039416060</link><description>&lt;p&gt;Not sure what is meant by "Ruby has a method built-in to create an array with only keys of that hash". Are you talking about `each_keys`? That method doesn't create an array at all...&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Fri, 22 May 2015 09:52:41 -0000</pubDate></item><item><title>Re: How To Write Ruby Faster at the Source Code Level</title><link>https://thenewstack.io/how-to-write-ruby-faster-at-the-source-code-level/#comment-2039412309</link><description>&lt;p&gt;It can't be accurate to say that `sub` is 50% faster. It if the string isn't found, or if it's found and there are no other characters, it has to take the same time, for example.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Fri, 22 May 2015 09:50:11 -0000</pubDate></item><item><title>Re: How To Write Ruby Faster at the Source Code Level</title><link>https://thenewstack.io/how-to-write-ruby-faster-at-the-source-code-level/#comment-2039409595</link><description>&lt;p&gt;Not sure what is meant by "tighter scope", or by "Fetch taking a second argument for a block"&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Fri, 22 May 2015 09:48:18 -0000</pubDate></item><item><title>Re: How To Write Ruby Faster at the Source Code Level</title><link>https://thenewstack.io/how-to-write-ruby-faster-at-the-source-code-level/#comment-2039405058</link><description>&lt;p&gt;`array.sample`, is not 15 times faster. It's O(1) vs O(n), so there is no bound to how much faster it is.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Fri, 22 May 2015 09:45:17 -0000</pubDate></item><item><title>Re: Rubyists: Just use double-quoted strings.</title><link>http://viget.com/extend/just-use-double-quoted-ruby-strings#comment-1811882532</link><description>&lt;p&gt;I was wondering why I got a sudden surge of upvotes for my StackOverflow answer!&lt;/p&gt;&lt;p&gt;As I try to explain, benchmarking this is futile, it's interpreted exactly completely and utterly the same way.&lt;/p&gt;&lt;p&gt;See  &lt;a href="https://stackoverflow.com/questions/1836467/is-there-a-performance-gain-in-using-single-quotes-vs-double-quotes-in-ruby#answer-1836838" rel="nofollow noopener" target="_blank" title="https://stackoverflow.com/questions/1836467/is-there-a-performance-gain-in-using-single-quotes-vs-double-quotes-in-ruby#answer-1836838"&gt;https://stackoverflow.com/q...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Thu, 22 Jan 2015 17:24:34 -0000</pubDate></item><item><title>Re: Ruby Tips Part 5</title><link>http://dev.venntro.com/2014/04/ruby-tips-part-5/#comment-1350261167</link><description>&lt;p&gt;Even better than `Hash[]` is `Array#to_h`, introduced in Ruby 2.1&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Tue, 22 Apr 2014 10:16:04 -0000</pubDate></item><item><title>Re: ES7 async functions</title><link>http://jakearchibald.com/2014/es7-async-functions#comment-1318500915</link><description>&lt;p&gt;Checkout IcedCoffeescript...&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Fri, 04 Apr 2014 11:37:47 -0000</pubDate></item><item><title>Re: Technology by FTBpro developers — Ruby 2.1 - Our Experience</title><link>http://tech.ftbpro.com/post/78195641092#comment-1293382802</link><description>&lt;p&gt;We're using the FastImage gem which has the advantage of now requiring the full image to be local. YMMV&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Thu, 20 Mar 2014 11:59:47 -0000</pubDate></item><item><title>Re: Technology by FTBpro developers — Ruby 2.1 - Our Experience</title><link>http://tech.ftbpro.com/post/78195641092#comment-1293380776</link><description>&lt;p&gt;Thanks, that's reassuring. I was going to ask if this bug had been reported, seemed pretty major to me.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Thu, 20 Mar 2014 11:58:44 -0000</pubDate></item><item><title>Re: Why I won't squash my commits - # Hash</title><link>http://blog.marc-andre.ca/2014/02/05/why-i-wont-squash-my-commits/#comment-1237049169</link><description>&lt;p&gt;Ouch, I mess up my rebase for sure! Also, I realized that, in the example I gave with 15 commits, the last two should be squashed together...&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Sun, 09 Feb 2014 12:30:07 -0000</pubDate></item><item><title>Re: 
          Stop including Enumerable, return Enumerator instead
        </title><link>http://blog.arkency.com/2014/01/ruby-to-enum-for-enumerator/#comment-1193905245</link><description>&lt;p&gt;Not sure why you feel it looks like a hack, it's actually the right way to use `enum_for`. You'll find similar code all over the rubinius codebase, for example.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Thu, 09 Jan 2014 13:03:38 -0000</pubDate></item><item><title>Re: 
          Stop including Enumerable, return Enumerator instead
        </title><link>http://blog.arkency.com/2014/01/ruby-to-enum-for-enumerator/#comment-1193902908</link><description>&lt;p&gt;Good post and your point about "is this class a collection or not" is important.&lt;/p&gt;&lt;p&gt;I'd say that a class that has an `each` method should be a collection and should include `Enumerable`. On the other hand, there are cases where you simply want to have a method that iterates and that method should return an enumerator if no block is given.&lt;/p&gt;&lt;p&gt;This is why I'm not too convinced about your example. Why not add a singleton method to the User called `with_gravatars` instead?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Thu, 09 Jan 2014 13:01:42 -0000</pubDate></item><item><title>Re: Why I love Ruby Enumerable#inject</title><link>http://www.gabekoss.com/blog/2013/12/why_i_love_ruby_enumerable_inject/#comment-1152221911</link><description>&lt;p&gt;I'm afraid your second example is a bad example of inject; `each_with_object` should be used instead.&lt;br&gt;The same thing could be said for your third example...&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Thu, 05 Dec 2013 17:59:54 -0000</pubDate></item><item><title>Re: Let's make a Ruby hash map method that returns a hash instead of an array - Chris Holtz</title><link>http://chrisholtz.com/blog/lets-make-a-ruby-hash-map-method-that-returns-a-hash-instead-of-an-array/#comment-1037639242</link><description>&lt;p&gt;In Ruby 2.1 you'll get Array#to_h so you will be able to do `&lt;a href="http://hash.map" rel="nofollow noopener" target="_blank" title="hash.map"&gt;hash.map&lt;/a&gt;{|...| [key, value]}.to_h` to get a hash. See &lt;a href="http://bugs.ruby-lang.org/issues/7292" rel="nofollow noopener" target="_blank" title="http://bugs.ruby-lang.org/issues/7292"&gt;http://bugs.ruby-lang.org/i...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Tue, 10 Sep 2013 17:12:32 -0000</pubDate></item><item><title>Re: What is the difference between a block, a proc, and a lambda in ruby? - Build, Break, Learn.</title><link>http://awaxman11.github.io/blog/2013/08/05/what-is-the-difference-between-a-block/#comment-1023975143</link><description>&lt;p&gt;There are other differences between a Proc and a lambda. Procs will expand a single array parameter (compare with {|a, b = :foo| p a, b}.call([1,2,3]) ) and will also return different arity when they have optional parameters.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Fri, 30 Aug 2013 21:16:31 -0000</pubDate></item><item><title>Re: Ruby 2.0.0 by example - # Hash [via http://ipv6gate.sixxs.net]</title><link>http://blog.marc-andre.ca/2013/02/23/ruby-2-by-example/#comment-852228764</link><description>&lt;p&gt;Good question, I'm don't know.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Thu, 04 Apr 2013 16:31:43 -0000</pubDate></item><item><title>Re: Ruby 2.0.0 by example - # Hash [via http://ipv6gate.sixxs.net]</title><link>http://blog.marc-andre.ca/2013/02/23/ruby-2-by-example/#comment-852097990</link><description>&lt;p&gt;No hit if you don't use them, but yes I believe there's a small hit for calls made within a `using SomeRefinement` zone.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc-André Lafortune</dc:creator><pubDate>Thu, 04 Apr 2013 13:59:47 -0000</pubDate></item></channel></rss>