On Wed, Apr 06, 2005 at 10:07:33AM -0600, Luke Palmer wrote: : Thomas Sandlaß writes: : > Larry Wall wrote: : > >Yes. It should complain that = is not a valid type signature. : > >Any &foo (or &foo:<...>) followed by <...> should be parsed as a single : > >term selecting the function that MMD would dispatch to given that : > >type signature. : > : > And I guess it's not allowed to have interspersed whitespace unless : > one uses the dot forms? And my interpretation as operator <=> needs : > the whitespace OTOH. : > : > &infix <=> <some words> # my interpretation of the typo : > : > &foo .<signature> # OK? : : I'm beginning to think that angle brackets are too overloaded here. The : qw angles are really growing on me, and now whenever I see angles I see : a quoting construct. Putting something that's not quoted inside them : seems like it will be visually confusing (and just thing what vim will : have to do to tell the difference).
Yes, same here. But it's not an expression either. It's a signature, and the only other delimiter we have prior art for is (Str $s, Int $i) in sub declarations. But we can't use bare parens for obvious reasons that were not obvious enough to keep me from falling into the trap in at least one Apocalypse. :-) : We could make it one, so that it's: : : &infix:<+>.<Complex Complex> : : Instead of with commas, but then you can't attach anything special to : the types, so I think it's best if we just ditch <> altogether for this : purpose. : : But then what replaces it? The first thing that came to me was just : to use a method: : : &infix:<+>.variant(Complex, Complex); : : The method approach has some other advantages, like the ability to add : another method: : : my $code = &infix:<+>.dispatch($a, $b); # what code would we call : # with $a and $b? : : Or we could use square brackets, since square bracketing types just : selects a type, but doesn't do anything to it. But especially because : this only applies to multimethods, I like the method approach the best. But a method *evaluates* its arguments, which you generally don't want in this case. Sometimes you do, so it's fine to have a method behind whatever syntax we choose, but it can't very well be the default without some kind of sig quoting. I think it's time to break out the colon again and use something like: &infix:<+>:(Complex, Complex); or &foo:(Str,Int) for ordinary functions. If it gets really popular people might even start writing: sub foo :(Str,Int) {...} Larry