Which .NET languages have syntactic support for extension methods?

I've recently asked a question about designing API that are mostly based on interfaces and extension methods.

Which made me wonder, are there .NET languages that don't directly support extension methods, i.e. languages where working with such an API would become a pain?

I'm aware that extension methods are simply static methods and can likely always be called as such, but with "support for extension methods" I mean a tighter integration into the language's syntax for calling methods on an object; the way extension methods can be used in C# as if they were regular methods.

Which of the more popular .NET languages besides C# and VB.NET actually support extension methods, and which don't?

Upvotes: 0

Views: 159

Answers (1)

F# supports extension methods in recent versions (e.g. the version that ships with VS2010). See also this answer to the question, "Using extension methods defined in C# from F# code".


PowerShell can be made to sort of support extension methods via the Extended Type System.


IronPython seems to support extension methods...


IronRuby, according to this answer to the question, "IronRuby calling C# Extension Methods - Error - Compatibility in .NET 3.5", supports extension methods starting with version 1.4 (which requires .NET 4) via using_clr_extensions.


IronScheme: does have extension methods, but I'm not entirely sure whether they are the same mechanism as extension methods in C# 3.


Boo, according to this answer to the question "How can i use Extension Methods in boo", supports extension methods starting from version 0.9.0.


Nemerle seems to support extension methods, too (according to a page on its website).


Managed C++: (expanding on stakx's answer) Managed C++ supports Extension Methods as you can see in this answer.


(Please feel free to expand and improve this answer!)

Upvotes: 3

Related Questions