From dev-return-4382-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Sat Mar 17 08:41:16 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 713D018067B for ; Sat, 17 Mar 2018 08:41:15 +0100 (CET) Received: (qmail 26678 invoked by uid 500); 17 Mar 2018 07:41:14 -0000 Mailing-List: contact dev-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list dev@groovy.apache.org Received: (qmail 26347 invoked by uid 99); 17 Mar 2018 07:41:13 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Mar 2018 07:41:13 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 2A4A6C012E for ; Sat, 17 Mar 2018 07:41:13 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.693 X-Spam-Level: *** X-Spam-Status: No, score=3.693 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, KAM_NUMSUBJECT=0.5, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, URI_HEX=1.313] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id YfCWdKI-ld6u for ; Sat, 17 Mar 2018 07:41:11 +0000 (UTC) Received: from mail-it0-f47.google.com (mail-it0-f47.google.com [209.85.214.47]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id CD39C5F18A for ; Sat, 17 Mar 2018 07:41:09 +0000 (UTC) Received: by mail-it0-f47.google.com with SMTP id z143-v6so4207842itc.0 for ; Sat, 17 Mar 2018 00:41:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YjG3/Oy/XU9Y7MaY5tdpZO57eHLdFTcGBvDtV2+RyLA=; b=R2dH5II32ajkymHWFoeconaJkopVZDPVzsD42ZZqLMCa55Sg9PoaXxC8qLs8lAy8gl CaD8NFcUn3WN+qa+P7o4pT553H55a0cuFH08w3g/ICOB5zqg3Lfca2Dd69HDdmwtPKss z/gK6AJlBXwLrIaGA8tHxEh6p8p9pm1AHJ+0P0r+A0FRoUlowH/0l2NhlnC0SxqRh+5i 6rFetahSxQWDE/YUjSw5gAf2qQ/cm0F5Z+JCFiFKsLWXmHtCLuOHBq1sgB6mJF1Bb1H4 jIAn1uPIIdllSZd/dS4T/3qkOpB6F9FX2EZkvy+1t+axPf8otIPl/fB+997zsCL8BGGJ z+3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YjG3/Oy/XU9Y7MaY5tdpZO57eHLdFTcGBvDtV2+RyLA=; b=jRqtmIoeaKXGK93dG8f6I4q/DFUsQbqGfR6b0v9HRdu9HCDvHzOtF9eyTLBkw3H2xb USDS6ge1IJfVFnUvAyfOQr138B9ShaBFG8m4pX5XZpYZhL0oh3NdL7LahA+odZQSmbA2 t8ABJjFX/yuAOQr82NAeNloZch4LDe9TWWIcdAkqsfRURufrFP7R4Qz3wOiWpUmyOObs SMA7QqYcUNdeHH8pd1HuSMuZHa6ZLjkdXTxxQyA9ClsMYnAaS1xaidNHUkx0uoyVk77K S+eoAUPz8EbDDWuH878xoYqUy+sjrM5ee8IQHVsmSv3d2hMtJUWiI/oFi4XR0ZTKU69O P+JQ== X-Gm-Message-State: AElRT7EcXIWPR4aTk9ElVVho2+YcVvwvpMUc1wSyI02NOMxhxSGl+GDO Gg4pWgfNmu+1i+JNGErDP6pwHX6skWSE95Z3ev4BCA== X-Google-Smtp-Source: AG47ELtIfha9hiQ0w+aC3cJ46ExzcGQ/U02q+1nsfaRKdqjaLrtDWClOuCIatccDsumbAKt6X2yUHr6xODwSMAGL8Us= X-Received: by 2002:a24:343:: with SMTP id e64-v6mr5066389ite.46.1521272462519; Sat, 17 Mar 2018 00:41:02 -0700 (PDT) MIME-Version: 1.0 References: <1521272109038-0.post@n5.nabble.com> In-Reply-To: <1521272109038-0.post@n5.nabble.com> From: Guillaume Laforge Date: Sat, 17 Mar 2018 07:40:50 +0000 Message-ID: Subject: Re: [GEP]Lazy evaluation for Groovy 3 To: dev@groovy.apache.org Cc: Groovy_Developers Content-Type: multipart/alternative; boundary="000000000000bc3c7e056796d8ca" --000000000000bc3c7e056796d8ca Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable But we already have @Lazy which is a bit more explicit? Le sam. 17 mars 2018 =C3=A0 08:35, Daniel.Sun a =C3=A9c= rit : > Hi all, > > Sometimes we do not want evaluate some expression eagerly(Maybe > evaluation is expensive), e.g. a table contains a field `records` whose > content is queried from DB, but we do not get the content of `records` > eagerly util we access `records`. > > class SomeTable { > def records =3D ( doQueryFromDB() ) // the expression in the > parentheses will be evaluated lazily > def sum() { > // access the methods or fields of `records`, trigger > evaluation, i.e. the query of DB > } > def getRecords() { > return records // do NOT trigger evaluation > } > } > > Lazy evaluation syntax is very simple( just supports 1) and 2) )= : > 1) def v =3D ( someExpression() ) // Lazy evaluation for variable > declaration > 2) v =3D ( someExpression ) // Lazy evaluation for assignment > 3) println(( someExpression )) // NOT lazy evaluation > > Any thoughts? > > Cheers, > Daniel.Sun > > > > -- > Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html > --000000000000bc3c7e056796d8ca Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
But we already have @Lazy which is a bit more explicit?
Le sam. 17 mars 2018 = =C3=A0 08:35, Daniel.Sun <sunlan@ap= ache.org> a =C3=A9crit=C2=A0:
http://groovy.329449= .n5.nabble.com/Groovy-Dev-f372993.html
--000000000000bc3c7e056796d8ca--