This project has moved and is read-only. For the latest updates, please go here.


Add support for lambda expressions


It would be great if we would have support for lambda expressions. Lambda expressions would allow clients to write functions which accepts expressions written in SQL. For example imagine you would have a function in C# like this:
delegate bool TaskPredicate(Task task);
Task FindParentTask(Task startingTask, TaskPredicate taskPredicate)
 Task currentTask = startingTask;
 while (currentTask != null)
  if (taskPredicate(currentTask))
  return currentTask;

  currentTask = currentTask.Parent;

 return null;
This function should be accessible in the query engine like this:
SELECT  t.Handle,
        FindParentTask(t, (Task parentTask) -> parentTask.OutlineLevel >= 1 AND parentTask.EnterpriseOutlineCode8.FullName = 'a.b.c').Handle
FROM    tasks t
The lambda expression syntax is something like this:
(<ParameterType> <ParameterName ... ) -> <Expression>
In contrast to C# 3.0 I would suggest making the declaring parameters explicit is better. First it radically simplifies the overload resolution process and secondly if improves the readabillity of the lambda expression.
Closed Oct 31, 2014 at 7:35 AM by terrajobst