On Tue, Jul 13, 2004 at 07:24:55AM -0600, Luke Palmer wrote: : But in Perl 6, you don't have to specify things like that through the : mode string: you can specify them through named parameters: : : my $fh = open ">$filename" :excl;
While that probably works, I think better style would be to use a comma: my $fh = open ">$filename", :excl; That explicitly passes :excl to open as a term in a list rather than relying on the magical properties of :foo to find the preceding operator adverbially when used where an operator is expected. We may have to tighten up the definition of operator :foo a bit, since it's not always going to be clear which preceding operator is intended. Even quotes are operators if you squint. Arguably, someone could look at my $fh = open ">$filename" :excl; and legitimately wonder which predicate the :excl attaches to: my $fh = open (circumfix:""('>$filename', :excl)); # apply to quote my $fh = open(">$filename", :excl); # apply to open infix:=(my $fh, open(">$filename"), :excl); # apply to assignment I see several directions we could go to clarify this, and I don't entirely like any of them. One could look at the set of available signatures (at either compile time or run time) and see who wants that particular adverb. But the early binding solutions tend to bind too soon, and the late binding solutions tend to bind too late. (The latter is much closer to how humans treat adverbs, though, since humans are essentially MD creatures with an overlay of various pre-compiled heuristics.) Operator adverbs are, in essence, postfix operators with weird precedence. We're going to have to be very explicit about what we mean by "weird" here. Unfortunately, this morning I don't feel very explicit. Larry