On Sun, Sep 25, 2005 at 23:21:33 -0700, Ashley Winters wrote:
> On 9/25/05, Luke Palmer <[EMAIL PROTECTED]> wrote:
> > On 9/25/05, Juerd <[EMAIL PROTECTED]> wrote:
> > > We can do better than equivalence testing for colors. Instead, try to
> > > match. Surely a *smart* match operator really is smart?
> > >
> > >     $color ~~ '#FF00FF'
> > >            ==
> > >     $color ~~ 'magenta'
> > >            ==
> > >     $color ~~ [ 255, 0, 255 ]
> >
> > Hmm.  That violates my proposal that the right side is the thing that
> > determines how the left side is matched.  So there's something wrong
> > with one of the two...
> >
> > If we keep my proposal, then we get:
> >
> >     $color ~~ color('#FF00FF')
> >     $color ~~ color('magenta')
> 
> Interesting proposal. Is there any motivation for people not to simply
> flip the argument-order to take advantage of the right-wise
> determinism? Or is that actually a benefit?

I see a very good reason - the more topicalized and localized an
object the earlier in the sentance it usually goes in any natural
language that I know of.

99% of programmers that know that

        if ($number == 123) {

        }

is bad because a simple typo makes it into assignment, but

        if (123 == $number) {

        }

is safe still don't use the safer form, because it just doesn't read
or write as well.

Matching is even more verbose in that sense... If <noun defining
concrete object> is like <shape, pattern, etc> makes sense. Other
forms do not:

        if greenish describes the color

                vs
        
        if the color is greenish

demonstrates the lack of transitivity in matching... Ofcourse, the
sentances say the same thing, but the first one is deceiving,
because you think that 'greenish' is the important thing, when we're
really concerned about the color. It is definately not good for
reading code you didn't write, because it's unclear in subtle ways.
I guess this is just as you guys probably have trouble reading my
subtly pigeon english - it seems normal most of the time, but
occasionally it just doesn't make sense since I'm actually
transliterating hebrew.


-- 
 ()  Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418  perl hacker &
 /\  kung foo master: /me wields bonsai kittens: neeyah!!!!!!!!!!!!!!!!

Attachment: pgpLdaCjgkCrs.pgp
Description: PGP signature

Reply via email to