Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1DE5F200CC7 for ; Sun, 16 Jul 2017 16:02:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0F5E7164314; Sun, 16 Jul 2017 14:02:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 464B1164312 for ; Sun, 16 Jul 2017 16:02:09 +0200 (CEST) Received: (qmail 4844 invoked by uid 500); 16 Jul 2017 14:02:08 -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 4834 invoked by uid 99); 16 Jul 2017 14:02:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 16 Jul 2017 14:02:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id A23A6C089D for ; Sun, 16 Jul 2017 14:02:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.473 X-Spam-Level: *** X-Spam-Status: No, score=3.473 tagged_above=-999 required=6.31 tests=[FORGED_HOTMAIL_RCVD2=1.187, SPF_SOFTFAIL=0.972, URIBL_BLOCKED=0.001, URI_HEX=1.313] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id kEthq8894_lk for ; Sun, 16 Jul 2017 14:02:00 +0000 (UTC) Received: from mwork.nabble.com (mwork.nabble.com [162.253.133.43]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 75AB75F2FD for ; Sun, 16 Jul 2017 14:02:00 +0000 (UTC) Received: from static.162.255.23.22.macminivault.com (unknown [162.255.23.22]) by mwork.nabble.com (Postfix) with ESMTP id CFD61535BA609 for ; Sun, 16 Jul 2017 07:01:59 -0700 (MST) Date: Sun, 16 Jul 2017 07:01:59 -0700 (MST) From: Daniel Sun To: dev@groovy.incubator.apache.org Message-ID: <1500213719833-5742132.post@n5.nabble.com> Subject: About LINQ-like DSL for Groovy MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit archived-at: Sun, 16 Jul 2017 14:02:10 -0000 Hi all, Although Groovy and Java 8+ can handle data structure easily, it is still less easier and readable than LINQ IMHO. I tried to implement it at the language level and found too many keywords will be introduced to Groovy, so I think LINQ-like DSL will be more feasible. e.g. def nums = [0, 1, 2, 3] // command chain expression can not span rows, so we can use closure to wrap expressions def numQuery = linq { // numQuery is an Iterator from num of nums // in is a keyword of groovy, so use of instead. Maybe some other word is better? where num % 2 == 0 select num } for (num in numQuery) { /* do with the result */ } Note: linq, from, of, where, select are all methods and others are their parameters. Beside the basic use case, joining, grouping etc. are all in the TODO list :) The DSL will be a big work, it will last long. Before I find some time to working on it, I wish you like the LINQ-like DSL idea, although it is not mature enough for the time being ;) Cheers, Daniel.Sun -- View this message in context: http://groovy.329449.n5.nabble.com/About-LINQ-like-DSL-for-Groovy-tp5742132.html Sent from the Groovy Dev mailing list archive at Nabble.com.