-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Ported from CodePlex
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,
t.Name,
FindParentTask(t, (Task parentTask) -> parentTask.OutlineLevel >= 1 AND parentTask.EnterpriseOutlineCode8.FullName = 'a.b.c').Handle
FROM tasks tThe 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels