[sent to both email list given it's not clear if it's an implementation issue
or a spec issue]
There is a nice video of how the serialization of records works recently on
inside.java
https://inside.java/2021/02/23/records-met-serialization/
In the video, Julia explains that the de-serialization
Hi all,
in the news, Python have been accepted the PEP 642, Pattern Matching in Python
[1].
The accepted PEP is https://www.python.org/dev/peps/pep-0642/
And the rational is https://www.python.org/dev/peps/pep-0635/
Compared to us,
- bindings are visually like variables not a special keyword (a
Hi Brian,
Thinking a little bit more on this,
i've discovered that the inference you are proposing for a type pattern doesn't
work exactly like the inference works in the rest of the language.
With just a simple example,
Object o = ...
if (o instanceof List<> list) { ... }
Given that there
Just to be sure, when we have a switch like
Object object = ...
switch(object) {
case Box(Circle circle): ...
case Box(Square square): ...
}
We have agreed that case Box(Foo ..) is equivalent to an instanceof + a call to
the deconstructor,
but i don't think we have agree what the e
- Mail original -
> De: "Tagir Valeev"
> À: "amber-spec-experts"
> Envoyé: Mardi 26 Janvier 2021 10:36:18
> Objet: [sealed] Use 'open' instead of 'non-sealed'?
> Hello!
>
> The 'non-sealed' keyword looks not very java-ish. It adds cognitive
> load, especially to non-native speakers, as
As usual, when introducing a new feature, the complexity arise with the
interactions with the other already existing features.
We have instance patterns, we have functional interface,
does those things can be mixed ?
Is an interface with one abstract pattern a functional interface ?
interface M
> De: "Brian Goetz"
> Cc: "amber-spec-experts"
> Envoyé: Vendredi 22 Janvier 2021 18:27:25
> Objet: Re: Relaxed assignment conversions for sealed types
> I want to pick up on this thread, now that we may have some more fire to add
> to
> it, and we've all had some time to think about it.
[...]
The last document sent by Brian split patterns in two categories, deconstructor
and method patterns.
I would like to propose another way to see patterns, along the axis of partial
vs total pattern.
A total pattern is a pattern that always succeed and bind the bindings.
A partial pattern is a pat
> De: "Brian Goetz"
> À: "John Rose"
> Cc: "amber-spec-experts"
> Envoyé: Samedi 23 Janvier 2021 18:06:30
> Objet: Re: Relaxed assignment conversions for sealed types
[...]
> Yes, but. Here’s the case we’re worried about.
> sealed interface A permits B { }
> class B implements A { }
> A a =
- Mail original -
> De: "Brian Goetz"
> À: "Guy Steele"
> Cc: "amber-spec-experts"
> Envoyé: Dimanche 24 Janvier 2021 19:16:06
> Objet: Re: Patterns: declaration
>>
>> Hi, Brian,
>>
>> This exploration of the different ways of declaring patterns is very
>> useful, as
>> if the observati
[...]
>> Also, what about several type patterns, like `case null, Integer _,
>> String _ -> ... // nulls, integers, and strings but no other types go
>> here`? What about `case Integer _, null, String _ ->...`?
>
> Right now, you can't say that, so it's not a problem :)
>
> I think what this spe
I like the special bonus semantics,
a switch need to specify the null behavior explicitly while it's pragmatic to
lees sub-pattern to be total on null.
Because people will ask, if a record has a null record component, the "Right
Way"(TM) to not propagate null is to create different patterns lik
- Mail original -
> De: "Brian Goetz"
> À: "amber-spec-experts"
> Envoyé: Mardi 19 Janvier 2021 20:59:00
> Objet: Pattern features for next iteration
> We're zeroing in on a feature list for the next iteration of pattern
> matching, which includes:
>
> - New kinds of patterns
> - Ar
I think we should take a look to the difference between (sub-)patterns and
arguments of a pattern.
If i want to test if o is a String with an integer value greater than 10, i can
write something like
switch(o) {
case String s && Integer.parseInt(s, >10) -> ...
}
but this pseudo syntax i
tic pattern.
I'm thinking about a way that make the type explicitly.
Same example with a tentative syntax (there may be a better one)
switch(o) {
case String.matcher("(a*)(b*)", var matcher) -> ...
case String text && Integer.parseInt(text, var value) -> ...
}
cheer
In the last document sent by Brian, there is a notion of static Pattern.
Here is an example of static patterns
switch(o) {
case String.matcher("(a*)(b*)", matcher -> ...
case Integer.parseInt(var value) -> ...
}
The first pattern, check if o is an instance of a String that match the r
Hi everybody,
following the discussion about && / and between guards and patterns,
i don't think i've a clear understanding on what is a pattern and what is a
guard.
When we first discuss of guards, the separation was a kind of clean, a pattern
match something and a guard provides further refine
For me, the introduction of pattern matching in Java comes from the fact that
there is currently no proper way to do data encapsulation.
We have a strawman equivalent of pattern matching, use a cascade of ''if ...
else" with getters/accessors.
Switching on patterns is a better way to write a
Let's restart,
what i don't like in the current form of this document is that the is no clean
separation between two things,
the pattern and the member method some patterns (not all of them) are required
to be implemented to support the pattern.
By example, case Optional.of() is called the st
> De: "Brian Goetz"
> À: "amber-spec-experts"
> Envoyé: Mercredi 6 Janvier 2021 21:52:19
> Objet: New pattern matching doc
> I have pushed
> [
> https://github.com/openjdk/amber-docs/blob/master/site/design-notes/pattern-match-object-model.md
> |
> https://github.com/openjdk/amber-docs/blob/mas
On January 4, 2021 3:28:48 PM UTC, Brian Goetz wrote:
>In going through the JDK for places where we might use type patterns, I
>
>came across this example, from the copy construct of `EnumMap`:
>
>```
>public EnumMap(Map m) {
> if (m instanceof EnumMap) {
> EnumMap em = (EnumMap) m;
Should we allow the diamond syntax in a cast ?
If the answer is yes, then it should be allowed in type patterns.
regards,
Remi
On January 4, 2021 3:28:48 PM UTC, Brian Goetz wrote:
>In going through the JDK for places where we might use type patterns, I
>
>came across this example, from the co
- Mail original -
> De: "mark"
> À: "amber-spec-experts"
> Envoyé: Dimanche 27 Décembre 2020 22:04:43
> Objet: Unexpected compilation error with generic sealed interface
> Hello!
>
> A friend of mine handed me this example that fails to compile using
> JDK 17 EA 3:
>
> ~~
> final class
forwarded to amber-spec-experts
Rémi
- Mail transféré -
De: "mandy chung"
À: "amber-dev"
Envoyé: Mercredi 9 Décembre 2020 05:00:03
Objet: Should final fields in records be trusted or not trusted in 16?
I need your help, amber experts, in understanding the conclusion on the
amber-spec-
> De: "Maurizio Cimadamore"
> À: "Brian Goetz" , "Tagir Valeev"
> Cc: "amber-spec-experts"
> Envoyé: Mardi 24 Novembre 2020 15:10:35
> Objet: Re: Relaxed assignment conversions for sealed types
> On 31/10/2020 23:30, Brian Goetz wrote:
>>> On Oct 25, 2020, at 10:06 AM, Brian Goetz < [ mailto:b
We have avoided in the past to mix the class restriction and the type system.
By example, even if a class A is declared final, List is not
equivalent to List.
For me, you want to steer the type system to work more like a close world type
system,
so it's not very consistent with the existing s
- Mail original -
> De: "John Rose"
> À: "Maurizio Cimadamore"
> Cc: "amber-spec-experts"
> Envoyé: Mercredi 18 Novembre 2020 09:07:18
> Objet: Re: [statics] allowing static initializers in interfaces?
> +1 from me too, and generally to heal the rift.
> The inability to put private clas
- Mail original -
> De: "Maurizio Cimadamore"
> À: "amber-spec-experts"
> Envoyé: Mardi 17 Novembre 2020 15:03:39
> Objet: [statics] allowing static initializers in interfaces?
> Hi,
> now that the work on allowing static members in nested declarations [1]
> is wrapping up, I'm wondering
Wrong mailing list.
> De: "Nikita Eshkeev"
> À: "compiler-dev"
> Envoyé: Samedi 14 Novembre 2020 22:58:53
> Objet: Adding Do notaion/For comprehension
> Hi,
> What do you think about adding a language feature that is similar to
> do-notation
> in Haskell or for-comprehension in Scala to make
- Mail original -
> De: "Alex Buckley"
> À: "amber-spec-experts"
> Envoyé: Mardi 10 Novembre 2020 22:37:04
> Objet: Re: The Record Attribute - What does it mean to be a record at runtime?
> On 11/10/2020 1:09 PM, fo...@univ-mlv.fr wrote:
>>
- Mail original -
> De: "Chris Hegarty"
> À: "amber-spec-experts"
> Envoyé: Jeudi 5 Novembre 2020 11:31:43
> Objet: The Record Attribute - What does it mean to be a record at runtime?
> This email has no concrete proposal describe within, but rather is
> intended to start a discussion re
> De: "Chris Hegarty"
> À: "amber-spec-experts"
> Envoyé: Jeudi 5 Novembre 2020 12:18:27
> Objet: Re: getPermittedSubclasses() on j.l.rClass returning an array of
> ClassDesc
>> On 29 Oct 2020, at 21:38, Dan Smith < [ mailto:daniel.sm...@oracle.com |
>> daniel.sm...@oracle.com ] > wrote:
>>> ..
- Mail original -
> De: "Brian Goetz"
> À: "Tagir Valeev"
> Cc: "amber-spec-experts"
> Envoyé: Dimanche 25 Octobre 2020 15:06:42
> Objet: Re: Relaxed assignment conversions for sealed types
[...]
>
> On to Remi's comments:
>
>> If we have a rule that allows semless conversions betwee
I've not answered to Brian series of emails because i'm not able to figure out
if it's a good thing or not.
One thing to know that Brian did not say is that we may need to see a sealed
super type as a subtype for Valhalla.
Currently generics doesn't support primitive object type (ex inline type
It means that safevarargs becomes a flag that needs to be verified by the VM
because of separate compilation.
The current rules for @SafeVarargs avoid that by disallowing @SafeVarargs on
instance method (the ones that can be overriden),
so the effect of @SafeVarargs is only local.
I'm not sure t
Oops, instead of
var copy = new int[items.length];
it should be
var copy = new int[items.length][];
I've fixed the codes below.
- Mail original -
> De: "Remi Forax"
> À: "amber-spec-experts"
> Envoyé: Samedi 24 Octobre 2020 22:45:15
> Obje
When we have decided to ban
this.items = items
in the compact constructor and ask our users to use an assignment instead,
it has a stupid side effect to make the parameters inside the compact
constructor not effectively final, so a lambda can not capture them.
So a code like this doesn't compil
- Mail original -
> De: "Gavin Bierman"
> À: "amber-spec-experts"
> Envoyé: Vendredi 23 Octobre 2020 17:16:20
> Objet: [sealed-classes] Spec for next version of Sealed Classes
> Dear all:
>
Hi Gavin,
> Drafts of the specs for the Sealed Classes feature that we plan to preview for
> a
- Mail original -
> De: "Tagir Valeev"
> À: "Gavin Bierman"
> Cc: "amber-spec-experts"
> Envoyé: Mardi 20 Octobre 2020 05:08:53
> Objet: Re: [records] Spec for next version of Record Classes JEP
> Hello!
>
> I still feel that there should be a compilation error if record
> component an
> De: "Brian Goetz"
> À: "Gavin Bierman" , "amber-spec-experts"
>
> Envoyé: Mardi 13 Octobre 2020 19:18:48
> Objet: Re: [patterns-instanceof] Spec for next version of Patterns in
> instanceof
> JEP
> This seems to cleverly sidestep the issue of pattern totality (by outlawing
> the
> total type
Following the course on exceptions, where i explain that a catch() is an
instanceof,
two different students ask me why catch() can use '|' in between the exception
types but instanceof can not.
i.e why this code works
try {
...
} catch(RuntimeException | Error e) {
throw e;
} catch
Hi David,
> De: "Brian Goetz"
> À: "amber-spec-experts"
> Envoyé: Jeudi 1 Octobre 2020 22:33:28
> Objet: Fwd: Records feedback
> Received on the -comments list.
A Record does not support encapsulation (separating the public API and the
private implementation) given that it's a named tuple.
> De: "Maurizio Cimadamore"
> À: "Brian Goetz" , "Tagir Valeev" ,
> "amber-spec-experts"
> Envoyé: Vendredi 18 Septembre 2020 17:23:35
> Objet: Re: [records] Is C-style array declaration in components dropped?
> +1 on this - as Brian says - part of a long-term battle against old syntax -
> note
Section Do we need constant patterns,
if we don't have constant pattern, it may also means that the type of a bound
variables can be implicit too.
i.e. case Point(x, y) having the same meaning as case Point(var x, var y) like
with lambdas.
Because
int c = ...
switch(getFoo()) {
case Foo(c)
At the end of the section "refining-totality" [1],
The sentence "Guarded patterns should be ignored entirely for purposes of
computing totality." implies that if two patterns that only differ from one
having a where and the other have not it's not valif to have them both in a
switch seems wrong
- Mail original -
> De: "Gavin Bierman"
> À: "amber-spec-experts"
> Envoyé: Lundi 27 Juillet 2020 12:53:52
> Objet: Finalizing in JDK 16 - Pattern matching for instanceof
> In JDK 16 we are planning to finalize two JEPs:
>
> - Pattern matching for `instanceof`
> - Records
>
> Whilst
Just a question,
do we agree that the syntax below is valid ?
Point point = ...
switch(point) {
case var(var x, var y): ...
}
i.e. that var can be written everywhere there is a type in a Pattern.
Rémi
I just want to say that the is yet another option,
say that (statement and expression) arrow switches are always total.
We have introduced the arrow notation to avoid fallthrough but we have
forgotten one important case of fallthrough, in a statement switch when you
skip the entire switch, you
> De: "Brian Goetz"
> À: "amber-spec-experts"
> Envoyé: Lundi 31 Août 2020 15:25:13
> Objet: Re: [pattern-switch] Opting into totality
> I think this is the main open question at this point.
> We now have a deeper understanding of what this means, and the shape of the
> remainder. Totality mean
- Mail original -
> De: "Remi Forax"
> À: "Brian Goetz"
> Cc: "daniel smith" , "Guy Steele"
> , "Tagir Valeev" ,
> "amber-spec-experts"
> Envoyé: Mardi 1 Septembre 2020 03:11:10
> Objet: Re: [patte
> De: "Brian Goetz"
> À: "amber-spec-experts"
> Envoyé: Lundi 31 Août 2020 15:35:32
> Objet: Re: [pattern-switch] Opting into totality
> Totality is a term that language designers like, but may not be all that
> evocative to users. So switch-total might not exactly turn on the light bulb
> for t
> De: "Brian Goetz"
> À: "amber-spec-experts"
> Envoyé: Lundi 31 Août 2020 15:35:32
> Objet: Re: [pattern-switch] Opting into totality
> Totality is a term that language designers like, but may not be all that
> evocative to users. So switch-total might not exactly turn on the light bulb
> for t
Hi,
i've hinted that there is an issue with intersection type and totality, but we
did not follow up.
Here is the issue
var value = flag? "foo": 42;
switch(value) {
case String s -> ...
case Integer i -> ...
case Serializable s ->
case Comparable c ->
}
given that the type of value is
> De: "Brian Goetz"
> À: "Gavin Bierman" , "amber-spec-experts"
>
> Envoyé: Mercredi 26 Août 2020 17:00:47
> Objet: Re: Finalizing in JDK 16 - Pattern matching for instanceof
> I have been thinking about this and I have two refinements I would like to
> suggest for Pattern Matching in instanceof
untime/blob/master/src/main/java/com/github/forax/pmr/PatternBuilder.java
[4]
https://github.com/forax/pattern-matching-runtime/blob/master/src/main/java/com/github/forax/pmr/PatternTest.java
- Mail original -
> De: "Remi Forax"
> À: "Guy Steele"
> Cc: &qu
> De: "Remi Forax"
> À: "Brian Goetz"
> Cc: "Guy Steele" , "amber-spec-experts"
>
> Envoyé: Vendredi 28 Août 2020 23:59:55
> Objet: Re: [pattern-switch] Totality
>> De: "Brian Goetz"
>> À: "Remi Forax"
> De: "Brian Goetz"
> À: "Guy Steele"
> Cc: "amber-spec-experts" ,
> "amber-spec-experts"
> Envoyé: Mercredi 26 Août 2020 19:01:16
> Objet: Re: [pattern-switch] Totality
> I think we now have a sound story for totality in both patterns and switches.
> Let's start with refining what we mean by t
> De: "Brian Goetz"
> À: "amber-spec-experts"
> Envoyé: Lundi 24 Août 2020 18:23:47
> Objet: Optimistic totality
> As I mentioned yesterday, I think our ideas about totality and null handling
> were getting polluted by our desire to support intuitive, optimistic totality.
> So let's try to separ
Ok, let restart this conversation, actually there are two issues.
1/ there is no syntax for saying that a type is total or not,
if we take a close look to the different mails, at some points several of us
uses different syntax to show that part of a pattern is total,
Guy has used '_', i've
There is a feature of Pizza (remember Generic Java ++) we have not discussed
yet,
being able to do a switch on Class.
public sealed interface Numeric>
permits Amount, Percentage, Quantity {
private BigDecimal value() {
return switch(this) {
case Amount(value) -> value;
case P
> De: "Brian Goetz"
> À: "Tagir Valeev"
> Cc: "amber-spec-experts"
> Envoyé: Jeudi 20 Août 2020 21:09:00
> Objet: Re: [pattern-switch] Exhaustiveness
> Here's an attempt at a formalism for capturing this.
> There are several categories of patterns we might call total on a type T. We
> could re
> De: "Brian Goetz"
> À: "amber-spec-experts"
> Envoyé: Jeudi 20 Août 2020 17:56:20
> Objet: Re: [pattern-switch] Exhaustiveness
> Tagir's question about exhaustiveness in switches points to some technical
> debt
> left over from expression switches.
> (Note: this entire discussion has nothing
/2020 7:15 PM, Vicente Romero wrote:
>> Hi Remi,
>> On 8/17/20 10:07 AM, Remi Forax wrote:
>>> I've found a discrepancies in the current spec of sealed,
>>> the current spec allows local sealed interface but you have no way to
>>> provide a
>>&g
I've found a discrepancies in the current spec of sealed,
the current spec allows local sealed interface but you have no way to provide a
sub-types apart a sealed sub interfaces.
A record or an interface is allowed to be declared inside a method,
by example, this is a valid code
static void foo
- Mail original -
> De: "Tagir Valeev"
> À: "Brian Goetz"
> Cc: "amber-spec-experts"
> Envoyé: Vendredi 14 Août 2020 05:00:35
> Objet: Re: Next up for patterns: type patterns in switch
> Hello!
>
> I haven't read all the discussions in this thread, so sorry if my
> points were already
> De: "Brian Goetz"
> À: "amber-spec-experts"
> Envoyé: Mercredi 12 Août 2020 22:44:04
> Objet: A peek at the roadmap for pattern matching and more
> Several folks have asked that I sketch out a little more of the roadmap for
> pattern matching, so that we can better evaluate the features being
> De: "Brian Goetz"
> À: "amber-spec-experts"
> Envoyé: Mercredi 12 Août 2020 22:44:04
> Objet: A peek at the roadmap for pattern matching and more
> Several folks have asked that I sketch out a little more of the roadmap for
> pattern matching, so that we can better evaluate the features being
- Mail original -
> De: "John Rose"
> À: "Brian Goetz"
> Cc: "amber-spec-experts"
> Envoyé: Mardi 11 Août 2020 00:20:42
> Objet: Re: Next up for patterns: type patterns in switch
> Letting the nulls flow is a good move in that absorbing
> game of “find the primitive”. Here, you are obs
> De: "Brian Goetz"
> À: "John Rose"
> Cc: "amber-spec-experts"
> Envoyé: Lundi 10 Août 2020 23:02:21
> Objet: Re: Next up for patterns: type patterns in switch
> Some further color on this, to characterize why all the angst over matching
> Box(null) seems mostly like a collective "bleah, diffe
> De: "Brian Goetz"
> À: "Gavin Bierman" , "amber-spec-experts"
>
> Envoyé: Lundi 3 Août 2020 19:20:09
> Objet: Re: Finalizing in JDK 16 - Records
> One of the less-well-known "featurelets" that is buried in records has to do
> with nesting. We want records to nest cleanly in methods (local reco
> De: "Guy Steele"
> À: "Brian Goetz"
> Cc: "amber-spec-experts"
> Envoyé: Lundi 27 Juillet 2020 22:38:38
> Objet: Re: Observation about nulls in type patterns
>> On Jul 27, 2020, at 4:25 PM, Brian Goetz < [ mailto:brian.go...@oracle.com |
>> brian.go...@oracle.com ] > wrote:
>> ...
>> If get
On July 23, 2020 9:05:08 PM UTC, John Rose wrote:
>On Jul 23, 2020, at 11:38 AM, Remi Forax wrote:
>>
>> In next releases? Add constant Pattern and static Pattern. Ban
>instance pattern because you don't want to match something that depends
>on a mutable states
On July 23, 2020 6:52:50 PM UTC, Brian Goetz wrote:
>
>
>On 7/23/2020 2:38 PM, Remi Forax wrote:
>> Don't do deconstruction now ! We are not ready :)
>
>Now I'm confused. Didn't I say exactly that in the first paragraph?
Yes, we agree.
>
&
Right now: add only the type Pattern and the null Pattern so people can test
and report if we go in the right direction or not.
Don't do deconstruction now ! We are not ready :)
In next releases? Add constant Pattern and static Pattern. Ban instance pattern
because you don't want to match somet
I was reading the different tests in the pattern branch and an old idea pop up
again in my head,
given i was not able to find a mail from me explaining it, here it is.
Currently Java only allow switch on constants, so we write
String value = ...
... switch(value) {
case "foo" -> ...
}
e called
the accessors in the wrong order.
>
> With best regards,
> Tagir Valeev.
Rémi
>
> On Sat, May 23, 2020 at 10:06 PM Sergei Egorov wrote:
>>
>> Hi Remi,
>>
>> Thanks for raising this important topic!
>>
>> I wonder if Records can provide
I've spent a little time to see how we can provide a with()/copy() method,
that creates a new instance from an existing record changing the value of
several components in the process.
It's a feature that was requested several times while i was presenting how
record works and Scala, Kotlin and C#
It's always interesting to see what the others do
https://devblogs.microsoft.com/dotnet/welcome-to-c-9-0/
For records, it's quite nice, you have a new literal syntax for creating a
record which we know is very effective thanks to Kotlin and a with expression
syntax to derive a record instance
> De: "John Rose"
> À: "daniel smith"
> Cc: "amber-spec-experts" , "joe darcy"
>
> Envoyé: Samedi 9 Mai 2020 22:15:07
> Objet: Re: getPermittedSubclasses() on j.l.rClass returning an array of
> ClassDesc
> On May 9, 2020, at 12:59 PM, Dan Smith < [ mailto:daniel.sm...@oracle.com |
> daniel.sm..
The current draft of the reflection API for the sealed keyword adds a method
getPermittedSubclasses() [1] to java.lang.Class.
I'm not fully sure that returning an array of ClassDesc is the right choice
here, mainly for two reasons,
1/ it's weird to return an array of ClassDesc when all others s
Plus ça change plus c'est la même chose.
Ok, I will be that angry old man.
There is a good reason why it is done that way, i.e. enum is called enum and
not enum class or annotation type is not called annotation interface.
It's to avoid the confusion between the feature of the language and its
t
> De: "Remi Forax"
> À: "Brian Goetz"
> Cc: "amber-spec-experts"
> Envoyé: Mercredi 6 Mai 2020 17:08:33
> Objet: Re: Swiss Cheese Issue - Revisit?
>> De: "Brian Goetz"
>> À: "Remi Forax"
>> Cc: "Mano
I would like to add that the Swiss Cheese problem is specific to instanceof,
it's not a pattern matching issue per se.
So there is another far easier solution to the Swiss Cheese problem, don't
support it because instanceof will be less prominent in the future and
instanceof in equals() can be
- Mail original -
> De: "Brian Goetz"
> À: "daniel smith" , "amber-spec-experts"
>
> Envoyé: Vendredi 1 Mai 2020 23:17:00
> Objet: Re: Local classes & sealed classes
> Erring on the side of quick answers because time is getting tight.
>
>> 1) A local class can extend a sealed class tha
- Mail original -
> De: "Brian Goetz"
> À: "daniel smith" , "John Rose"
>
> Cc: "amber-spec-experts"
> Envoyé: Mardi 28 Avril 2020 00:37:05
> Objet: Re: Possible records tweak
>>> So maybe `super` is DA but `this` is DU, just like in the code
>>> before the super-constructor call.
And it's like with enums in 2004, i remember a guy predicting that nobody will
use them because values() or valueOf() is always generated, you can not
inherits from an enum, etc
Once a feature existed, we collectively start to twist our codes to use records
instead of plain old classes.
By exam
I'm glad you just send that message on amber-dev,
playing with the parsing of JSON [1], I stumble upon one of our decisions that
i now regret,
switch expression doesn't allow return and continue while a switch statement do.
>From now, it look like a gratuitous "Tuesday rule".
As a user if you w
> De: "Brian Goetz"
> À: "Guy Steele"
> Cc: "amber-spec-experts"
> Envoyé: Vendredi 24 Avril 2020 21:08:02
> Objet: Re: Possible records tweak
>> Not a bad idea, but here are two and a half alternatives we could consider:
>> (1) Simply ban use of “this” within a compact constructor. This might
> De: "Brian Goetz"
> À: "amber-spec-experts"
> Envoyé: Jeudi 23 Avril 2020 22:11:17
> Objet: Clarifications on SoV documents
> Srikanth asked me to make a few clarifications on the SoV documents. I'll
> summarize them here and then later work them into the docs.
> 1. Array subtyping. Historica
- Mail original -
> De: "daniel smith"
> À: "amber-spec-experts"
> Envoyé: Jeudi 23 Avril 2020 20:27:30
> Objet: [sealed] Module & package constraints
> I'm scrutinizing this rule from the sealed types language spec (8.1.6):
>
> "It is a compile-time error if any class named in a per
- Mail original -
> De: "daniel smith"
> À: "amber-spec-experts"
> Envoyé: Mercredi 22 Avril 2020 21:38:31
> Objet: [sealed] Runtime checking of PermittedSubtypes
> Iterating on the JVMS changes for sealed types, I've been refining the details
> of the runtime check.
>
> Two assertions,
About the JEP text,
It's not clear to me if "compilers" in the sentence "The lack of documented
exhaustiveness also prevents compilers from being able to do exhaustiveness
analysis."
refers to java compiler or JIT compilers. Obviously the answer is both :)
The example of "rotate" is a weird exa
There was discussions about the danger of only providing instanceof + the
deconstruction pattern and not a way to have the same kind of destructuring
when declaring local variables
By example, instead of
Point p = ...
int x = p.x();
int y = p.y();
one can write
Point p = ...
if (!(p
- Mail original -
> De: "Gavin Bierman"
> À: "amber-spec-experts"
> Envoyé: Lundi 6 Avril 2020 12:10:55
> Objet: Final issues regarding records
> Dear Experts:
>
> I’d like to circle back on a couple of issues regarding records. I am
> finalizing
> the draft language spec - would reall
Hi all,
With my ASM hat,
from the JVMS POV, javac can not generate an empty list of permitted subtypes
and the implementation in Hotspot ignores the attribute PermittedSubtypes if
there is no subtype listed.
So currently, ASM doesn't allow you to create an attribute PermittedSubtypes
with an em
Hi all,
a record component can use as type a type declared inside the record itself,
in term of scoping it's like if the record component is part of the internal
scope of the record.
record Foo(Bar bar) {
class Bar {
}
}
I think it's the right behaviour but i was not able to find any refere
Hi Tagir,
There already a syntax for that in Java,
we are using it for lambda and switch, the arrow block syntax.
static final String FIELD = -> {
try {
yield initializeField();
}
catch(CheckedException e) {
throw new RuntimeException(e);
}
};
Rémi
> De: "Tagir Valeev"
> À: "amber-s
Hi Daniel,
Pooling of Java objects in memory usually do more harm than good, because you
artificially change the liveness of the pooled objects which doesn't work well
with modern GC algorithms.
Obviously, if objects are stored in a database, it can still be a win but
usually the pool is more
Hi all,
I've taken a look where in my source code I can use instanceof Point(var x, var
y) instead of instanceof Point p.
I've discovered that i've a lot of occurrences where i only need some record
components but not all of them,
by example, i've an AST that defines the declaration of a variable
- Mail original -
> De: "Gavin Bierman"
> À: "amber-spec-experts"
> Envoyé: Mardi 18 Février 2020 16:19:48
> Objet: [records] Summary so far
> Dear Experts:
>
> In [1] Brian asked for comments on some remaining design decisions concerning
> records (and asked for any new ones that you'd
101 - 200 of 410 matches
Mail list logo