> 
> To put things in perspective, => was introduced in version 3.1, together with 
> map and array support. As far as I understand it and looking again at the 
> specs, one of the use cases is for => to be used with maps and arrays, in an 
> object-oriented style.


In particular, arrays don't have a filter operator in the way that sequences 
do, neither do they have a mapping operator, so to select into an array of maps 
you need to do things like

$A => a:filter( function($m) {$m?name='Mike'}) => a:for-each( function($m) { 
$m?age })

which gets terribly unwieldy if you try to write it with conventional nested 
function calls.

I wish we had done a concise anonymous function declaration as well:

$A => a:filter( {?name='Mike'} ) => a:for-each( {?age} )

Here {EXPR} is shorthand for "function($x){ $x ! EXPR }"
 
but that would have been a bridge too far for some people.

Michael Kay
Saxonica



 
_______________________________________________
talk@x-query.com
http://x-query.com/mailman/listinfo/talk

Reply via email to