Re: Escape Sequences For Managing Whitespace (Preview)

2019-08-19 Thread Brian Goetz
In an earlier round there was a pair of methods, which were variously called escape/unescape, encode/decodeEscapes, etc. No one could remember which was in which direction … there is currently not such a method. > On Aug 19, 2019, at 8:18 PM, Joe Darcy wrote: > > Hello, > > Are there plans f

Re: Escape Sequences For Managing Whitespace (Preview)

2019-08-19 Thread Joe Darcy
Hello, Are there plans for methods to take a string and produce value-preserving escape sequence encodings of it, quoting trailing whitespace, etc.? Cheers, -Joe On 8/13/2019 5:46 AM, Jim Laskey wrote: https://bugs.openjdk.java.net/browse/JDK-8227870

Re: Refinements for sealed types

2019-08-19 Thread Brian Goetz
I was suggesting that a class:     sealed class X { } with no permitted subtypes would be _both_ ACC_FINAL *and* have an empty sealing attribute.  The rationale would be:  - Reflects intuition that sealed-with-no-permitted-subtypes really means final, but  - Allows reflection to distinguish

Re: Refinements for sealed types

2019-08-19 Thread Alex Buckley
On 8/19/2019 3:22 PM, Brian Goetz wrote: I don't have a strong opinion on whether "sealed but no permitted subtypes" is a habitable space separate from "final", but I'm fine to say "that means final" for most purposes. Not sure what reflection should say; is it OK for a type that is clearly sea

Re: Refinements for sealed types

2019-08-19 Thread Remi Forax
- Mail original - > De: "Brian Goetz" > À: "Alex Buckley" , "amber-spec-experts" > > Envoyé: Mardi 20 Août 2019 00:22:35 > Objet: Re: Refinements for sealed types >> To be clear, infer `final` on A. We were already inferring `sealed` >> last week; the new thing this week is to infer

Re: Refinements for sealed types

2019-08-19 Thread forax
> De: "Brian Goetz" > À: "Remi Forax" > Cc: "amber-spec-experts" > Envoyé: Lundi 19 Août 2019 15:07:35 > Objet: Re: Refinements for sealed types >>> There are several ways to reduce the ceremony >>> - implicit declaration of sealed subtypes if the super type is sealed >>> - implicit declaration

Re: Refinements for sealed types

2019-08-19 Thread forax
> De: "Brian Goetz" > À: "Remi Forax" > Cc: "amber-spec-experts" > Envoyé: Dimanche 18 Août 2019 21:25:28 > Objet: Re: Refinements for sealed types >> So if everything is explicit, we want >> - all sealed types to defines their permit clauses >> (so we need a kind of "permit none" if no subtype

Re: Refinements for sealed types

2019-08-19 Thread Brian Goetz
To be clear, infer `final` on A. We were already inferring `sealed` last week; the new thing this week is to infer A's `permits` list as empty (giving A an overall score of implicitly `final`) rather than "any co-declared subtypes of A". Given the code above, it is a compile-time error for a

Re: Refinements for sealed types

2019-08-19 Thread Alex Buckley
On 8/19/2019 11:52 AM, Brian Goetz wrote: How do you know from `sealed class X {}` and the rest of its compilation unit that all X's subtypes are co-declared? By co-declared, I mean "in the same compilation unit." The emphasis should be on the word "all", not "co-declared". How do you know

Re: Refinements for sealed types

2019-08-19 Thread Brian Goetz
How do you know from `sealed class X {}` and the rest of its compilation unit that all X's subtypes are co-declared? By co-declared, I mean "in the same compilation unit." The emphasis should be on the word "all", not "co-declared". How do you know that ALL of X's subtypes are declared i

Re: Refinements for sealed types

2019-08-19 Thread Alex Buckley
On 8/19/2019 11:27 AM, Brian Goetz wrote: So, given all this, we should focus all our ceremony-reduction on the case of co-declared sum types.  Which is mostly what I think I was suggesting:   - Infer the permits clause when all the subtypes are co-declared;   - Infer “final” for leaf classes

Re: Refinements for sealed types

2019-08-19 Thread Brian Goetz
So, given all this, we should focus all our ceremony-reduction on the case of co-declared sum types.  Which is mostly what I think I was suggesting:   - Infer the permits clause when all the subtypes are co-declared;   - Infer “final” for leaf classes in a sum type;   - Require explicitness

Re: Refinements for sealed types

2019-08-19 Thread Alex Buckley
On 8/18/2019 12:25 PM, Brian Goetz wrote: So, given all this, we should focus all our ceremony-reduction on the case of co-declared sum types.  Which is mostly what I think I was suggesting:  - Infer the permits clause when all the subtypes are co-declared;  - Infer “final” for leaf classes

Re: Refinements for sealed types

2019-08-19 Thread Brian Goetz
>> There are several ways to reduce the ceremony >> - implicit declaration of sealed subtypes if the super type is sealed >> - implicit declaration of permit clauses >> and we may want to choose one, the other or both. For the record, there is also a third possible way: inferring `extends X`. I d