C++0x Concepts - Dead?
Witold Baryluk
baryluk at smp.if.uj.edu.pl
Fri Jul 17 04:15:06 PDT 2009
Dnia 2009-07-17, pią o godzinie 02:32 +0200, BLS pisze:
> bearophile wrote:
> > BLS:
> >>>> bearophile brings in several times Scala/OCAML like pattern matching.
> >>>> Why not using that for constraints ?
> >>> I have no idea how that works, though Bartosz has been looking into it.
> >> O well, I am pretty sure that bearophile is willing to give you any
> >> information you need :)
> >
> > Pattern matching is handy and it can be powerful, for example I've seen OCaML code that uses it to implement a AVL search tree in about 15 lines of code. But probably it also adds lot of complexity to a language like D, so there are more important things to add to D2 now (like good concurrency).
> >
> > Bye,
> > bearophile
>
> I see your point... you are doing bio informatics..so speed matters..
> for me the things are a bit different...
>
> But I guess that you'll agree with me that Scala pattern matching has a
> reasonable syntax. (Not necessarily talking about "How difficult is it
> from a compiler author's view)
>
> object MatchTest2 extends Application {
> def matchTest(x: Any): Any = x match {
> case 1 => "one"
> case "two" => 2
> case y: Int => "scala.Int"
> }
> println(matchTest("two"))
> }
>
>
Hi,
I will point you into two projects:
Prop: http://www.cs.nyu.edu/leunga/prop.html (C++)
Tom: http://tom.loria.fr/wiki/index.php5/Main_Page (multi language)
Both are source-to-source translators.
First is imho nicer (considering syntax), but not maintained.
I'm thinking now about implementing similar thing for D (especially
that I'm also working with Erlang, and some symbolic data and
expressions in D). Or adding D support to Tom (but it is ugly)
Nemerle have also interesting pattern matching.
PS. There is also project called App for C++ pattern matching, but
cant find info now.
More information about the Digitalmars-d-announce
mailing list