>>>>> "LW" == Larry Wall <[EMAIL PROTECTED]> writes:
LW> On Tue, Aug 10, 2004 at 06:10:17PM -0400, Uri Guttman wrote: LW> : can you have a 0- or 1-ary function? meaning like the many funcs that LW> : work on $_ with no args or the single arg you pass in. how do you LW> : declare it so it parses correctly? LW> : LW> : splurt # should work on $_ LW> : splurt() # should work on $_ LW> : splurt + 1 # same?? LW> : splurt +1 # work on +1?? so how do the 2 above get parsed? the space between + and 1 looks alike a 0-ary splurt but the +1 could be 0-ary added to 1 or unary with +1 as its arg. this could mean a form of white space sensitivity. LW> : splurt( +1 ) # definitely work on +1 LW> And functions declared 0-ary explicitly parse as terms, while all 2-ary LW> and higher functions parse as list operators unless you use parens. LW> (All functions are considered to be list ops before declaration, LW> and if the declaration subsequently changes that fact, it's an error. LW> So 0-ary and 1-ary functions have to be predeclared if you want them LW> to parse as unaries.) that all makes sense as all is fair if you predeclare and the default parsing is well documented and understood. LW> I think this is all consistent and useful, but of course I could simply LW> be wrong, or more likely, wrongish. depends on how you parse wrong! :) uri -- Uri Guttman ------ [EMAIL PROTECTED] -------- http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org