groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Suminda Dharmasena (JIRA)" <j...@apache.org>
Subject [jira] [Created] (GROOVY-8071) 1st Class Messages
Date Sun, 05 Feb 2017 13:49:41 GMT
Suminda Dharmasena created GROOVY-8071:
------------------------------------------

             Summary: 1st Class Messages
                 Key: GROOVY-8071
                 URL: https://issues.apache.org/jira/browse/GROOVY-8071
             Project: Groovy
          Issue Type: Improvement
            Reporter: Suminda Dharmasena


Just like the spread operator it would be good to have something similar to saving and calling
function.

E.g.

```
def aCall = .equals(obj1)
obj2.*aCall(obj1) // same as obj2.equals(obj1)
```

Deciding to call and placing the call happens in 2 different instances.

```
def l1 = [ .f1(a), .f2(b)]
myObj.*l1

// similarly
myObj.*[ .f1(a), .f2(b)]
myObj.*[ .f1 : a, .f2 : b]
```

Calls both f1 and f2 and return the results as a list of 2 items.

```
[obj1, obj2].*f1()
```

Call f1 on both objects. Same as spread, but

```
[obj1, obj2].*[.f1(), .f2()]
```

Calls f1 and f2 on obj1 followed by obj2 returning nested list of the 2 values.

```
[obj1 : .f1(a), obj2 : .f(b)].*[.f3(), .f4()]
```

Call returning [Obj1.f1(a).f3(), Obj2.f2(a).f4()]



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message