[pm-h] Why the Yada Yada Operator is My New Best Friend (And he wants to be your pal too!)

G. Wade Johnson gwadej at anomaly.org
Fri May 16 22:04:19 PDT 2014


On Fri, 16 May 2014 19:12:03 +0000 (GMT)
Robert Stone <drzigman at drzigman.com> wrote:

> Greetings Mongers, 
> 
> After reading a fun post on Dot based "operators" in perl
> ( http://perlhacks.com/2014/01/dots-perl/ ) a few weeks ago I found
> myself getting really into the "yada yada" operator. It's not
> technically an operator, rather "it stands in place of a statement
> and has no operands" but I have found it to be an excellent addition
> to my TDD tool kit. 

Agreed.

I know some people are bothered by Perl's informality. And this would
probably drive them nuts. But, it's short, looks like the pseudo code
you've probably used before, and does what we want. What's not to like?

G. Wade

> Basically, rather than doing: 
> 
> sub do_awesome_thing { 
> croak "Not Yet Implemented" 
> } 
> 
> You can do: 
> 
> sub do_even_more_awesome_thing { 
> ... 
> } 
> 
> Which will generate the following when ran: 
> 
> [rstone at rstone core]$ prove -l t/things/01-that_are_awesome.t 
> t/things/01-that_are_awesome.t .. 
> # Failed test 'Lives Through Taking Over The World' 
> # at t/things/01-that_are_awesome.t line 46. 
> # died: Unimplemented
> at /home/rstone/repos/awesomness/lib/Super/Cool/Module.pm line 169. 
> 
> Those three dot's take the place of a `die "Unimplemented"` and stand
> out quite a bit more to me as something I need to come back and
> actually implement. 
> 
> Anyway, hope someone else find this helpful or interesting. Feel free
> to share any other nifty tips and tricks you may have come across in
> recent days. 
> 
> Best Regards, 
> Robert Stone 


-- 
Why do your people ask if someone's ready right before you are going to
do something massively unwise?       -- Delenn - "The War without End"


More information about the Houston mailing list