Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356766

Summary: [Xbase] short cut syntax for closures with one arg
Product: [Modeling] TMF Reporter: Sven Efftinge <sven.efftinge>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 Flags: sven.efftinge: indigo+
Version: 2.0.0   
Target Milestone: SR2   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Sven Efftinge CLA 2011-09-06 03:35:28 EDT
A closure with one arg is a very common case. Therefore it's interesting to have a special short cut syntax for them.

The syntax is [ my-expression-using-it ], i.e. there is one implicit variable bound to the variable name 'it'.

So you could write :

newArrayList( 'aaa' , 'a', 'aaaaaa').sort( [length] )
Comment 1 Sven Efftinge CLA 2011-09-06 03:41:08 EDT
pushed to master
Comment 2 Karsten Thoms CLA 2017-09-19 17:10:03 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 3 Karsten Thoms CLA 2017-09-19 17:21:51 EDT
Closing all bugs that were set to RESOLVED before Neon.0