Return-Path: X-Original-To: apmail-groovy-users-archive@minotaur.apache.org Delivered-To: apmail-groovy-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 49FAA1796B for ; Tue, 1 Sep 2015 06:16:25 +0000 (UTC) Received: (qmail 10316 invoked by uid 500); 1 Sep 2015 06:16:25 -0000 Delivered-To: apmail-groovy-users-archive@groovy.apache.org Received: (qmail 10275 invoked by uid 500); 1 Sep 2015 06:16:25 -0000 Mailing-List: contact users-help@groovy.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.incubator.apache.org Delivered-To: mailing list users@groovy.incubator.apache.org Received: (qmail 10262 invoked by uid 99); 1 Sep 2015 06:16:25 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Sep 2015 06:16:25 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 8EC78182574 for ; Tue, 1 Sep 2015 06:16:24 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.9 X-Spam-Level: *** X-Spam-Status: No, score=3.9 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, KAM_LIVE=1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id p_iirC92x2To for ; Tue, 1 Sep 2015 06:16:15 +0000 (UTC) Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 38BC7506FD for ; Tue, 1 Sep 2015 06:16:15 +0000 (UTC) Received: by wibz8 with SMTP id z8so20279817wib.1 for ; Mon, 31 Aug 2015 23:16:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=J9zACIjA22G6jKL61emXgvl8sK52uRBG+6D5FXcyLmg=; b=hez29jl9RRjhb9zXLVPXahY3pSLpikQfQM2odzPP+vfV0GJOObpuATE0exJXjpCSwG Km5fsykwV3tzsjSJ1W1c1N5xlIZMuKLcH8gt3nJxqUWt6eRC1WPRDalldecZCqnVb1ki k6bHPqSxmgFN14ROcXeO1dezBo+ztPeeCRZAO3Z9HIwILdK/VV8cZ+TlQ3dHJlTqzGh9 7nD26kb5OCmrcSPl/JADZmEVIiqg09gZGKXGtxa9IpDEDyF1ecoeTueYmCaH6R1YaJei HrdfNCBlFN+2BCAhhZrEWF5SmN0bD0UdPpqUfzO65ztc2kHGDx06YOB+b1fRaAEERkZQ c9+w== MIME-Version: 1.0 X-Received: by 10.194.95.71 with SMTP id di7mr32810315wjb.125.1441088174342; Mon, 31 Aug 2015 23:16:14 -0700 (PDT) Received: by 10.28.1.146 with HTTP; Mon, 31 Aug 2015 23:16:14 -0700 (PDT) In-Reply-To: <55E5412F.3030507@gmx.org> References: <55E5412F.3030507@gmx.org> Date: Tue, 1 Sep 2015 01:46:14 -0430 Message-ID: Subject: Re: Invoking a method/closure/constructor with an arity equal to one without any argument doesn't fail From: =?UTF-8?Q?Edinson_E=2E_Padr=C3=B3n_Urdaneta?= To: users@groovy.incubator.apache.org Content-Type: multipart/alternative; boundary=047d7bea43d6b8c7af051ea97c24 --047d7bea43d6b8c7af051ea97c24 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thank you, blackdrag. I always can count on you. Cheers. On Tue, Sep 1, 2015 at 1:39 AM, Jochen Theodorou wrote: > you miss nothing. This is a logic I wanted to get rid of before Groovy 1.= 0 > already, but was said to be needed for some special constructs back then. > And now you cannot easily remove it. But the static compiler does not > support it, because in the longterm we want to get rid of it > > bye blackdrag > > > Am 01.09.2015 08:02, schrieb Edinson E. Padr=C3=B3n Urdaneta: > >> Hi, everyone. >> >> I'm trying to understand why the following asserts hold >> >> // Method >> def m(def x) { x } >> assert m() =3D=3D null >> >> // Closure >> def c =3D { def x -> x } >> assert c() =3D=3D null >> >> // Constructor >> class Klass { >> String msg >> >> Klass(def x) { >> this.msg =3D "$x should be null" >> } >> } >> assert (new Klass()).msg =3D=3D 'null should be null' >> >> The arity of the method/closure/constructor is one but I can call it >> without any argument at all. What I'm missing? >> >> Thank you in advance. >> > > > -- > Jochen "blackdrag" Theodorou > blog: http://blackdragsview.blogspot.com/ > > --047d7bea43d6b8c7af051ea97c24 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thank you, blackdrag. I always can count on you= .

Cheers.

On Tue, Sep 1, 2015 at 1:39 AM, Jochen Theo= dorou <blackdrag@gmx.org> wrote:
you miss nothing. This is a logic I wanted to get rid of before Groo= vy 1.0 already, but was said to be needed for some special constructs back = then. And now you cannot easily remove it. But the static compiler does not= support it, because in the longterm we want to get rid of it

bye blackdrag


Am 01.09.2015 08:02, schrieb Edinson E. Padr=C3=B3n Urdaneta:
Hi, everyone.

I'm trying to understand why the following asserts hold

// Method
def m(def x) { x }
assert m() =3D=3D null

// Closure
def c =3D { def x -> x }
assert c() =3D=3D null

// Constructor
class Klass {
=C2=A0 =C2=A0 =C2=A0String msg

=C2=A0 =C2=A0 =C2=A0Klass(def x) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0this.msg =3D "$x should be null"= ;
=C2=A0 =C2=A0 =C2=A0}
}
assert (new Klass()).msg =3D=3D 'null should be null'

The arity of the method/closure/constructor is one but I can call it
without any argument at all. What I'm missing?

Thank you in advance.


--
Jochen "blackdrag" Theodorou
blog: http://blackdragsview.blogspot.com/


--047d7bea43d6b8c7af051ea97c24--