Bug 26386 - Support loose functions
Summary: Support loose functions
Status: NEW
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2015-01-24 19:11 UTC by Stone
Modified: 2015-01-27 12:59 UTC (History)
1 user (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description Stone 2015-01-24 19:11:35 UTC
This is a question not a bug regarding the csharp REPL.

Currently Mono.CSharp does not support loose functions but supports variables with function expressions. 

So this is valid:
Func<int, int, int> Foo = delegate (int a, int b) { return a + b; }

but not:
public int Foo(int a, int b) { return a + b; }

Loose functions would be something I would be interested in implementing. Loose functions are supported by Roslyn and would be great if Mono could support this as well.

So before I start looking into this I need to ask if this is something that is desired (part of the mono roadmap) and if you would you accept a PR that implemented this feature? 

Because this is not currently supported I suspect that adding this feature is not straight forward.  So I would also be interested to know where the main issues lie.

Comment 1 Marek Safar 2015-01-27 12:59:22 UTC
We'd accept such PR if you don't break any existing tests. I think someone tried to implement it already but it didn't go anywhere. I can see there will most likely be issues at grammar level in our parser.

Note You need to log in before you can comment on or make changes to this bug.