Finding the right keyword for new features (was "Re: Could we change the syntax for when clauses?")

Remi Forax forax at univ-mlv.fr
Wed Dec 7 19:22:22 UTC 2022


> From: "Brian Goetz" <brian.goetz at oracle.com>
> To: "David Alayachew" <davidalayachew at gmail.com>
> Cc: "amber-dev" <amber-dev at openjdk.org>
> Sent: Wednesday, December 7, 2022 8:04:31 PM
> Subject: Re: Finding the right keyword for new features (was "Re: Could we
> change the syntax for when clauses?")

> Imagine we did this, and we added a dozen or so new #keywords to the language
> over the next ten years. Now imagine you're a new developer learning Java. In
> addition to all the struggling with learning to program and learning the
> language, you're now also guaranteed to be distracted with "how do I remember
> whether it's "if" or "#if, and why can't the stupid compiler just figure it out
> for me?". And the explanation "Oh, that was added after the Great
> Sharpification" will not be compelling.

> As a concrete example, this was tried in Java 5 with "@interface". To this day,
> people complain about this, and with good reason: it is a gratuitous departure
> from the rest of the language.

> We should strive to make the features we add look like they were there all
> along.
#yes, #It's #an #effect #that #we #can #already #see #with #the #APIs, #every #year, #i've #students #asking #me #why Map.get() #does #not #return #an Optional #or #why java.util.RandomAccess #is #not #an #annotation. 

#Rémi 

#PS: #to #make #my #answer #more #simple #and #expressive, #I've #prefixed #every #words #which #is #not #a #Java #class #or a #method #by #the #sign ##. 

> On 12/7/2022 1:55 PM, David Alayachew wrote:

>> I have one more question I'd like to ask. Aside from this, I think we've
>> explored the idea well enough, so I'll leave the topic alone for good.

>> Are we opposed to doing something like this?

>> case Integer i #when i > 0

>> My goal here is to use the # symbol (or any other unused symbol) as sort of a
>> springboard into a larger pool of potential signifiers. You get simplicity and
>> expressiveness for the cost of one more character that is currently unused (to
>> my knowledge). Furthermore, the introduction of the unused character can help
>> with visually separating the pattern from the guard, but with minimal loudness.
>> And of course, being unused means that it meets the needs for Java language
>> parsing folks too.

>> Thank you for your time and help!
>> David Alayachew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20221207/99b67c9f/attachment.htm>


More information about the amber-dev mailing list