groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MG <mg...@arscreat.com>
Subject Re: [GEP]Lazy evaluation for Groovy 3
Date Sat, 17 Mar 2018 18:16:11 GMT
Same here.
Syntax would definitely clash with my existing code, is imho too concise 
/ not obvious enough for a rare requirement.

Wondering if this is important enough to consider doing this now 
(@Daniel: Am I right in assuming you want to get as much new syntax into 
3.0 as possible ?-) ),  but think concept is worth expoloring in principle.

 From ther top of my hat:

If we had support for parameters to methods being passed as an 
expression (as in C#) / not being evaluated, one could potentially write 
this based on that concept (but intrdoucing that would be an even bigger 
step) (?)
In general I am a propenent of having powerful, general building blocks 
in a language, instead of specialized syntax for spezialized features.

Otherwise (based on things already mentioned):

 1. final records = proxy { doQueryFromDB() } // closure style
 2. final records = proxy doQueryFromDB() // keyword style
 3. final records = proxy(doQueryFromDB()) // function style
 4. Something with @Lazy(proxy=true) ?

Cheers,
mg



On 17.03.2018 14:21, Suderman Keith wrote:
> +1 for the concept.
>
> -1 for using parenthesis.  As Andrew says, this introduces new 
> behaviour for parenthesis that I think violates the principle of least 
> surprise.
>
> Keith
>
>> On Mar 17, 2018, at 1:54 PM, Andrew Bayer <andrew.bayer@gmail.com 
>> <mailto:andrew.bayer@gmail.com>> wrote:
>>
>> Agreed - I don’t think this actually provides much, if any, real 
>> value, is syntactically confusing, and feels like it could cause some 
>> problems with existing code that assumes parentheses aren’t going to 
>> result in new behavior.
>>
>> A.
>>
>> On Sat, Mar 17, 2018 at 8:35 AM Cédric Champeau 
>> <cedric.champeau@gmail.com <mailto:cedric.champeau@gmail.com>> wrote:
>>
>>     -1, I also think this is confusing.
>>
>>     2018-03-17 13:30 GMT+01:00 Guillaume Laforge <glaforge@gmail.com
>>     <mailto:glaforge@gmail.com>>:
>>
>>         I also find it confusing, in particular because it's not
>>         obvious, and there's some redundancy already with @Lazy (and
>>         Paolo has a good point as well as using closures are somewhat
>>         of a palliative as well)
>>         Perhaps we could think of ways to further improve / expand
>>         @Lazy perhaps?
>>         (rather than inventing something new / additional)
>>
>>         On Sat, Mar 17, 2018 at 12:01 PM, Paolo Di Tommaso
>>         <paolo.ditommaso@gmail.com
>>         <mailto:paolo.ditommaso@gmail.com>> wrote:
>>
>>             Frankly I found this confusing, it looks to me that the
>>             same concept can be implemented just using a closure.
>>
>>
>>             p
>>
>>             On Sat, Mar 17, 2018 at 9:08 AM, Daniel.Sun
>>             <sunlan@apache.org <mailto:sunlan@apache.org>> wrote:
>>
>>                 Hi Guillaume,
>>
>>                 I planed to generate proxy for lazy evaluation, so
>>                 even if the reference of
>>                 object is accessed, evaluation will not be triggered
>>                 either, which is
>>                 different from @Lazy
>>
>>                 Cheers,
>>                 Daniel.Sun
>>
>>
>>
>>
>>                 --
>>                 Sent from:
>>                 http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
>>
>>
>>
>>
>>
>>         -- 
>>         Guillaume Laforge
>>         Apache Groovy committer & PMC Vice-President
>>         Developer Advocate @ Google Cloud Platform
>>
>>         Blog: http://glaforge.appspot.com/
>>         Social: @glaforge <http://twitter.com/glaforge> / Google+
>>         <https://plus.google.com/u/0/114130972232398734985/posts>
>>
>>
>


Mime
View raw message