From dev-return-5363-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Sun Sep 9 22:29:34 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 5CBD0180671 for ; Sun, 9 Sep 2018 22:29:33 +0200 (CEST) Received: (qmail 44121 invoked by uid 500); 9 Sep 2018 20:29:32 -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 44111 invoked by uid 99); 9 Sep 2018 20:29:31 -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; Sun, 09 Sep 2018 20:29:31 +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 71D65C0386 for ; Sun, 9 Sep 2018 20:29:31 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 4.451 X-Spam-Level: **** X-Spam-Status: No, score=4.451 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, KAM_INFOUSMEBIZ=0.75, KAM_NUMSUBJECT=0.5, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, T_DKIMWL_WL_MED=-0.01, 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-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id snKKcaiMRv0b for ; Sun, 9 Sep 2018 20:29:28 +0000 (UTC) Received: from mail-vk1-f195.google.com (mail-vk1-f195.google.com [209.85.221.195]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id B8D225F36D for ; Sun, 9 Sep 2018 20:29:27 +0000 (UTC) Received: by mail-vk1-f195.google.com with SMTP id s17-v6so2623552vke.10 for ; Sun, 09 Sep 2018 13:29:27 -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=6eeHlBoI0hWSMh/DZ360UxLMnrpjb/g9FXz8hKvpM1U=; b=EitLGFNT/LzJL8nJmUbd8WN6K8aeCtZ9zWZ3h5evztZMzkvss/7/mSsajS3l5sdPlj HvWPgs3QFcGAgvqV6WEVl6Cz5VlSNwOFoeIiRBqpLCFOzKBcG4vBecR4QAj9TpmZZboY simLKvvxmcL72UbxHLL0qkNrl0PICXQcbRNWGwBLTKwz5u8Sv+GU94u4KIfTDMn03KNG WBY/0mfwP5QtIirKucd0DGJef+6kG4j9V/Yxfw1CGLBOk+Xoq6Tw3HPzeM/m6bA40f3s GaHJGt4misl80181027CZVlploIVhEavhNVND0tNhGavRmESFK8kS0WhlINGyYuyYWv5 +Wkw== 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=6eeHlBoI0hWSMh/DZ360UxLMnrpjb/g9FXz8hKvpM1U=; b=FZV+5MLsDoSZjGYOucd8z1Z0KRjpOuI55f2QcuXWGU64Z0ZPz5OAImyPgOmH2rEGIi v7BrXUzs+D3pLMAczOIQ87Y9RJLKHi4bxMAN6KMNZN7pAfpwowlZ8mC7mmsUc4H/Suup VIb7DczHD7tZ/fdJDLBwMOC4rfqtv8ZygOPaRlwL8BFFDnKjQD10zrgoIeNCb8ub/U3M Bm4PDLEqh5pB4tjULyQTXHKpiOan69StG2kqzs4PcyPACPd0V3uBHOfIkjY/45Mw2Ya+ rogQjXcHhotec7rNGipXM27huRq24l5X3u2tqsGTvPaDSQpSegf9pnRprNyOX01Y4mx1 EomA== X-Gm-Message-State: APzg51D3Pbn6xFFIJ0fjauM5kKTDoRjSZ3jMSBye/pGUSw9z+bSiqwZZ yKpzoUGqO3MCC3zMOBCiUTyFejP9LeYF3Kr76lcLIA== X-Google-Smtp-Source: ANB0VdZS0CROrqbFSww3P8a/aUVim1fCC5kHpZn+3zt/MHuxoKNKyfNlj/9WC0AB3KRoolBZJ9h/61lpKSGLkUT9PfE= X-Received: by 2002:a1f:952:: with SMTP id 79-v6mr5469601vkj.49.1536524961042; Sun, 09 Sep 2018 13:29:21 -0700 (PDT) MIME-Version: 1.0 References: <1536368845803-0.post@n5.nabble.com> <1c1fd653-42e3-e9ee-62f6-0d78f4b2a3d8@arscreat.com> <1536445780908-0.post@n5.nabble.com> <1536469833049-0.post@n5.nabble.com> In-Reply-To: <1536469833049-0.post@n5.nabble.com> From: Alessio Stalla Date: Sun, 9 Sep 2018 22:28:53 +0200 Message-ID: Subject: Re: [Proposal] GString is implemented eager and treated as normal String since groovy 3.0.0 To: dev@groovy.apache.org Cc: dev@groovy.incubator.apache.org Content-Type: multipart/alternative; boundary="0000000000007dd7d005757618c2" --0000000000007dd7d005757618c2 Content-Type: text/plain; charset="UTF-8" But are users confused by GString today? Or would they be confused if its behaviour changed and their code stopped working? Also, which users do you have in mind, noobies, experts, DSL writers, ...? I for one would like GString to stay the way it is. The examples you presented don't show problems with GString, rather they show how other issues can manifest through GString. The first example is a toString method with side effects, which is definitely poor practice. If you wanted to showcase in general the interaction of mutable objects with GString, then the current behavior (GString reflects the object's state) might actually be what users want. I.e. GString as a crude but effective template solution. The second example is a problem with type inference. Accessing a Map by a key which is not a String should raise a warning. Also if it's not already the case the static compiler could handle String x = "$k" by silently inserting a toString() call, i.e., emitting an implicit type conversion. On Sun, 9 Sep 2018 at 07:10, Daniel.Sun wrote: > Hi MG, > > The original target of the proposal is to make GString not confuse > users and make GString behave same both in dynamic and static compilation > mode. so it will only introduces breaking changes just in some edge cases. > > Cheers, > Daniel.Sun > > > > ----- > Daniel Sun > Apache Groovy committer > Blog: http://blog.sunlan.me > Twitter: @daniel_sun > > -- > Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html > --0000000000007dd7d005757618c2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
But are users confused by GString today? Or would the= y be confused if its behaviour changed and their code stopped working? Also= , which users do you have in mind, noobies, experts, DSL writers, ...?
=

I for one would like GString to stay the way it i= s. The examples you presented don't show problems with GString, rather = they show how other issues can manifest through GString.

The first example is a toString method with side effects, which is d= efinitely poor practice. If you wanted to showcase in general the interacti= on of mutable objects with GString, then the current behavior (GString refl= ects the object's state) might actually be what users want. I.e. GStrin= g as a crude but effective template solution.

= The second example is a problem with type inference. Accessing a Map<Str= ing, ?> by a key which is not a String should raise a warning. Also if i= t's not already the case the static compiler could handle String x =3D = "$k" by silently inserting a toString() call, i.e., emitting an i= mplicit type conversion.


=
On Sun, 9 Sep 2018 at 07:10, Daniel.Sun <sunlan@apache.org> wrote:
Hi MG,

=C2=A0 =C2=A0 =C2=A0 The original target of the proposal is to make GString= not confuse
users and make GString behave same both in dynamic and static compilation mode. so it will only introduces breaking changes just in some edge cases.<= br>
Cheers,
Daniel.Sun



-----
Daniel Sun
Apache Groovy committer
Blog: http://blog.sunlan.me
Twitter: @daniel_sun

--
Sent from: http://groovy.329449.n5.nabble.= com/Groovy-Dev-f372993.html
--0000000000007dd7d005757618c2--