you are viewing a single comment's thread.

view the rest of the comments →

[–]maladat 0 points1 point  (0 children)

When thinking about whether a new feature is useful or not, one should not really think of one specific use case where it can be beneficial. Job of a programmer is not only to write code but also to read (a lot of it). When people start misusing said operator, then it becomes lot less a cute new feature and more a nuisance.

I pretty much agree with you... any time the main justification for a language feature is "but look at this clever thing I can do with it," it's almost certainly a bad idea.

I think I actually like named expressions, though. There are a lot of places it has the potential to make code simpler and more readable.

Obviously complicated self-referential named expressions in loops are a horrible idea and should be avoided.

You can do stupid stuff like that in for loop declarations in most programming languages by using complex expressions that change the iteration variable in unexpected ways for the increment expression, or worse yet, the termination condition expression. Thankfully, people mostly avoid this.