develooper Front page | perl.perl6.language | Postings from March 2005

nothing

Thread Next
From:
Rod Adams
Date:
March 20, 2005 19:08
Subject:
nothing
Message ID:
423E3A98.8070601@rodadams.net
Does Perl need a no-op function?

With the addition of "no bare literals", it makes constructs like

 1 while some_func();

an error. I propose creating a no-op function "nothing" that can be used 
here or anywhere else you specifically wish to do nothing at all.

  given $this {
    when Even  { nothing };
    when Prime { ... };
    default    { ... };
  }


As a side question, I assume that there's a predicate form of "when", 
but it's not mentioned.

  given $this {
    nothing when Even;

    when Prime { ... };

    default    { ... };
  }


-- Rod Adams

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About