DIP: Tail call optimization
Dietrich Daroch via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Mon Jul 11 10:31:23 PDT 2016
On Monday, 11 July 2016 at 16:27:38 UTC, Andrew Godfrey wrote:
> [...]
>
> * It must not be ignorable by the compiler.
>
> * It must generate an error if that compiler would be unable to
> do the TCO. Otherwise, the compiler *may* (not "must") apply
> the TCO, unless compiled under (some optimization level, please
> specify), in which case it *must* apply TCO.
>
> One difficulty with this is the words "that compiler". I.e.
> other compilers are free to be unable to make the TCO. This
> means that by using this feature, you have made your code
> non-portable.
I think that noticing problems while porting it it's better than
having it crash unexpectedly as it would currently happen.
> P.S. You have proposed annotating the function with @tco - it
> seems more like it's the call site that needs to be annotated.
I'm not sure about how to do annotations on the call site. Would
a new keyword be required?
More information about the Digitalmars-d-announce
mailing list