From dev-return-5622-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Wed Nov 7 11:44:50 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 14BB8180649 for ; Wed, 7 Nov 2018 11:44:48 +0100 (CET) Received: (qmail 26414 invoked by uid 500); 7 Nov 2018 10:44:48 -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 26403 invoked by uid 99); 7 Nov 2018 10:44:47 -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; Wed, 07 Nov 2018 10:44:47 +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 0F405CD3B8 for ; Wed, 7 Nov 2018 10:44:47 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.862 X-Spam-Level: *** X-Spam-Status: No, score=3.862 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=2, KAM_INFOUSMEBIZ=0.75, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URI_HEX=1.313] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=jetbrains.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id Eq-Fg944eLlA for ; Wed, 7 Nov 2018 10:44:44 +0000 (UTC) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 6F3715F23D for ; Wed, 7 Nov 2018 10:44:44 +0000 (UTC) Received: by mail-lf1-f49.google.com with SMTP id p6so4077570lfc.1 for ; Wed, 07 Nov 2018 02:44:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jetbrains.com; s=googleapps; h=from:mime-version:subject:date:references:to:in-reply-to:message-id; bh=Oo9ozEP35lCJtTWMG5W1cUowa95ux82DzCohzRrEfDE=; b=RIqxU22rRJANqyv50JRqVpevoYrkD0RPfw3fAr20MYnvdaWn44z5Cvxn78AUyyJkMp eWKqnCBTF3FTACyDYE3/zjk9hrcuSc3rIkBAwHx0B9A8uBC7/JrDXqEFKsJf/Ss/oI5j zaJKFXuANRnCJ1QHW5zt/GjCmtmFX3sAOMmik= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:date:references:to :in-reply-to:message-id; bh=Oo9ozEP35lCJtTWMG5W1cUowa95ux82DzCohzRrEfDE=; b=DnCjjn/8Mn9DWzcrLJUODbv6TXkWrfrNmUdbn3hU3Q9oynCEG1iKgbKTrLURh3DsP4 JRrNK3pyZPLL5aL56CmSm9//0kl4uFuB2UNrK/f8PgL2qQ8P4uEH0SEPSXZIg+DmCZ2Y RYdpkT368t7yS9NTbyG16fEVXeMxbA8bN4TRa5EdmhXW8iLgMeVedjM+KJAt5fl3AD+E 2+iW/13AXKJAbFiwOmYuRnB8UQ3Eo/D8oq0RYgV2V8qEU7y35GQC0GZ4enCiAMD4tvrb 31m00jbNjEbyXMmoBNH1CvE8Qponmz62DGQEpzaE8X6l0mOdldIcnz7QHwSfEFSBNX6b knBg== X-Gm-Message-State: AGRZ1gKvRzBouFvXUmdZXqWXAZCR2ErJcgWBcMaAGu01rY0nMVoKmos7 dOBuqJo+VdWrmT0RlWkBDwZxwcbt3F4= X-Google-Smtp-Source: AJdET5eN9T9k9nR5r284KrZEJfmcpkmmPfWIxQvIpbYdvOVnl875lKqfYsS7m9ysgo0HRRzxfjE5BA== X-Received: by 2002:a19:6514:: with SMTP id z20mr815077lfb.31.1541587478215; Wed, 07 Nov 2018 02:44:38 -0800 (PST) Received: from danyjb-mbp.labs.intellij.net ([81.3.129.6]) by smtp.gmail.com with ESMTPSA id f11sm52202lfi.12.2018.11.07.02.44.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 02:44:37 -0800 (PST) From: Daniil Ovchinnikov Content-Type: multipart/alternative; boundary="Apple-Mail=_EEDAA4FA-40BF-4091-933A-5409BAC12868" Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: About the enhanced version of `Properties`, i.e. `GProperties` Date: Wed, 7 Nov 2018 13:44:36 +0300 References: <1541127914160-0.post@n5.nabble.com> <1541173162574-0.post@n5.nabble.com> <1541218286175-0.post@n5.nabble.com> <1541504409105-0.post@n5.nabble.com> To: dev@groovy.apache.org In-Reply-To: Message-Id: <844FF17E-9864-4F21-83BA-89757845B4DA@jetbrains.com> X-Mailer: Apple Mail (2.3445.9.1) --Apple-Mail=_EEDAA4FA-40BF-4091-933A-5409BAC12868 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > The GProperties language is the same language or a subset of the > Properties language which doesn=E2=80=99t mean that same extension should be used, see = example with .java/.groovy. > Even with standard Properties, users are free to add keys for > interpolation to their values, or add SQL statements as values, none > of that requires a change of file Extension which still doesn=E2=80=99t mean that same extension should be used. > Special IDE support is not required, whatever support an IDE offers > for standard Property files also works fine for GProperties I guarantee users will want essential features: - navigate from interpolation to the property; - find usages of a property; - rename a property and expect its usages in other properties to be = updated. > None of Commons-Configuration, > Archaius(https://github.com/Netflix/archaius) or even ResourceBundle > (https://www.mscharhag.com/java/resource-bundle-single-quote-escaping) > use a different file extension commons-configuration is not supported because:=20 - there is not much demand because it is a third-party library; - there is still no way to know if some property file is = commons-configuration property file; - there is other non-declarative stuff which is basically = unsupportable at all. Archaius is basically commons-configuration. RB is a different mechanism, it is about external parameters for = properties, it=E2=80=99s not about using some property in the = interpolation. > Properties also support loadFromXml(), and I guess nobody wants to > suggest using .gxml as different extension? That is a good point.=20 Observation: xml properties file is expected to use specified doctype = which makes is distinguishable from other xml files. If GProperties is a subclass of Properties then is either should provide = a way to distinguish gproperties from regular xml properties or throw = exception in loadFromXml/storeToXML. =E2=80=94 Daniil Ovchinnikov JetBrains > On 7 Nov 2018, at 03:13, Thibault Kruse = wrote: >=20 >> I propose to use "gproperties" as file extension. >=20 > '.properties' is the correct file extension for GProperties. There are > several reasons: >=20 > * The GProperties language is the same language or a subset of the > Properties language > * Even with standard Properties, users are free to add keys for > interpolation to their values, or add SQL statements as values, none > of that requires a change of file Extension > * Special IDE support is not required, whatever support an IDE offers > for standard Property files also works fine for GProperties > * None of Commons-Configuration, > Archaius(https://github.com/Netflix/archaius) or even ResourceBundle > (https://www.mscharhag.com/java/resource-bundle-single-quote-escaping) > use a different file extension > * Properties also support loadFromXml(), and I guess nobody wants to > suggest using .gxml as different extension? >=20 >=20 > Some other concerns: >=20 >> P.S. Unbalanced curlies will not be considered, because curlies are = valid characters for the value of property. >=20 > I don't understand what any of that means, but you can add a testcase > for locally unbalanced properties like this: >=20 > foo =3D Hello {{{name1} and {name2}}} >=20 > to your testcases. >=20 > Also, I believe the key of properties files can also contain special > characters, so these are also valid keys: >=20 > { =3D leftcurly > } =3D rightcurly > {{ =3D mustache > {} =3D ufo >=20 > So in GProperties it should be possible to reference them, like >=20 > uforef =3D {{{}}} >=20 > Yeah, not really. To properly reference those you'd need a way to > better mark the start of an interpolation key (such as ${}), and a way > to escape the interpolation end symbol inside an interpolation key. At > this time I believe you can pretty much forget about regular > expressions, and start writing a traditional Character-by-Character > parser for GProperties. >=20 >=20 > Another unrelated topic is whether and how to combine importing and > interpolation. As an example: >=20 > import.properties =3D application-{profile}.properties >=20 > I think the latest version of GProperties would not interpolate that, > not sure if intentionally or by mistake (since resolving the key > against imports would be tough during importing). This is related to > the next concern. >=20 > Similarly, a question is whether interpolation may use values from > imported files. As an example: >=20 > import.properties =3D ~/.access_secrets.properties > window.title =3D {db.username} logs in with {db.password} >=20 > I believe the implication for security should be obvious. >=20 >=20 > Finally, for backwards compatibility: > Commons-configuration also has the typesafe accessors (getLong(), > getString(), getInt()...) which do variable interpolation. But > getProperty() actually returns the raw, non-interpolated String from > the properties. That might be a good idea for GProperties, too (for > backwards compatibility but also for other purposes, such as > debugging). >=20 >=20 >=20 >=20 > On Tue, Nov 6, 2018 at 8:40 PM Daniel.Sun wrote: >>=20 >> Understood. >>=20 >> I propose to use "gproperties" as file extension. >>=20 >> Cheers, >> Daniel.Sun >>=20 >>=20 >>=20 >>=20 >>=20 >> ----- >> Daniel Sun >> Apache Groovy committer >> Blog: http://blog.sunlan.me >> Twitter: @daniel_sun >>=20 >> -- >> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html --Apple-Mail=_EEDAA4FA-40BF-4091-933A-5409BAC12868 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
The GProperties language = is the same language or a subset of the
Properties = language

which = doesn=E2=80=99t mean that same extension should be used, see example = with .java/.groovy.


 Even with standard Properties, users are free to add = keys for
interpolation to their values, or add SQL = statements as values, none
of that requires a change of = file Extension

which = still doesn=E2=80=99t mean that same extension should be used.


Special IDE support is = not required, whatever support an IDE offers
for standard = Property files also works fine for GProperties

I guarantee users will want essential = features:
- navigate from interpolation to the = property;
- find usages of a property;
- rename a property and expect its usages in = other properties to be updated.


None of = Commons-Configuration,
Archaius(https://github.com/Netflix/archaius) or even = ResourceBundle
(https://www.mscharhag.com/java/resource-bundle-single-quote-esc= aping)
use a different file extension

commons-configuration is not supported = because: 
- there is not much demand = because it is a third-party library;
- there = is still no way to know if some property file is commons-configuration = property file;
- there is other non-declarative = stuff which is basically unsupportable at all.
Archaius is basically commons-configuration.
RB is a different mechanism, it is about external parameters = for properties, it=E2=80=99s not about using some property in the = interpolation.


Properties also support loadFromXml(), and I guess nobody = wants to
suggest using .gxml as different = extension?

That is a = good point. 
Observation: xml properties file = is expected to use specified doctype which makes is distinguishable from = other xml files.
If GProperties is a subclass of = Properties then is either should provide a way to distinguish = gproperties from regular xml properties or throw exception in = loadFromXml/storeToXML.


=E2=80=94

Daniil Ovchinnikov
JetBrains

On 7 Nov 2018, at 03:13, Thibault Kruse <tibokruse@googlemail.com> wrote:

I propose to use = "gproperties" as file extension.

'.properties' is the correct file extension for GProperties. = There are
several reasons:

* = The GProperties language is the same language or a subset of the
Properties language
* Even with standard = Properties, users are free to add keys for
interpolation = to their values, or add SQL statements as values, none
of = that requires a change of file Extension
* Special IDE = support is not required, whatever support an IDE offers
for = standard Property files also works fine for GProperties
* = None of Commons-Configuration,
Archaius(https://github.com/Netflix/archaius) or even = ResourceBundle
(https://www.mscharhag.com/java/resource-bundle-single-quote-esc= aping)
use a different file extension
* = Properties also support loadFromXml(), and I guess nobody wants to
suggest using .gxml as different extension?


Some other concerns:

P.S. Unbalanced curlies = will not be considered, because curlies are valid characters for the = value of property.

I don't = understand what any of that means, but you can add a testcase
for locally unbalanced properties like this:

   foo =3D Hello {{{name1} and {name2}}}

to your testcases.

Also, I believe the key of properties files can also contain = special
characters, so these are also valid keys:

   { =3D leftcurly
   } =3D rightcurly
=    {{ =3D mustache
   {} =3D = ufo

So in GProperties it should be possible = to reference them, like

=    uforef =3D {{{}}}

Yeah, = not really. To properly reference those you'd need a way to
better mark the start of an interpolation key (such as ${}), = and a way
to escape the interpolation end symbol inside an = interpolation key. At
this time I believe you can pretty = much forget about regular
expressions, and start writing a = traditional Character-by-Character
parser for = GProperties.


Another = unrelated topic is whether and how to combine importing and
interpolation. As an example:

=    import.properties =3D = application-{profile}.properties

I think = the latest version of GProperties would not interpolate that,
not sure if intentionally or by mistake (since resolving the = key
against imports would be tough during importing). This = is related to
the next concern.

Similarly, a question is whether interpolation may use values = from
imported files. As an example:

   import.properties =3D = ~/.access_secrets.properties
=    window.title =3D {db.username} logs in with = {db.password}

I believe the implication for = security should be obvious.


Finally, for backwards compatibility:
Commons-configuration also has the typesafe accessors = (getLong(),
getString(), getInt()...) which do variable = interpolation. But
getProperty() actually returns the raw, = non-interpolated String from
the properties. That might be = a good idea for GProperties, too (for
backwards = compatibility but also for other purposes, such as
debugging).




On Tue, Nov 6, 2018 at 8:40 PM Daniel.Sun = <sunlan@apache.org> wrote:

Understood.

I propose to use "gproperties" as file extension.

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<= br class=3D"">

= --Apple-Mail=_EEDAA4FA-40BF-4091-933A-5409BAC12868--