groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <blackd...@gmx.org>
Subject Re: [GEP] Concatenative Method Calls
Date Thu, 01 Mar 2018 22:48:08 GMT
On 26.02.2018 00:53, Daniel Sun wrote:
> Hi Jochen,
> 
>       To be honest, I have no complex examples in my mind. Maybe it will be
> good for DSL(We can think `|>` as a big arrow drawn by | and >):
> 
> ```
> clothes  |>  clean  |>  dry  |>  notify
> ```

In my experience the less grammar elements a DSL has the better, unless 
it is a mathematical DSL. |> does not server that purpose, nor do .& or 
=> or ->

>       I ran the code you provided, error occurred as you expected,  but we
> wish it could run well. We have to refine the implementation...
> 
> groovy> class X {
> groovy>   private bar(){1}
> groovy>   def b = this.&bar
> groovy> }
> groovy> println new X().b()
> groovy> class Y extends X {}
> groovy> println new Y().b()

the implementation will have to provide the caller class as part of the 
method choosing, thus as part of the method reference... unless we 
totally rewrite that and make something entirely different... maybe I 
would experiment with using a callsite as backing for the handle.

bye Jochen

Mime
View raw message