BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Should VB Break Backwards Compatibility (Again)?

Should VB Break Backwards Compatibility (Again)?

Bookmarks

Paul Vick of Microsoft's Visual Basic team asks the VB community if they are willing to accept a breaking change in order to get a true ternary operator.

A long standing source of annoyance for VB programmers is the lack of a real inline if operator. Compared to the C family's ?/: pair, VB's IIF has some serious limitations.

The first problem is that it is always typed as object. This is a source of frustration for VB developers working on project with strict typing turned on as it almost always requires an additional cast.

The second issue is that unlike other languages, VB doesn't support short-circuiting. Both the true and false parts of the equation are always evaluated, making the operator useless in many situations.

In order to better support LINQ, Microsoft is considering changing the IIF operator to work the same way as it does in C#. However, this will result in a breaking change. The number of projects actually relying on the current behavior is probably very small, but for them the change may cause the project to silently fail.

Voice your opinion at Panopticon Central.

 

 

Rate this Article

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

  • Should VB Break Backwards Compatibility (Again)?

    by Mohamed El-Beltagy,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    I used to be a VB programmer for quite sometime (more than 3 years), then I went with other C-like languages. Right now, I have a question.

    Why Microsoft keeps VB alive till now?
    I mean, the headache it makes to Microsoft and the VB developers is more than what it gives.
    (VB = simplicity), I totally agree. But (VB = effeciency, quality and what ever you might think of), I totally disagree.

  • VB Break Backwards Compatibility?

    by Michael Fitzpatrick,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    >>The second issue is that unlike other languages, VB doesn't
    >>support short-circuiting. Both the true and false parts of the
    >>equation are always evaluated, making the operator useless in
    >>many situations.

    This is true in VB, not in VB.Net: Consider: AndAlso and OrElse
    Why is necessary to reuse the word IIF? MS didn't do in for And and Or, so why do it for IIF. Its easy enough to create a new word for the ternary operator. The only code that breaks is the code that is using the new keyword as an identifier.

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

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

BT