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 A6DD4200BC8 for ; Wed, 23 Nov 2016 08:50:34 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A5A10160AFD; Wed, 23 Nov 2016 07:50:34 +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 EBF8E160AFA for ; Wed, 23 Nov 2016 08:50:33 +0100 (CET) Received: (qmail 5893 invoked by uid 500); 23 Nov 2016 07:50:32 -0000 Mailing-List: contact users-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.apache.org Delivered-To: mailing list users@groovy.apache.org Received: (qmail 5883 invoked by uid 99); 23 Nov 2016 07:50:32 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Nov 2016 07:50:32 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 3F49E1A9D18 for ; Wed, 23 Nov 2016 07:50:32 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.121 X-Spam-Level: X-Spam-Status: No, score=-0.121 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-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 (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id EwQCxHEfhMHr for ; Wed, 23 Nov 2016 07:50:31 +0000 (UTC) Received: from mail-wj0-f179.google.com (mail-wj0-f179.google.com [209.85.210.179]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 135FD5F589 for ; Wed, 23 Nov 2016 07:50:31 +0000 (UTC) Received: by mail-wj0-f179.google.com with SMTP id mp19so4243419wjc.1 for ; Tue, 22 Nov 2016 23:50:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=y1k4gj6kqAkFcjLMsEWWlaijzdXSrBGjCvRbmpPuD3A=; b=QBT7naKyQr9vBPZ0pL+WGAGBu3EKaIJUbblYTyoVadynG1gJXCOtFZcoEJ9CYKmJSb qZVT6FFtV1wINI/yy9OvhJxzNuxPA1ZnCSrdAXEhbDUtV/aNixA6Fa1+V7ZDOzjdOvNt EmRylWie13M9uvhV7UHIV1t9eMtnzZiUnvf+4dd42DeRgBAceppSbwXxhUxwYYORT+qA CpuK2VTNCfn7ewiEdK++IfPscCAMHDJitJZY/rhJKdNtqB08SoBIFCKs/lya4L+8wu5V baZGa9gJUAtaoUD/HX3Sn04724NLL78rGPcRhaIlYycC73nctvVa01NxmwZyRxzIVt+L g/Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=y1k4gj6kqAkFcjLMsEWWlaijzdXSrBGjCvRbmpPuD3A=; b=YKnaUdFZCQM4b9uIL9o6JHeg8ujD3unr+1rtMOczwSZh3esWdJq+gZlVWVj0dAxfBl 7iBRSQX/Z0COCUwFD6dUTGXDg+g+wzD7dLmobxPHCqfb1S7HOzg4wnsCkzTdefFb64o9 YX6g6/D4n4oSMbRDaESssi5cR2Lc/M+YuYzM49Moqddemn7u8bxJMXQS4n9Hi24IuI8U HqtKPFF9hD3iEousBBGtOoSlwb12Gk94RIfjwGIvaa5J3PwixUMNTmMm8ZMFE7uR9tPy v64471e+boxHXl8tzigErmFeAmDxw0s1yefobgoctrMF9SAWV7tnU7zTRNkXRLO3a5l8 CTtQ== X-Gm-Message-State: AKaTC03KCP3WJsOA/lt90WBf7+00MU6nhGfNUuWhrFjGxqhT+RK1dvtBVUmwnZYCt+vanw== X-Received: by 10.194.145.197 with SMTP id sw5mr1907566wjb.156.1479887424056; Tue, 22 Nov 2016 23:50:24 -0800 (PST) Received: from [10.0.0.6] (127.46.77.83.dynamic.wline.res.cust.swisscom.ch. [83.77.46.127]) by smtp.gmail.com with ESMTPSA id ef10sm15359335wjd.22.2016.11.22.23.50.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2016 23:50:23 -0800 (PST) From: =?utf-8?Q?Michael_R=C3=BCegg?= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Named function arguments in Groovy Message-Id: <057803BD-0849-4047-A0EC-E2BC751F63E1@gmail.com> Date: Wed, 23 Nov 2016 08:50:22 +0100 To: users@groovy.apache.org X-Mailer: Apple Mail (2.3251) archived-at: Wed, 23 Nov 2016 07:50:34 -0000 Hi, I have a DSL where I want to pass named arguments like follows: def foo(String a, String b, String c, Closure d) { } foo(a=3D=E2=80=9Ca=E2=80=9D, c=3D=E2=80=9Cc=E2=80=9D, b=3D=E2=80=9Cb=E2=80= =9D) { } I=E2=80=99m aware that named arguments are supported by receiving the = arguments with a map: def foo(Map obj, Closure c) { } foo(a:"a", c:=E2=80=9Dc", b:=E2=80=9Db") { } The problem with this approach is that for a user of this DSL, it is not = obvious which parameters are expected and what their names are (beside = documenting it, but who is going to read that ;-)).=20 How can I achieve named function arguments with =E2=80=9Creal" syntax in = Groovy? Is there an alternative to using maps for this? By the way, I think it is kind of misleading for a beginner that the = following compiles but does not pass the arguments in the intended = order: foo(a=3D"a", c=3D=E2=80=9Cc", b=3D=E2=80=9Cb") { // a =3D=3D a, b =3D=3D c, c=3D=3Db } Is this intended behaviour? Thanks in advance, Michael