Ken Fox wrote:

> Then write the switch as:
>
>   switch ( __ ) {
>     case $v == 1: { ... }
>     case $v == 2: { ... }
>     case $v == @foo { ... }
>   }
>
> It might take you a little while to get your head around the __
> symbol. I'm not sure it's useful to think of it as a variable;
> poison is more like it. Or a Midas touch. Any expression it
> touches turns into a subroutine. All the case statement does is
> call the subroutine.
>
> - Ken

I haven't gotten my head around anything curried, except Indian food....
but it appears to be powerful, and a kind of like generic programming on
the fly.  I'd like to learn more: if someone would give a tutorial
reference that would be helpful.

However, in this particular example, it is clear that you have attempted
to resolve my negative example by using an extremely powerful construct
to take Damian factored switch statement, and effectively unfactor it:
Remove the "switch ( __ )" part, and you have exactly the syntax and
functionality I suggested in my first reponse to his post.

I don't attempt to claim that Damian's proposal isn't clever, isn't
powerful, or isn't cool.  Just that it doesn't DWIM, is hard to learn
and understand because of its large table of operations, and gets most
of its power from that table, together with this currying thing.

I'd like to see the useful, non-trivial operations in his table
available using simple syntax outside the switch statement; they could
then be expressed in the switch statement conditions, or in if
conditions, or while conditions, or any other useful place, rather than
having the programmer be forced to contrive a switch statement to avoid
writing the non-trivial operation syntax.

Further, rather than have a powerful switch statement embodying all
these operations, and have to use a powerful curry operation to reduce
it to a simple case, wouldn't it be nicer to have a simple, easy to
learn switch statement, and have more powerful operators and this curry
thing when needed to achieve the complexity embodied in this RFC?  Make
easy things easy, and hard things possible.

I'll probably counter-propose as Damian suggested, as it does, indeed,
look like we are quite far apart on this issue, and it would take more
than a few postings to resolve.

--
Glenn
=====
There  are two kinds of people, those
who finish  what they start,  and  so
on...                 -- Robert Byrne


_______________________________________________
Why pay for something you could get for free?
NetZero provides FREE Internet Access and Email
http://www.netzero.net/download/index.html

Reply via email to