dari Lambda jadi Doing, dari Tiada jadi Ada
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.”.
Me:
irb
>> 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… -_-
Antara Ada dan Tiada, hehehehe
jengah gue ama lambda!
walau uda jelas & tau artinya tetep aja ndak mudeng mudeng,
Great dah ama simple tipnya…. :)
wharsojo
tutorial lambda asik