From: Mat Schaffer Date: 2006-07-24T03:40:31+09:00 Subject: Re: Yadda yadda yadda operator On Jul 23, 2006, at 2:06 PM, Son SonOfLilit wrote: > Hello. > > I was reading about perl6 on wikipedia for amusement today and I > came upon > the "yadda yadda yadda" operator: > > > > if is_true() { > for @array { > ... > } > } > > The three dots above (...) are syntactically valid in Perl 6 and > are called > the "yadda-yadda operator". "..." can be used as a placeholder for > code to > be inserted later. If a running program attempts to *execute* "...", > however, an exception Exception_handling> is > thrown. This operator is useful for abstract > methods, > or for marking places where the programmer intends to insert code > later. > > > > > > This seemed so useful that I thought implementing it for Ruby and > submitting > a patch, but then caught myself and wrote: > > class Kernel > > def yadda > > raise "Yadda operator reached" > > end > > end > > > > How elegant Ruby is. > > > > Does anyone else think that this is Standard Library material in > the making? This strikes me as a little comical. I think the raise solution is preferable cause then you can include human readable information about why it's not implemented. e.g.: def foo raise "Foo must be overridden in child classes" end def bar raise "To be implemented in 1.2" end yadda, yadda.... :) To me, this is much more useful than a message that's basically "Hey it's broke. Deal with it." If you find yourself using similar messages, then just implement the kernel function like you did. But maybe make it something like "raise_abstract" just to make it clear to the user what's happening. -Mat