dari Lambda jadi Doing, dari Tiada jadi Ada

Posted: March 7, 2008 in RUBY
Tags: , , ,

We often do this in our spec code, lambda { “do something” }.should change(object) then one invisible samurai soul next to me said : “aliasing this lambda to be doing is more readable instead”.

Me: “Well that won’t be ruby syntax anymore :-P and it’s not very familiar then to other rubyists”.

Him: “‘should’ syntax is not general ruby either”.

Me: “Yeah that’s because of ruby metaprogramming.”.


>> module Kernel
>>   alias :doing :lambda
>> end
=> nil
>> a = doing { "tes" }
=> #
>> a.call
=> "tes"
>> exit

Me: “Ha, your idea works! :-P”

Him: “Well it’s not my idea actually I read it someone’s idea somewhere”

Me: “:-P our rake stats is getting thinner”

Note: Let me know if you find this idea, you like it or you hate it, feel free to comment. Comments should go in this blog post/thread comment, not via Skype, YM, etc =)) :-P doing C++ / Smalltalk situp again for the sake of DP by GoF! again… again… -_-

  1. wharsojo says:

    jengah gue ama lambda!
    walau uda jelas & tau artinya tetep aja ndak mudeng mudeng,

    Great dah ama simple tipnya…. :)

tinggalkan feedback konstruktif atau lebih baik diam

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s