Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Contribute

### Choose your language

InfoQ Homepage News What should Lambda Expressions in Visual Basic Look Like?

# What should Lambda Expressions in Visual Basic Look Like?

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

Adoption
Style

## Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

## Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p