[osflash] switch - case

Evan evan at tenpoundsound.com
Thu Feb 16 11:59:35 EST 2006


Isn't that kinda like the Java/Phython/AS3/Etc try-catch-finally syntax?

try {
  do_something;
}
catch (expression) {
  // ...
}
catch (expression) {
  // ...
}
finally {
  try {
    something_else;
  }
  catch (expression) {
    // ..
  }
}

-Evan

On 2/16/06, Dan Shryock <dan.shryock at gmail.com> wrote:
>
> IMHO it is an abuse simply because the syntax isn't necessarily obvious
> for someone who expects a case inside of a switch to match the param to the
> switch.  Maybe we should all start lobbying the major c based languages to
> support a syntax like this ;)
>
> choose{
>    when(bla){
>       //...
>    }
>    when(bla2){
>       //...
>    }
>    otherwise{
>       //...
>    }
> }
>
> Dan
>
> On 2/16/06, Evan <evan at tenpoundsound.com > wrote:
> >
> > I'm confused about you think that's an abuse of switch? That's a valid
> > use that's been used for YEARS in C programming, it's nothing new.
> >
> > -Evan
> >
> > On 2/15/06, Bob Ippolito < bob at redivi.com> wrote:
> > >
> > >
> > > On Feb 15, 2006, at 8:59 AM, Jos Yule wrote:
> > >
> > > > Ralf Bokelberg wrote:
> > > >> You can do it like this
> > > >>
> > > >> switch( true){
> > > >>      case (model instanceof DivideSentenceStep1):
> > > >>               //...
> > > >>      case (model instanceof DivideSentenceStep2):
> > > >>               //...
> > > >>      default:
> > > >>               //...
> > > >> }
> > > >
> > > > That is very clever.
> > >
> > > Why the heck would you want to abuse switch like that?
> > >
> > > if (mode instanceof ...) {
> > >         // ...
> > > } else if (mode instanceof ...) {
> > >         // ...
> > > } else if (mode instanceof ...) {
> > >         // ...
> > > } else {
> > >         // ...
> > > }
> > >
> > > -bob
> > >
> > >
> > > _______________________________________________
> > > osflash mailing list
> > > osflash at osflash.org
> > > http://osflash.org/mailman/listinfo/osflash_osflash.org
> > >
> >
> >
> > _______________________________________________
> > osflash mailing list
> > osflash at osflash.org
> > http://osflash.org/mailman/listinfo/osflash_osflash.org
> >
> >
> >
>
> _______________________________________________
> osflash mailing list
> osflash at osflash.org
> http://osflash.org/mailman/listinfo/osflash_osflash.org
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/osflash_osflash.org/attachments/20060216/b61a2846/attachment.htm


More information about the osflash mailing list