
31 Jan
2006
31 Jan
'06
9:50 p.m.
John Hughes wrote:
Quick, when I write do (x,y)<-e... is that pair matched strictly, like case, or lazily, like let? If strictly, then why? There's no choice to be made here, so why not wait until x or y is used before matching?
The choice of whether to invoke fail can't be postponed. Admittedly fail will never be called in this case, but I think legislating special behavior for such cases would be a bad idea. What would (x,[]) <- e mean?
If only pattern matching was *always* strict, unless a ~ appeared, then the language would be more regular and easier to learn.
But then (let 1=2 in "Whee!") wouldn't work properly any more. :-) -- Ben