← Back to context

Comment by aboardRat4

1 day ago

Does it have tail recursion?

If nothing else dotnet has TCO IL operations (C# doesn't compile down to them last I knew but F# does) so in theory shouldn't be hard to add.

  • MSIL was designed to support plenty of languages, including C and C++, which WebAssembly advocates tend to never mention.

    As such there are plenty of MSIL and CLR capabilities not yet fully exposed in C#.

    One of the improvements in C# during the last decade, has been exposing low level coding abilities into C#, which is nothing more than taking advantage of those primitives originally designed for C and C++ support.

    Likewise, .NET also had support back in 2001 for FP languages, thus TCO.

    https://news.microsoft.com/source/2001/10/22/massive-industr...

I'm pretty sure it does. I would even think that it tries to optimize such, as a recent check-in comment claims improvements of TCO.

  • A lisp without tail recursion would be a sad thing.

    • It's not unusual for lisp interpreters to lack TCO. Also the (relative) popularity of dynamic binding in Common Lisp reduced the opportunities for TCO.

      There's not really a consensus in the parts of the CL community that I'm familiar with on whether or not code relying on TCO is idiomatic or not.

    • Common Lisp does not require implementations preform tail call optimization in general, or even in just the limited case of tail recursion.