What do you think of multiline lambdas in VB 10

前端 未结 7 3005
抹茶落季
抹茶落季 2021-02-20 03:09

I was just watching a video on MSDN Channel 9 which can be found here, about some of the new features in Visual Basic 10. Now I like most of the new features, some of which hav

7条回答
  •  时光说笑
    2021-02-20 03:52

    Personally, I think that VB's syntax for delegates and lambdas is completely bogus. I mean, come on, AddressOf! This was fine in VB6. It is definitely not fine in a language such as VB.NET where functions should be treated as first-class citizens (although they really aren't, of course) and where conversion from method groups to delegates is more or less transparent.

    Now the introduction of inline functions is horribly verbose. I actually believe that the C# approach – x => f(x) would fare very well in VB because it shows exactly what it does. At the current state, I prefer C# for any functional programming work, which is a pity because I generally favour VB.

    Now, I really rejoice that VB finally gets multiline lambdas and statement lambdas because they're still useful sometimes (take the case of Parallel.For). But the syntax is messed up. The same goes for iterators, by the way (if they should make it into VB10).

提交回复
热议问题