Software Assurance Reference Dataset

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 20 05:15:42 PDT 2014


Walter Bright:

> I doubt they'll want to use an @tailrec attribute.

In Scala there is "@tailrec":
http://www.scala-lang.org/api/current/scala/annotation/tailrec.html

In both F# and OcaML there is the "rec" keyword:
http://msdn.microsoft.com/en-us/library/dd233232.aspx

http://caml.inria.fr/pub/docs/manual-ocaml-400/manual003.html#toc4

In Clojure there is "recur" (that is not an annotation):
http://clojure.org/special_forms?responseToken=08ea4841337f67bb8f07663aa70b03aca#recur

I think functional programmers are willing to use @tailrec 
attribute if it's well designed and it does what's written on its 
tin.


>> What about the @continuation
>> (http://en.wikipedia.org/wiki/Continuation-passing_style )?
>
> I doubt they'll want to use that attribute, either.

I don't know. It's more general than the @tailrec, but probably 
many C and C++ and Java programmers don't even know what it is. 
But it allows a programming style that in some case is 
interesting (far cleaner than computed gotos).


> In any case, D supports more styles of programming than any 
> other language I can think of. I doubt adding even more will be 
> that helpful.

I think a basic form of pattern matching implemented with the 
switch construct is a good idea for D.

Bye,
bearophile


More information about the Digitalmars-d mailing list