InfoQ

News

What should Lambda Expressions in Visual Basic Look Like?

Posted by Jonathan Allen on Dec 12, 2006

Community
.NET
Topics
.NET Framework
Tags
Functional Programming ,
LINQ ,
Visual Basic.NET

In order to support LINQ, Visual Basic is adding support for lambda expressions. Lambda expressions are essentially inline functions and are a corner-stone of functional programming languages like Lisp and Haskell. As the next version of Visual Basic edges ever closer, certain syntactical issues need to be addressed.

On Friday, Paul Vick of Microsoft asked developers what syntax they want for this new capability. He presented three options.

The first is a very concise, C#-like syntax. 

1: C#-style, "x => x + 1" 

The second is more verbose, but also makes it clear that an in-line function is being used.

2: VB-style, "Function(x) x + 1" 

Finally there is a mixed style that uses a backslash, because it resembles a lambda, and C#'s => notation.

3: Hybrid-style, "\x => x + 1"

DiegoV has proposed a fourth syntax with some interesting characteristics. It uses the parameter binding operator (:=) and the parameter's name.

4: bar(x):=x+1

Surprisingly #2 seems to be getting the majority of the support right now. As Sriram Krishnan says,

Definitely #2 - one of the things I loved in VB was that I didn't have to rack my heads as to what a cryptic character meant - which I had to do often in Perl 

 

No comments

Watch Thread Reply

Educational Content

QCon SF Keynote: Techie VC's Talk About Trends & Opportunities

Kevin Efrusy and Salil Deshpande talk about what makes a business successful or not, presenting three actual cases they have been involved with: Hyperic, G2One, SpringSource.

Project Lead Mark Fisher Discusses the Spring Integration Project

InfoQ talks to Mark Fisher, project lead for the Spring Integration project, about the framework.

How HTML5 Web Sockets Interact With Proxy Servers

Peter Lubbers explains in this article how HTML5 Web Sockets interact with proxy servers, and what proxy configuration or updates are needed for the Web Sockets traffic to go through.

Rails in the Large: How Agility Allows Us to Build One Of the World's Biggest Rails Apps

Neal Ford shows what ThoughtWorks learned from scaling Rails development: infrastructure, testing, messaging, optimization, performance.

Stuart Halloway on Clojure and Functional Programming

Stuart Halloway discusses Clojure and functional programing on the JVM in depth, and touches on the uses of a number of other modern JVM languages including JRuby, Groovy, Scala and Haskell.

Oren Teich and Blake Mizerany on Heroku

Oren Teich and Blake Mizerany talk about the technology behind Heroku and the benefits of the new add-on system.

Security for the Services World

Chris Riley presents security issues threatening service based systems, examining security threats, presenting measures to reduce the risks, and mentioning available security frameworks.

Navigating The Rapids:Real-World Lessons in Adopting Agile

This talk investigates technical issues encountered when moving to an Agile process.