You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@groovy.apache.org by Caleb Brandt <ca...@gmail.com> on 2024/03/24 15:57:59 UTC
[GSoC 2024] Idea: A Basic Superset of Java | Java+
I..... forgot to subscribe to this list first. :/ Please prune the
duplicate that's under moderation.
Also, if this isn't the right place for this, please tell me where I
*should* send it. I don't want to come barging in ignoring the way you guys
do things. I'm just really excited to possibly work with you guys.
On Sun, Mar 24, 2024, 10:38 AM Caleb Brandt <ca...@gmail.com> wrote:
> Hi all,
>
> I wanted to submit a new idea for this summer's GSoC. You should stick
> around, because I trust you'll find this as interesting as I do.
>
>
> *Motivation:*
>
> I know you made Groovy, but if you're anything like me, you *love* Java.
>
> I mean, how could you not: Java is unparalleled when it comes to
> readability and structure while still being *powerful*. You can track
> data flow through a program at a glance, there are a thousand easy-to-use
> and *intuitive* libraries, and - as much as I love C++ - there aren't any
> ambiguous operators, syntax that's only valid in one specific place, or
> random macro usage in the main library functions. You know exactly what
> something does just by looking at it, and that's *still* such a breath of
> fresh air even in the modern programming space. These new languages try to
> be as concise as possible for writing, but they sometimes forget that
> people have to *read* the dang thing too, am I right?
>
> But... Java can also be a bit *too* verbose at times, can't it? We only
> recently got a concise syntax for POJOs in the form of Records, and they
> come with their own set of stipulations that make using them somewhat
> niche. And that's not to mention the continued waiting for destructuring
> declarations, the getters and setters left floating around in the class,
> the endless if-elseif trees checking the same value against different
> things that make it so hard to track... There are a few areas of
> improvement; let's say that.
>
> Languages like Scala and Kotlin try to remedy this, but they end up with
> their own problems like enforced programming models, completely overhauled
> libraries that lose the intuitiveness of Java's, and just the overall
> learning curve of being a *completely different language*. Same thing
> with Groovy to a lesser extent: these languages *are* powerful, but they
> lose the familiarity that comes with Java.
>
> What we need is the ability to just... *add some stuff to Java*, without
> making people learn a whole new language to use it.
>
>
>
> So what if we did?
>
> *Proposal: Add Some Stuff To Java*
>
> Essentially, the plan is to make a set of syntactically-sugary-delicious
> constructs that transpile to plain ol' Java 8 source code, similar to how
> TypeScript's advanced features still compile to ECMA2016.
>
> The core principles are *zero overhead* and *improved readability*; this
> isn't remaking the wheel and constructing new libraries, this is just
> adding shorthand for ubiquitous and *consistent* features that we wish we
> could have saved time doing by hand. It's gotta feel like you're just
> using a version of Java from the near future: no syntax weirdness, just
> some extra intuitive constructs so it's easier both to write and to read.
>
> Things like:
>
> - Getters and setters being part of the variable declaration, and
> being called via the property name itself;
> - If/else-if trees that check the same variable against different
> things being allowed to be in the form of a `switchif` statement, similar
> to Kotlin's sequential switch statements;
> - Python-style "group imports" to save space and local renaming for
> imported functions and classes, so people can still give their items
> descriptive names without being forced to type the whole thing out every
> single time they want to use it;
> - Kotlin-style `with` blocks for the convenience and readability of
> "chaining" when chaining isn't an option;
> - The `as` keyword so you aren't forced to relearn lisp every time you
> need to cast something multiple times;
> - Destructuring declarations using annotations instead of waiting for
> pattern matching to come through
> - Operator overloading so we can do things like "accessing lists
> through brackets" and "doing boolean algebra in a readable manner", again
> declared using annotations so method names remain informative instead of
> letting developers hide actual behavior inside a non-descriptive function
> name;
> - Extension functions for grouping utility methods with the classes
> that use them; and
> - All syntactic sugar added since Java 8, now available for those of
> us living in the past (and also a lot of the world, because they don't even
> make a JRE for the latest version anymore) to use freely too.
>
>
> This would be accomplished using a Gradle plugin as a preprocessor,
> converting any J+ constructs to their Java 8 counterparts and then sending
> the new source off to javac to be compiled, eliminating the need for
> brittle ASM invocations to hook into the compiler directly, while still
> having relatively-low added runtime. For the most part it would be simple
> regex find-and-replace, avoiding any bytecode generation on purpose so the
> end user can see exactly what their code is ending up as.
>
> If possible, I'd like to also add the ability to apply the
> annotation-based parts - operators and destructuring - to preexisting
> libraries too, using what's essentially a ".d.ts" file but for Java. This
> would allow the convenience factor for advanced users without requiring it
> of newer ones, but it's likely out of scope for this project.
>
>
> To be honest, I'm just tired of having to keep track of my getters and
> setters. If I can replace this:
>
>> private String foo = "bar;
>
> public String getFoo() {
>>
> return this.foo;
>>
> }
>>
> public void setFoo(String newVal) {
>>
> this.foo = newVal;
>>
> doOtherThing();
>>
> }
>
>
> with this:
>
>> String foo = "bar";
>>
> get() {
>> return foo;
>> }
>>
> set(newVal) {
>> foo = newVal;
>> doOtherThing();
>> }
>>
> while still being able to use my precious Java syntax? And all it takes
> is banging my head against some regex for a couple hundred hours? That
> sounds like a fair trade to me.
>
> I have a full plan formulated with a finalized process for every step, but
> this is a "brief" overview of it. For the most part, I just desperately
> need the input of people who are experienced with this area. Even if you
> don't like this for GSoC, I would still love to chat about it in the
> future, because I think it will make Java just a little bit better for
> everyone.
>
>
>
> So, what do you think? Does this sound like a good proposal idea? Let me
> know your thoughts in the replies; I look forward to your feedback, and I
> happily await this being torn apart by people more knowledgeable in the
> field than I.
>
>
> Thank you so much for your time,
>
> Caleb Brandt
>
>
>
>
> About Me:
> I'm a hobbyist programmer and Fixer of Things: if I see something wrong
> that I can fix, I might as well help out. The power of programming is that
> if you solve a problem for yourself, you also solve it for *every single
> person who will ever live*, which is why I admire open-source consortiums
> such as you guys so greatly. You're everything I wanted to be when I grew
> up, and I'm applying because you still represent the hallmark of what good
> coding is to me: helping people do stuff better, just because you *can*.
>
> I'm finishing up my Bachelor's degree in Computer Science at the
> University of Central Florida, and in my off-time I make compatibility
> mods for Minecraft: optimizing interactions between other mods using Mixin
> (a framework for ASM), reflectively exposing new APIs in mods for other
> developers to use, bytecode-patching bugs in abandoned libraries, and
> anything else I can do to make the ecosystem a bit better than how I found
> it. I also attempt to fix any issues I encounter in open-source software;
> I already spent the time tracking it down, I might as well take one more
> step and fix it for *everyone* too. I just like to make helpful things,
> and I
>
>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Paul King <pa...@asert.com.au>.
[Comments inline below.]
On Mon, Mar 25, 2024 at 12:53 PM Caleb Brandt <ca...@gmail.com> wrote:
> I'm sorry if I accidentally sounded like I was insulting Groovy there! Groovy's features are tremendously powerful, and it's a blast to work with from what I've seen. I only meant to say that the layman's perception of Groovy is that it, like Scala or Kotlin, is a language relatively distant from normal Java, and thus is fairly intimidating.
It isn't a case of being insulted. I was just correcting what might be
thought of as invalid perceptions. Groovy uses Java syntax and adds
shortcuts which you can use, or not, depending on how comfortable you
are with the improvements. Scala and Kotlin have different syntax to
Java. So, there should be no need to feel intimidated if you are
already a Java developer when moving to Groovy.
> I think having something that acts as a midpoint between "a comprehensive language built off of Java" and "vanilla Java" has the potential to reach a much larger casual audience - people who wouldn't consider a full-blown language shift but might consider a plugin to speed up development - so it would still be worth investing in. Or in this case, giving some pointers as I basically build the entire project myself, as is the case with Google Summer of Code projects.
There are lots of ways to describe things. A "full-blown language
shift" is a strong term when you don't have to change language syntax
in 99% of cases. But a simple "plugin to speed up development" might
be an over-simplification given that it might mean losing IDE support,
losing ability to debug, and so forth. You should ask the Lombok folks
how much IDE support they get for free vs requires special IDE
support. Also, why I gave references to Manifold and Jactl.
In general, the technical part of the problem is the simple part. It
is useful to ask, how do you intend to market the technology, and how
will you maintain interest in the technology over many years when you
personally have moved on to other interests.
Cheers, Paul.
> Either way, thank you so much for your opinion! Even though I personally disagree, I can see where you're coming from, and that's the important part. :D
>
> I look forward to working with you if I ever contribute to the Groovy project in the future!
>
>
> Thanks again,
>
> Caleb Brandt
>
> On Sun, Mar 24, 2024 at 8:49 PM Paul King <pa...@asert.com.au> wrote:
>>
>> Technically, what you suggest would be feasible. Whether it is worth
>> doing is the big question.
>>
>> Other things you might want to look at are https://jactl.io/ and
>> http://manifold.systems/.
>>
>> My advice, don't gauge Groovy usage based on one DSL, Gradle. Gradle
>> could have written a type-checked Groovy DSL but went down the Kotlin
>> path instead. Were your issues with Gradle due to its complex build
>> model or the thin Groovy DSL layer?
>>
>> We'd love to have you work on Groovy features or Groovy marketing! :-)
>>
>> Cheers, Paul.
>>
>> On Mon, Mar 25, 2024 at 9:22 AM Caleb Brandt <ca...@gmail.com> wrote:
>> >
>> > Well, maybe Groovy did get a better static analyzer, but I sure haven't seen it. Marketing is the other biggest thing, and my (and the entire Minecraft community's) poor experience with Gradle makes me cringe at the idea of using Groovy for a larger project, even if it's actually really well made.
>> >
>> > So yeah, Groovy absolutely has everything I'm talking about, but I want Java to have it too. It seems like it would be pretty straightforward to do so, so do you think it's as feasible as I'd imagine it to be?
>> >
>> > On Sun, Mar 24, 2024 at 7:16 PM Caleb Brandt <ca...@gmail.com> wrote:
>> >>
>> >> Oh absolutely, but the impression I and a lot of other users who aren't familiar with Groovy got was unfortunately fairly far from that. Lack of first-class static analysis, Gradle being... not the best representation let's say, and the aggressive use of closures make it feel like it's a much more complicated language than it is.
>> >>
>> >> The biggest problem is the STATIC ANALYSIS, though. If you can't use the high-octane intellisense features, type inference, and code refactoring tools you're used to in your home language, you'll bear with the minor annoyance of its drawbacks, even though it's really grating after a while. As a compiled language, static analysis has to be built from the ground up with its compiler in mind, and Groovy unfortunately never received first-class support like Kotlin or Scala...
>> >>
>> >> The Java transpilation would completely solve the static analysis problem though, as we would easily be compatible with the highest-end static analysis tools through the same mechanism that C macros get linted.
>> >>
>> >> On Sun, Mar 24, 2024 at 7:04 PM Paul King <pa...@asert.com.au> wrote:
>> >>>
>> >>> One of Groovy's goals is to be simple to learn for Java users, so you
>> >>> can in fact just use the Java syntax that you are familiar with and
>> >>> take on board as many (or as few) Groovy idioms as you feel
>> >>> comfortable with.
>> >>>
>> >>> On Mon, Mar 25, 2024 at 8:27 AM Caleb Brandt <ca...@gmail.com> wrote:
>> >>> >
>> >>> > Thank you so much for the reply, Paul!
>> >>> >
>> >>> > And you're absolutely right: Groovy does give you all of those things, as do Kotlin and Scala. The issue I'm trying to solve isn't one of "not enough features in other languages", but one of "too many features". For example, Kotlin has every single one of the features I mentioned, but the amount of changes makes the jump from Java a steep one.
>> >>> >
>> >>> > Similarly, Groovy is extremely intimidating to long-time Java developers because of the sheer amount that it changes. While it's certainly the closest of the non-Java JVM languages to Java, it still has entirely new syntax, new libraries, new standards, and many things that don't have a direct Java analogue due to the bytecode tricks used.
>> >>> >
>> >>> > The whole point of this is to essentially "trickle down" some of those advanced JVM-language features to pure Java, so people can use some of these quality-of-life features without needing to learn a whole new language to use them. A dialect, if you will.
>> >>> >
>> >>> > On Sun, Mar 24, 2024 at 6:09 PM Paul King <pa...@asert.com.au> wrote:
>> >>> >>
>> >>> >> Hi Caleb, what you are describing as your desired goal sounds alot
>> >>> >> like Groovy to me. Can you elaborate on anything that you desire that
>> >>> >> Groovy doesn't already give you?
>> >>> >>
>> >>> >> Thanks, Paul.
>> >>> >>
>> >>> >> On Mon, Mar 25, 2024 at 1:58 AM Caleb Brandt <ca...@gmail.com> wrote:
>> >>> >> >
>> >>> >> > I..... forgot to subscribe to this list first. :/ Please prune the duplicate that's under moderation.
>> >>> >> >
>> >>> >> > Also, if this isn't the right place for this, please tell me where I should send it. I don't want to come barging in ignoring the way you guys do things. I'm just really excited to possibly work with you guys.
>> >>> >> >
>> >>> >> >
>> >>> >> > On Sun, Mar 24, 2024, 10:38 AM Caleb Brandt <ca...@gmail.com> wrote:
>> >>> >> >>
>> >>> >> >> Hi all,
>> >>> >> >>
>> >>> >> >> I wanted to submit a new idea for this summer's GSoC. You should stick around, because I trust you'll find this as interesting as I do.
>> >>> >> >>
>> >>> >> >>
>> >>> >> >> Motivation:
>> >>> >> >>
>> >>> >> >> I know you made Groovy, but if you're anything like me, you love Java.
>> >>> >> >>
>> >>> >> >> I mean, how could you not: Java is unparalleled when it comes to readability and structure while still being powerful. You can track data flow through a program at a glance, there are a thousand easy-to-use and intuitive libraries, and - as much as I love C++ - there aren't any ambiguous operators, syntax that's only valid in one specific place, or random macro usage in the main library functions. You know exactly what something does just by looking at it, and that's still such a breath of fresh air even in the modern programming space. These new languages try to be as concise as possible for writing, but they sometimes forget that people have to read the dang thing too, am I right?
>> >>> >> >>
>> >>> >> >> But... Java can also be a bit too verbose at times, can't it? We only recently got a concise syntax for POJOs in the form of Records, and they come with their own set of stipulations that make using them somewhat niche. And that's not to mention the continued waiting for destructuring declarations, the getters and setters left floating around in the class, the endless if-elseif trees checking the same value against different things that make it so hard to track... There are a few areas of improvement; let's say that.
>> >>> >> >>
>> >>> >> >> Languages like Scala and Kotlin try to remedy this, but they end up with their own problems like enforced programming models, completely overhauled libraries that lose the intuitiveness of Java's, and just the overall learning curve of being a completely different language. Same thing with Groovy to a lesser extent: these languages are powerful, but they lose the familiarity that comes with Java.
>> >>> >> >>
>> >>> >> >> What we need is the ability to just... add some stuff to Java, without making people learn a whole new language to use it.
>> >>> >> >>
>> >>> >> >>
>> >>> >> >>
>> >>> >> >> So what if we did?
>> >>> >> >>
>> >>> >> >> Proposal: Add Some Stuff To Java
>> >>> >> >>
>> >>> >> >> Essentially, the plan is to make a set of syntactically-sugary-delicious constructs that transpile to plain ol' Java 8 source code, similar to how TypeScript's advanced features still compile to ECMA2016.
>> >>> >> >>
>> >>> >> >> The core principles are zero overhead and improved readability; this isn't remaking the wheel and constructing new libraries, this is just adding shorthand for ubiquitous and consistent features that we wish we could have saved time doing by hand. It's gotta feel like you're just using a version of Java from the near future: no syntax weirdness, just some extra intuitive constructs so it's easier both to write and to read.
>> >>> >> >>
>> >>> >> >> Things like:
>> >>> >> >>
>> >>> >> >> Getters and setters being part of the variable declaration, and being called via the property name itself;
>> >>> >> >> If/else-if trees that check the same variable against different things being allowed to be in the form of a `switchif` statement, similar to Kotlin's sequential switch statements;
>> >>> >> >> Python-style "group imports" to save space and local renaming for imported functions and classes, so people can still give their items descriptive names without being forced to type the whole thing out every single time they want to use it;
>> >>> >> >> Kotlin-style `with` blocks for the convenience and readability of "chaining" when chaining isn't an option;
>> >>> >> >> The `as` keyword so you aren't forced to relearn lisp every time you need to cast something multiple times;
>> >>> >> >> Destructuring declarations using annotations instead of waiting for pattern matching to come through
>> >>> >> >> Operator overloading so we can do things like "accessing lists through brackets" and "doing boolean algebra in a readable manner", again declared using annotations so method names remain informative instead of letting developers hide actual behavior inside a non-descriptive function name;
>> >>> >> >> Extension functions for grouping utility methods with the classes that use them; and
>> >>> >> >> All syntactic sugar added since Java 8, now available for those of us living in the past (and also a lot of the world, because they don't even make a JRE for the latest version anymore) to use freely too.
>> >>> >> >>
>> >>> >> >>
>> >>> >> >> This would be accomplished using a Gradle plugin as a preprocessor, converting any J+ constructs to their Java 8 counterparts and then sending the new source off to javac to be compiled, eliminating the need for brittle ASM invocations to hook into the compiler directly, while still having relatively-low added runtime. For the most part it would be simple regex find-and-replace, avoiding any bytecode generation on purpose so the end user can see exactly what their code is ending up as.
>> >>> >> >>
>> >>> >> >> If possible, I'd like to also add the ability to apply the annotation-based parts - operators and destructuring - to preexisting libraries too, using what's essentially a ".d.ts" file but for Java. This would allow the convenience factor for advanced users without requiring it of newer ones, but it's likely out of scope for this project.
>> >>> >> >>
>> >>> >> >>
>> >>> >> >> To be honest, I'm just tired of having to keep track of my getters and setters. If I can replace this:
>> >>> >> >>>
>> >>> >> >>> private String foo = "bar;
>> >>> >> >>>
>> >>> >> >>> public String getFoo() {
>> >>> >> >>>
>> >>> >> >>> return this.foo;
>> >>> >> >>>
>> >>> >> >>> }
>> >>> >> >>>
>> >>> >> >>> public void setFoo(String newVal) {
>> >>> >> >>>
>> >>> >> >>> this.foo = newVal;
>> >>> >> >>>
>> >>> >> >>> doOtherThing();
>> >>> >> >>>
>> >>> >> >>> }
>> >>> >> >>
>> >>> >> >>
>> >>> >> >> with this:
>> >>> >> >>>
>> >>> >> >>> String foo = "bar";
>> >>> >> >>>
>> >>> >> >>> get() {
>> >>> >> >>> return foo;
>> >>> >> >>> }
>> >>> >> >>>
>> >>> >> >>> set(newVal) {
>> >>> >> >>> foo = newVal;
>> >>> >> >>> doOtherThing();
>> >>> >> >>> }
>> >>> >> >>
>> >>> >> >> while still being able to use my precious Java syntax? And all it takes is banging my head against some regex for a couple hundred hours? That sounds like a fair trade to me.
>> >>> >> >>
>> >>> >> >> I have a full plan formulated with a finalized process for every step, but this is a "brief" overview of it. For the most part, I just desperately need the input of people who are experienced with this area. Even if you don't like this for GSoC, I would still love to chat about it in the future, because I think it will make Java just a little bit better for everyone.
>> >>> >> >>
>> >>> >> >>
>> >>> >> >>
>> >>> >> >> So, what do you think? Does this sound like a good proposal idea? Let me know your thoughts in the replies; I look forward to your feedback, and I happily await this being torn apart by people more knowledgeable in the field than I.
>> >>> >> >>
>> >>> >> >>
>> >>> >> >> Thank you so much for your time,
>> >>> >> >>
>> >>> >> >> Caleb Brandt
>> >>> >> >>
>> >>> >> >>
>> >>> >> >>
>> >>> >> >>
>> >>> >> >> About Me:
>> >>> >> >> I'm a hobbyist programmer and Fixer of Things: if I see something wrong that I can fix, I might as well help out. The power of programming is that if you solve a problem for yourself, you also solve it for every single person who will ever live, which is why I admire open-source consortiums such as you guys so greatly. You're everything I wanted to be when I grew up, and I'm applying because you still represent the hallmark of what good coding is to me: helping people do stuff better, just because you can.
>> >>> >> >>
>> >>> >> >> I'm finishing up my Bachelor's degree in Computer Science at the University of Central Florida, and in my off-time I make compatibility mods for Minecraft: optimizing interactions between other mods using Mixin (a framework for ASM), reflectively exposing new APIs in mods for other developers to use, bytecode-patching bugs in abandoned libraries, and anything else I can do to make the ecosystem a bit better than how I found it. I also attempt to fix any issues I encounter in open-source software; I already spent the time tracking it down, I might as well take one more step and fix it for everyone too. I just like to make helpful things, and I
>> >>> >> >>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Caleb Brandt <ca...@gmail.com>.
Paul,
I'm sorry if I accidentally sounded like I was insulting Groovy there!
Groovy's features are tremendously powerful, and it's a blast to work with
from what I've seen. I only meant to say that the layman's *perception* of
Groovy is that it, like Scala or Kotlin, is a language relatively distant
from normal Java, and thus is fairly intimidating.
I think having something that acts as a midpoint between "a comprehensive
language built off of Java" and "vanilla Java" has the potential to reach a
much larger casual audience - people who wouldn't consider a full-blown
language shift but might consider a plugin to speed up development - so it
would still be worth investing in. Or in this case, giving some pointers
as I basically build the entire project myself, as is the case with Google
Summer of Code projects.
Either way, thank you so much for your opinion! Even though I personally
disagree, I can see where you're coming from, and that's the important
part. :D
I look forward to working with you if I ever contribute to the Groovy
project in the future!
Thanks again,
Caleb Brandt
On Sun, Mar 24, 2024 at 8:49 PM Paul King <pa...@asert.com.au> wrote:
> Technically, what you suggest would be feasible. Whether it is worth
> doing is the big question.
>
> Other things you might want to look at are https://jactl.io/ and
> http://manifold.systems/.
>
> My advice, don't gauge Groovy usage based on one DSL, Gradle. Gradle
> could have written a type-checked Groovy DSL but went down the Kotlin
> path instead. Were your issues with Gradle due to its complex build
> model or the thin Groovy DSL layer?
>
> We'd love to have you work on Groovy features or Groovy marketing! :-)
>
> Cheers, Paul.
>
> On Mon, Mar 25, 2024 at 9:22 AM Caleb Brandt <ca...@gmail.com>
> wrote:
> >
> > Well, maybe Groovy did get a better static analyzer, but I sure haven't
> seen it. Marketing is the other biggest thing, and my (and the entire
> Minecraft community's) poor experience with Gradle makes me cringe at the
> idea of using Groovy for a larger project, even if it's actually really
> well made.
> >
> > So yeah, Groovy absolutely has everything I'm talking about, but I want
> Java to have it too. It seems like it would be pretty straightforward to
> do so, so do you think it's as feasible as I'd imagine it to be?
> >
> > On Sun, Mar 24, 2024 at 7:16 PM Caleb Brandt <ca...@gmail.com>
> wrote:
> >>
> >> Oh absolutely, but the impression I and a lot of other users who aren't
> familiar with Groovy got was unfortunately fairly far from that. Lack of
> first-class static analysis, Gradle being... not the best representation
> let's say, and the aggressive use of closures make it feel like it's a much
> more complicated language than it is.
> >>
> >> The biggest problem is the STATIC ANALYSIS, though. If you can't use
> the high-octane intellisense features, type inference, and code refactoring
> tools you're used to in your home language, you'll bear with the minor
> annoyance of its drawbacks, even though it's really grating after a while.
> As a compiled language, static analysis has to be built from the ground up
> with its compiler in mind, and Groovy unfortunately never received
> first-class support like Kotlin or Scala...
> >>
> >> The Java transpilation would completely solve the static analysis
> problem though, as we would easily be compatible with the highest-end
> static analysis tools through the same mechanism that C macros get linted.
> >>
> >> On Sun, Mar 24, 2024 at 7:04 PM Paul King <pa...@asert.com.au> wrote:
> >>>
> >>> One of Groovy's goals is to be simple to learn for Java users, so you
> >>> can in fact just use the Java syntax that you are familiar with and
> >>> take on board as many (or as few) Groovy idioms as you feel
> >>> comfortable with.
> >>>
> >>> On Mon, Mar 25, 2024 at 8:27 AM Caleb Brandt <ca...@gmail.com>
> wrote:
> >>> >
> >>> > Thank you so much for the reply, Paul!
> >>> >
> >>> > And you're absolutely right: Groovy does give you all of those
> things, as do Kotlin and Scala. The issue I'm trying to solve isn't one of
> "not enough features in other languages", but one of "too many features".
> For example, Kotlin has every single one of the features I mentioned, but
> the amount of changes makes the jump from Java a steep one.
> >>> >
> >>> > Similarly, Groovy is extremely intimidating to long-time Java
> developers because of the sheer amount that it changes. While it's
> certainly the closest of the non-Java JVM languages to Java, it still has
> entirely new syntax, new libraries, new standards, and many things that
> don't have a direct Java analogue due to the bytecode tricks used.
> >>> >
> >>> > The whole point of this is to essentially "trickle down" some of
> those advanced JVM-language features to pure Java, so people can use some
> of these quality-of-life features without needing to learn a whole new
> language to use them. A dialect, if you will.
> >>> >
> >>> > On Sun, Mar 24, 2024 at 6:09 PM Paul King <pa...@asert.com.au>
> wrote:
> >>> >>
> >>> >> Hi Caleb, what you are describing as your desired goal sounds alot
> >>> >> like Groovy to me. Can you elaborate on anything that you desire
> that
> >>> >> Groovy doesn't already give you?
> >>> >>
> >>> >> Thanks, Paul.
> >>> >>
> >>> >> On Mon, Mar 25, 2024 at 1:58 AM Caleb Brandt <
> calebbrandt77@gmail.com> wrote:
> >>> >> >
> >>> >> > I..... forgot to subscribe to this list first. :/ Please prune
> the duplicate that's under moderation.
> >>> >> >
> >>> >> > Also, if this isn't the right place for this, please tell me
> where I should send it. I don't want to come barging in ignoring the way
> you guys do things. I'm just really excited to possibly work with you guys.
> >>> >> >
> >>> >> >
> >>> >> > On Sun, Mar 24, 2024, 10:38 AM Caleb Brandt <
> calebbrandt77@gmail.com> wrote:
> >>> >> >>
> >>> >> >> Hi all,
> >>> >> >>
> >>> >> >> I wanted to submit a new idea for this summer's GSoC. You
> should stick around, because I trust you'll find this as interesting as I
> do.
> >>> >> >>
> >>> >> >>
> >>> >> >> Motivation:
> >>> >> >>
> >>> >> >> I know you made Groovy, but if you're anything like me, you love
> Java.
> >>> >> >>
> >>> >> >> I mean, how could you not: Java is unparalleled when it comes to
> readability and structure while still being powerful. You can track data
> flow through a program at a glance, there are a thousand easy-to-use and
> intuitive libraries, and - as much as I love C++ - there aren't any
> ambiguous operators, syntax that's only valid in one specific place, or
> random macro usage in the main library functions. You know exactly what
> something does just by looking at it, and that's still such a breath of
> fresh air even in the modern programming space. These new languages try to
> be as concise as possible for writing, but they sometimes forget that
> people have to read the dang thing too, am I right?
> >>> >> >>
> >>> >> >> But... Java can also be a bit too verbose at times, can't it? We
> only recently got a concise syntax for POJOs in the form of Records, and
> they come with their own set of stipulations that make using them somewhat
> niche. And that's not to mention the continued waiting for destructuring
> declarations, the getters and setters left floating around in the class,
> the endless if-elseif trees checking the same value against different
> things that make it so hard to track... There are a few areas of
> improvement; let's say that.
> >>> >> >>
> >>> >> >> Languages like Scala and Kotlin try to remedy this, but they end
> up with their own problems like enforced programming models, completely
> overhauled libraries that lose the intuitiveness of Java's, and just the
> overall learning curve of being a completely different language. Same thing
> with Groovy to a lesser extent: these languages are powerful, but they lose
> the familiarity that comes with Java.
> >>> >> >>
> >>> >> >> What we need is the ability to just... add some stuff to Java,
> without making people learn a whole new language to use it.
> >>> >> >>
> >>> >> >>
> >>> >> >>
> >>> >> >> So what if we did?
> >>> >> >>
> >>> >> >> Proposal: Add Some Stuff To Java
> >>> >> >>
> >>> >> >> Essentially, the plan is to make a set of
> syntactically-sugary-delicious constructs that transpile to plain ol' Java
> 8 source code, similar to how TypeScript's advanced features still compile
> to ECMA2016.
> >>> >> >>
> >>> >> >> The core principles are zero overhead and improved readability;
> this isn't remaking the wheel and constructing new libraries, this is just
> adding shorthand for ubiquitous and consistent features that we wish we
> could have saved time doing by hand. It's gotta feel like you're just
> using a version of Java from the near future: no syntax weirdness, just
> some extra intuitive constructs so it's easier both to write and to read.
> >>> >> >>
> >>> >> >> Things like:
> >>> >> >>
> >>> >> >> Getters and setters being part of the variable declaration, and
> being called via the property name itself;
> >>> >> >> If/else-if trees that check the same variable against different
> things being allowed to be in the form of a `switchif` statement, similar
> to Kotlin's sequential switch statements;
> >>> >> >> Python-style "group imports" to save space and local renaming
> for imported functions and classes, so people can still give their items
> descriptive names without being forced to type the whole thing out every
> single time they want to use it;
> >>> >> >> Kotlin-style `with` blocks for the convenience and readability
> of "chaining" when chaining isn't an option;
> >>> >> >> The `as` keyword so you aren't forced to relearn lisp every time
> you need to cast something multiple times;
> >>> >> >> Destructuring declarations using annotations instead of waiting
> for pattern matching to come through
> >>> >> >> Operator overloading so we can do things like "accessing lists
> through brackets" and "doing boolean algebra in a readable manner", again
> declared using annotations so method names remain informative instead of
> letting developers hide actual behavior inside a non-descriptive function
> name;
> >>> >> >> Extension functions for grouping utility methods with the
> classes that use them; and
> >>> >> >> All syntactic sugar added since Java 8, now available for those
> of us living in the past (and also a lot of the world, because they don't
> even make a JRE for the latest version anymore) to use freely too.
> >>> >> >>
> >>> >> >>
> >>> >> >> This would be accomplished using a Gradle plugin as a
> preprocessor, converting any J+ constructs to their Java 8 counterparts and
> then sending the new source off to javac to be compiled, eliminating the
> need for brittle ASM invocations to hook into the compiler directly, while
> still having relatively-low added runtime. For the most part it would be
> simple regex find-and-replace, avoiding any bytecode generation on purpose
> so the end user can see exactly what their code is ending up as.
> >>> >> >>
> >>> >> >> If possible, I'd like to also add the ability to apply the
> annotation-based parts - operators and destructuring - to preexisting
> libraries too, using what's essentially a ".d.ts" file but for Java. This
> would allow the convenience factor for advanced users without requiring it
> of newer ones, but it's likely out of scope for this project.
> >>> >> >>
> >>> >> >>
> >>> >> >> To be honest, I'm just tired of having to keep track of my
> getters and setters. If I can replace this:
> >>> >> >>>
> >>> >> >>> private String foo = "bar;
> >>> >> >>>
> >>> >> >>> public String getFoo() {
> >>> >> >>>
> >>> >> >>> return this.foo;
> >>> >> >>>
> >>> >> >>> }
> >>> >> >>>
> >>> >> >>> public void setFoo(String newVal) {
> >>> >> >>>
> >>> >> >>> this.foo = newVal;
> >>> >> >>>
> >>> >> >>> doOtherThing();
> >>> >> >>>
> >>> >> >>> }
> >>> >> >>
> >>> >> >>
> >>> >> >> with this:
> >>> >> >>>
> >>> >> >>> String foo = "bar";
> >>> >> >>>
> >>> >> >>> get() {
> >>> >> >>> return foo;
> >>> >> >>> }
> >>> >> >>>
> >>> >> >>> set(newVal) {
> >>> >> >>> foo = newVal;
> >>> >> >>> doOtherThing();
> >>> >> >>> }
> >>> >> >>
> >>> >> >> while still being able to use my precious Java syntax? And all
> it takes is banging my head against some regex for a couple hundred hours?
> That sounds like a fair trade to me.
> >>> >> >>
> >>> >> >> I have a full plan formulated with a finalized process for every
> step, but this is a "brief" overview of it. For the most part, I just
> desperately need the input of people who are experienced with this area.
> Even if you don't like this for GSoC, I would still love to chat about it
> in the future, because I think it will make Java just a little bit better
> for everyone.
> >>> >> >>
> >>> >> >>
> >>> >> >>
> >>> >> >> So, what do you think? Does this sound like a good proposal
> idea? Let me know your thoughts in the replies; I look forward to your
> feedback, and I happily await this being torn apart by people more
> knowledgeable in the field than I.
> >>> >> >>
> >>> >> >>
> >>> >> >> Thank you so much for your time,
> >>> >> >>
> >>> >> >> Caleb Brandt
> >>> >> >>
> >>> >> >>
> >>> >> >>
> >>> >> >>
> >>> >> >> About Me:
> >>> >> >> I'm a hobbyist programmer and Fixer of Things: if I see
> something wrong that I can fix, I might as well help out. The power of
> programming is that if you solve a problem for yourself, you also solve it
> for every single person who will ever live, which is why I admire
> open-source consortiums such as you guys so greatly. You're everything I
> wanted to be when I grew up, and I'm applying because you still represent
> the hallmark of what good coding is to me: helping people do stuff better,
> just because you can.
> >>> >> >>
> >>> >> >> I'm finishing up my Bachelor's degree in Computer Science at the
> University of Central Florida, and in my off-time I make compatibility mods
> for Minecraft: optimizing interactions between other mods using Mixin (a
> framework for ASM), reflectively exposing new APIs in mods for other
> developers to use, bytecode-patching bugs in abandoned libraries, and
> anything else I can do to make the ecosystem a bit better than how I found
> it. I also attempt to fix any issues I encounter in open-source software;
> I already spent the time tracking it down, I might as well take one more
> step and fix it for everyone too. I just like to make helpful things, and I
> >>> >> >>
>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Paul King <pa...@asert.com.au>.
Technically, what you suggest would be feasible. Whether it is worth
doing is the big question.
Other things you might want to look at are https://jactl.io/ and
http://manifold.systems/.
My advice, don't gauge Groovy usage based on one DSL, Gradle. Gradle
could have written a type-checked Groovy DSL but went down the Kotlin
path instead. Were your issues with Gradle due to its complex build
model or the thin Groovy DSL layer?
We'd love to have you work on Groovy features or Groovy marketing! :-)
Cheers, Paul.
On Mon, Mar 25, 2024 at 9:22 AM Caleb Brandt <ca...@gmail.com> wrote:
>
> Well, maybe Groovy did get a better static analyzer, but I sure haven't seen it. Marketing is the other biggest thing, and my (and the entire Minecraft community's) poor experience with Gradle makes me cringe at the idea of using Groovy for a larger project, even if it's actually really well made.
>
> So yeah, Groovy absolutely has everything I'm talking about, but I want Java to have it too. It seems like it would be pretty straightforward to do so, so do you think it's as feasible as I'd imagine it to be?
>
> On Sun, Mar 24, 2024 at 7:16 PM Caleb Brandt <ca...@gmail.com> wrote:
>>
>> Oh absolutely, but the impression I and a lot of other users who aren't familiar with Groovy got was unfortunately fairly far from that. Lack of first-class static analysis, Gradle being... not the best representation let's say, and the aggressive use of closures make it feel like it's a much more complicated language than it is.
>>
>> The biggest problem is the STATIC ANALYSIS, though. If you can't use the high-octane intellisense features, type inference, and code refactoring tools you're used to in your home language, you'll bear with the minor annoyance of its drawbacks, even though it's really grating after a while. As a compiled language, static analysis has to be built from the ground up with its compiler in mind, and Groovy unfortunately never received first-class support like Kotlin or Scala...
>>
>> The Java transpilation would completely solve the static analysis problem though, as we would easily be compatible with the highest-end static analysis tools through the same mechanism that C macros get linted.
>>
>> On Sun, Mar 24, 2024 at 7:04 PM Paul King <pa...@asert.com.au> wrote:
>>>
>>> One of Groovy's goals is to be simple to learn for Java users, so you
>>> can in fact just use the Java syntax that you are familiar with and
>>> take on board as many (or as few) Groovy idioms as you feel
>>> comfortable with.
>>>
>>> On Mon, Mar 25, 2024 at 8:27 AM Caleb Brandt <ca...@gmail.com> wrote:
>>> >
>>> > Thank you so much for the reply, Paul!
>>> >
>>> > And you're absolutely right: Groovy does give you all of those things, as do Kotlin and Scala. The issue I'm trying to solve isn't one of "not enough features in other languages", but one of "too many features". For example, Kotlin has every single one of the features I mentioned, but the amount of changes makes the jump from Java a steep one.
>>> >
>>> > Similarly, Groovy is extremely intimidating to long-time Java developers because of the sheer amount that it changes. While it's certainly the closest of the non-Java JVM languages to Java, it still has entirely new syntax, new libraries, new standards, and many things that don't have a direct Java analogue due to the bytecode tricks used.
>>> >
>>> > The whole point of this is to essentially "trickle down" some of those advanced JVM-language features to pure Java, so people can use some of these quality-of-life features without needing to learn a whole new language to use them. A dialect, if you will.
>>> >
>>> > On Sun, Mar 24, 2024 at 6:09 PM Paul King <pa...@asert.com.au> wrote:
>>> >>
>>> >> Hi Caleb, what you are describing as your desired goal sounds alot
>>> >> like Groovy to me. Can you elaborate on anything that you desire that
>>> >> Groovy doesn't already give you?
>>> >>
>>> >> Thanks, Paul.
>>> >>
>>> >> On Mon, Mar 25, 2024 at 1:58 AM Caleb Brandt <ca...@gmail.com> wrote:
>>> >> >
>>> >> > I..... forgot to subscribe to this list first. :/ Please prune the duplicate that's under moderation.
>>> >> >
>>> >> > Also, if this isn't the right place for this, please tell me where I should send it. I don't want to come barging in ignoring the way you guys do things. I'm just really excited to possibly work with you guys.
>>> >> >
>>> >> >
>>> >> > On Sun, Mar 24, 2024, 10:38 AM Caleb Brandt <ca...@gmail.com> wrote:
>>> >> >>
>>> >> >> Hi all,
>>> >> >>
>>> >> >> I wanted to submit a new idea for this summer's GSoC. You should stick around, because I trust you'll find this as interesting as I do.
>>> >> >>
>>> >> >>
>>> >> >> Motivation:
>>> >> >>
>>> >> >> I know you made Groovy, but if you're anything like me, you love Java.
>>> >> >>
>>> >> >> I mean, how could you not: Java is unparalleled when it comes to readability and structure while still being powerful. You can track data flow through a program at a glance, there are a thousand easy-to-use and intuitive libraries, and - as much as I love C++ - there aren't any ambiguous operators, syntax that's only valid in one specific place, or random macro usage in the main library functions. You know exactly what something does just by looking at it, and that's still such a breath of fresh air even in the modern programming space. These new languages try to be as concise as possible for writing, but they sometimes forget that people have to read the dang thing too, am I right?
>>> >> >>
>>> >> >> But... Java can also be a bit too verbose at times, can't it? We only recently got a concise syntax for POJOs in the form of Records, and they come with their own set of stipulations that make using them somewhat niche. And that's not to mention the continued waiting for destructuring declarations, the getters and setters left floating around in the class, the endless if-elseif trees checking the same value against different things that make it so hard to track... There are a few areas of improvement; let's say that.
>>> >> >>
>>> >> >> Languages like Scala and Kotlin try to remedy this, but they end up with their own problems like enforced programming models, completely overhauled libraries that lose the intuitiveness of Java's, and just the overall learning curve of being a completely different language. Same thing with Groovy to a lesser extent: these languages are powerful, but they lose the familiarity that comes with Java.
>>> >> >>
>>> >> >> What we need is the ability to just... add some stuff to Java, without making people learn a whole new language to use it.
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> So what if we did?
>>> >> >>
>>> >> >> Proposal: Add Some Stuff To Java
>>> >> >>
>>> >> >> Essentially, the plan is to make a set of syntactically-sugary-delicious constructs that transpile to plain ol' Java 8 source code, similar to how TypeScript's advanced features still compile to ECMA2016.
>>> >> >>
>>> >> >> The core principles are zero overhead and improved readability; this isn't remaking the wheel and constructing new libraries, this is just adding shorthand for ubiquitous and consistent features that we wish we could have saved time doing by hand. It's gotta feel like you're just using a version of Java from the near future: no syntax weirdness, just some extra intuitive constructs so it's easier both to write and to read.
>>> >> >>
>>> >> >> Things like:
>>> >> >>
>>> >> >> Getters and setters being part of the variable declaration, and being called via the property name itself;
>>> >> >> If/else-if trees that check the same variable against different things being allowed to be in the form of a `switchif` statement, similar to Kotlin's sequential switch statements;
>>> >> >> Python-style "group imports" to save space and local renaming for imported functions and classes, so people can still give their items descriptive names without being forced to type the whole thing out every single time they want to use it;
>>> >> >> Kotlin-style `with` blocks for the convenience and readability of "chaining" when chaining isn't an option;
>>> >> >> The `as` keyword so you aren't forced to relearn lisp every time you need to cast something multiple times;
>>> >> >> Destructuring declarations using annotations instead of waiting for pattern matching to come through
>>> >> >> Operator overloading so we can do things like "accessing lists through brackets" and "doing boolean algebra in a readable manner", again declared using annotations so method names remain informative instead of letting developers hide actual behavior inside a non-descriptive function name;
>>> >> >> Extension functions for grouping utility methods with the classes that use them; and
>>> >> >> All syntactic sugar added since Java 8, now available for those of us living in the past (and also a lot of the world, because they don't even make a JRE for the latest version anymore) to use freely too.
>>> >> >>
>>> >> >>
>>> >> >> This would be accomplished using a Gradle plugin as a preprocessor, converting any J+ constructs to their Java 8 counterparts and then sending the new source off to javac to be compiled, eliminating the need for brittle ASM invocations to hook into the compiler directly, while still having relatively-low added runtime. For the most part it would be simple regex find-and-replace, avoiding any bytecode generation on purpose so the end user can see exactly what their code is ending up as.
>>> >> >>
>>> >> >> If possible, I'd like to also add the ability to apply the annotation-based parts - operators and destructuring - to preexisting libraries too, using what's essentially a ".d.ts" file but for Java. This would allow the convenience factor for advanced users without requiring it of newer ones, but it's likely out of scope for this project.
>>> >> >>
>>> >> >>
>>> >> >> To be honest, I'm just tired of having to keep track of my getters and setters. If I can replace this:
>>> >> >>>
>>> >> >>> private String foo = "bar;
>>> >> >>>
>>> >> >>> public String getFoo() {
>>> >> >>>
>>> >> >>> return this.foo;
>>> >> >>>
>>> >> >>> }
>>> >> >>>
>>> >> >>> public void setFoo(String newVal) {
>>> >> >>>
>>> >> >>> this.foo = newVal;
>>> >> >>>
>>> >> >>> doOtherThing();
>>> >> >>>
>>> >> >>> }
>>> >> >>
>>> >> >>
>>> >> >> with this:
>>> >> >>>
>>> >> >>> String foo = "bar";
>>> >> >>>
>>> >> >>> get() {
>>> >> >>> return foo;
>>> >> >>> }
>>> >> >>>
>>> >> >>> set(newVal) {
>>> >> >>> foo = newVal;
>>> >> >>> doOtherThing();
>>> >> >>> }
>>> >> >>
>>> >> >> while still being able to use my precious Java syntax? And all it takes is banging my head against some regex for a couple hundred hours? That sounds like a fair trade to me.
>>> >> >>
>>> >> >> I have a full plan formulated with a finalized process for every step, but this is a "brief" overview of it. For the most part, I just desperately need the input of people who are experienced with this area. Even if you don't like this for GSoC, I would still love to chat about it in the future, because I think it will make Java just a little bit better for everyone.
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> So, what do you think? Does this sound like a good proposal idea? Let me know your thoughts in the replies; I look forward to your feedback, and I happily await this being torn apart by people more knowledgeable in the field than I.
>>> >> >>
>>> >> >>
>>> >> >> Thank you so much for your time,
>>> >> >>
>>> >> >> Caleb Brandt
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> About Me:
>>> >> >> I'm a hobbyist programmer and Fixer of Things: if I see something wrong that I can fix, I might as well help out. The power of programming is that if you solve a problem for yourself, you also solve it for every single person who will ever live, which is why I admire open-source consortiums such as you guys so greatly. You're everything I wanted to be when I grew up, and I'm applying because you still represent the hallmark of what good coding is to me: helping people do stuff better, just because you can.
>>> >> >>
>>> >> >> I'm finishing up my Bachelor's degree in Computer Science at the University of Central Florida, and in my off-time I make compatibility mods for Minecraft: optimizing interactions between other mods using Mixin (a framework for ASM), reflectively exposing new APIs in mods for other developers to use, bytecode-patching bugs in abandoned libraries, and anything else I can do to make the ecosystem a bit better than how I found it. I also attempt to fix any issues I encounter in open-source software; I already spent the time tracking it down, I might as well take one more step and fix it for everyone too. I just like to make helpful things, and I
>>> >> >>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Caleb Brandt <ca...@gmail.com>.
(I also use Java professionally, not just for Minecraft, but we only use
Maven on business projects so I'm more familiar with the horrors of
*Minecraft's* toolchain management.)
On Sun, Mar 24, 2024 at 7:21 PM Caleb Brandt <ca...@gmail.com>
wrote:
> Well, maybe Groovy did get a better static analyzer, but I sure haven't
> seen it. Marketing is the other biggest thing, and my (and the entire
> Minecraft community's) poor experience with Gradle makes me cringe at the
> idea of using Groovy for a larger project, even if it's actually really
> well made.
>
> So yeah, Groovy absolutely has everything I'm talking about, but I want
> *Java* to have it too. It seems like it would be pretty straightforward
> to do so, so do you think it's as feasible as I'd imagine it to be?
>
> On Sun, Mar 24, 2024 at 7:16 PM Caleb Brandt <ca...@gmail.com>
> wrote:
>
>> Oh absolutely, but the impression I and a lot of other users who aren't
>> familiar with Groovy got was unfortunately fairly far from that. Lack of
>> first-class static analysis, Gradle being... not the *best*
>> representation let's say, and the aggressive use of closures make it feel
>> like it's a much more complicated language than it is.
>>
>> The biggest problem is the *STATIC ANALYSIS*, though. If you can't use
>> the high-octane intellisense features, type inference, and code refactoring
>> tools you're used to in your home language, you'll bear with the minor
>> annoyance of its drawbacks, even though it's really grating after a while.
>> As a compiled language, static analysis has to be built from the ground up
>> with its compiler in mind, and Groovy unfortunately never received
>> first-class support like Kotlin or Scala...
>>
>> The Java transpilation would completely solve the static analysis problem
>> though, as we would easily be compatible with the highest-end static
>> analysis tools through the same mechanism that C macros get linted.
>>
>> On Sun, Mar 24, 2024 at 7:04 PM Paul King <pa...@asert.com.au> wrote:
>>
>>> One of Groovy's goals is to be simple to learn for Java users, so you
>>> can in fact just use the Java syntax that you are familiar with and
>>> take on board as many (or as few) Groovy idioms as you feel
>>> comfortable with.
>>>
>>> On Mon, Mar 25, 2024 at 8:27 AM Caleb Brandt <ca...@gmail.com>
>>> wrote:
>>> >
>>> > Thank you so much for the reply, Paul!
>>> >
>>> > And you're absolutely right: Groovy does give you all of those things,
>>> as do Kotlin and Scala. The issue I'm trying to solve isn't one of "not
>>> enough features in other languages", but one of "too many features". For
>>> example, Kotlin has every single one of the features I mentioned, but the
>>> amount of changes makes the jump from Java a steep one.
>>> >
>>> > Similarly, Groovy is extremely intimidating to long-time Java
>>> developers because of the sheer amount that it changes. While it's
>>> certainly the closest of the non-Java JVM languages to Java, it still has
>>> entirely new syntax, new libraries, new standards, and many things that
>>> don't have a direct Java analogue due to the bytecode tricks used.
>>> >
>>> > The whole point of this is to essentially "trickle down" some of those
>>> advanced JVM-language features to pure Java, so people can use some of
>>> these quality-of-life features without needing to learn a whole new
>>> language to use them. A dialect, if you will.
>>> >
>>> > On Sun, Mar 24, 2024 at 6:09 PM Paul King <pa...@asert.com.au> wrote:
>>> >>
>>> >> Hi Caleb, what you are describing as your desired goal sounds alot
>>> >> like Groovy to me. Can you elaborate on anything that you desire that
>>> >> Groovy doesn't already give you?
>>> >>
>>> >> Thanks, Paul.
>>> >>
>>> >> On Mon, Mar 25, 2024 at 1:58 AM Caleb Brandt <ca...@gmail.com>
>>> wrote:
>>> >> >
>>> >> > I..... forgot to subscribe to this list first. :/ Please prune the
>>> duplicate that's under moderation.
>>> >> >
>>> >> > Also, if this isn't the right place for this, please tell me where
>>> I should send it. I don't want to come barging in ignoring the way you guys
>>> do things. I'm just really excited to possibly work with you guys.
>>> >> >
>>> >> >
>>> >> > On Sun, Mar 24, 2024, 10:38 AM Caleb Brandt <
>>> calebbrandt77@gmail.com> wrote:
>>> >> >>
>>> >> >> Hi all,
>>> >> >>
>>> >> >> I wanted to submit a new idea for this summer's GSoC. You should
>>> stick around, because I trust you'll find this as interesting as I do.
>>> >> >>
>>> >> >>
>>> >> >> Motivation:
>>> >> >>
>>> >> >> I know you made Groovy, but if you're anything like me, you love
>>> Java.
>>> >> >>
>>> >> >> I mean, how could you not: Java is unparalleled when it comes to
>>> readability and structure while still being powerful. You can track data
>>> flow through a program at a glance, there are a thousand easy-to-use and
>>> intuitive libraries, and - as much as I love C++ - there aren't any
>>> ambiguous operators, syntax that's only valid in one specific place, or
>>> random macro usage in the main library functions. You know exactly what
>>> something does just by looking at it, and that's still such a breath of
>>> fresh air even in the modern programming space. These new languages try to
>>> be as concise as possible for writing, but they sometimes forget that
>>> people have to read the dang thing too, am I right?
>>> >> >>
>>> >> >> But... Java can also be a bit too verbose at times, can't it? We
>>> only recently got a concise syntax for POJOs in the form of Records, and
>>> they come with their own set of stipulations that make using them somewhat
>>> niche. And that's not to mention the continued waiting for destructuring
>>> declarations, the getters and setters left floating around in the class,
>>> the endless if-elseif trees checking the same value against different
>>> things that make it so hard to track... There are a few areas of
>>> improvement; let's say that.
>>> >> >>
>>> >> >> Languages like Scala and Kotlin try to remedy this, but they end
>>> up with their own problems like enforced programming models, completely
>>> overhauled libraries that lose the intuitiveness of Java's, and just the
>>> overall learning curve of being a completely different language. Same thing
>>> with Groovy to a lesser extent: these languages are powerful, but they lose
>>> the familiarity that comes with Java.
>>> >> >>
>>> >> >> What we need is the ability to just... add some stuff to Java,
>>> without making people learn a whole new language to use it.
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> So what if we did?
>>> >> >>
>>> >> >> Proposal: Add Some Stuff To Java
>>> >> >>
>>> >> >> Essentially, the plan is to make a set of
>>> syntactically-sugary-delicious constructs that transpile to plain ol' Java
>>> 8 source code, similar to how TypeScript's advanced features still compile
>>> to ECMA2016.
>>> >> >>
>>> >> >> The core principles are zero overhead and improved readability;
>>> this isn't remaking the wheel and constructing new libraries, this is just
>>> adding shorthand for ubiquitous and consistent features that we wish we
>>> could have saved time doing by hand. It's gotta feel like you're just
>>> using a version of Java from the near future: no syntax weirdness, just
>>> some extra intuitive constructs so it's easier both to write and to read.
>>> >> >>
>>> >> >> Things like:
>>> >> >>
>>> >> >> Getters and setters being part of the variable declaration, and
>>> being called via the property name itself;
>>> >> >> If/else-if trees that check the same variable against different
>>> things being allowed to be in the form of a `switchif` statement, similar
>>> to Kotlin's sequential switch statements;
>>> >> >> Python-style "group imports" to save space and local renaming for
>>> imported functions and classes, so people can still give their items
>>> descriptive names without being forced to type the whole thing out every
>>> single time they want to use it;
>>> >> >> Kotlin-style `with` blocks for the convenience and readability of
>>> "chaining" when chaining isn't an option;
>>> >> >> The `as` keyword so you aren't forced to relearn lisp every time
>>> you need to cast something multiple times;
>>> >> >> Destructuring declarations using annotations instead of waiting
>>> for pattern matching to come through
>>> >> >> Operator overloading so we can do things like "accessing lists
>>> through brackets" and "doing boolean algebra in a readable manner", again
>>> declared using annotations so method names remain informative instead of
>>> letting developers hide actual behavior inside a non-descriptive function
>>> name;
>>> >> >> Extension functions for grouping utility methods with the classes
>>> that use them; and
>>> >> >> All syntactic sugar added since Java 8, now available for those of
>>> us living in the past (and also a lot of the world, because they don't even
>>> make a JRE for the latest version anymore) to use freely too.
>>> >> >>
>>> >> >>
>>> >> >> This would be accomplished using a Gradle plugin as a
>>> preprocessor, converting any J+ constructs to their Java 8 counterparts and
>>> then sending the new source off to javac to be compiled, eliminating the
>>> need for brittle ASM invocations to hook into the compiler directly, while
>>> still having relatively-low added runtime. For the most part it would be
>>> simple regex find-and-replace, avoiding any bytecode generation on purpose
>>> so the end user can see exactly what their code is ending up as.
>>> >> >>
>>> >> >> If possible, I'd like to also add the ability to apply the
>>> annotation-based parts - operators and destructuring - to preexisting
>>> libraries too, using what's essentially a ".d.ts" file but for Java. This
>>> would allow the convenience factor for advanced users without requiring it
>>> of newer ones, but it's likely out of scope for this project.
>>> >> >>
>>> >> >>
>>> >> >> To be honest, I'm just tired of having to keep track of my getters
>>> and setters. If I can replace this:
>>> >> >>>
>>> >> >>> private String foo = "bar;
>>> >> >>>
>>> >> >>> public String getFoo() {
>>> >> >>>
>>> >> >>> return this.foo;
>>> >> >>>
>>> >> >>> }
>>> >> >>>
>>> >> >>> public void setFoo(String newVal) {
>>> >> >>>
>>> >> >>> this.foo = newVal;
>>> >> >>>
>>> >> >>> doOtherThing();
>>> >> >>>
>>> >> >>> }
>>> >> >>
>>> >> >>
>>> >> >> with this:
>>> >> >>>
>>> >> >>> String foo = "bar";
>>> >> >>>
>>> >> >>> get() {
>>> >> >>> return foo;
>>> >> >>> }
>>> >> >>>
>>> >> >>> set(newVal) {
>>> >> >>> foo = newVal;
>>> >> >>> doOtherThing();
>>> >> >>> }
>>> >> >>
>>> >> >> while still being able to use my precious Java syntax? And all it
>>> takes is banging my head against some regex for a couple hundred hours?
>>> That sounds like a fair trade to me.
>>> >> >>
>>> >> >> I have a full plan formulated with a finalized process for every
>>> step, but this is a "brief" overview of it. For the most part, I just
>>> desperately need the input of people who are experienced with this area.
>>> Even if you don't like this for GSoC, I would still love to chat about it
>>> in the future, because I think it will make Java just a little bit better
>>> for everyone.
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> So, what do you think? Does this sound like a good proposal idea?
>>> Let me know your thoughts in the replies; I look forward to your feedback,
>>> and I happily await this being torn apart by people more knowledgeable in
>>> the field than I.
>>> >> >>
>>> >> >>
>>> >> >> Thank you so much for your time,
>>> >> >>
>>> >> >> Caleb Brandt
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> About Me:
>>> >> >> I'm a hobbyist programmer and Fixer of Things: if I see something
>>> wrong that I can fix, I might as well help out. The power of programming
>>> is that if you solve a problem for yourself, you also solve it for every
>>> single person who will ever live, which is why I admire open-source
>>> consortiums such as you guys so greatly. You're everything I wanted to be
>>> when I grew up, and I'm applying because you still represent the hallmark
>>> of what good coding is to me: helping people do stuff better, just because
>>> you can.
>>> >> >>
>>> >> >> I'm finishing up my Bachelor's degree in Computer Science at the
>>> University of Central Florida, and in my off-time I make compatibility mods
>>> for Minecraft: optimizing interactions between other mods using Mixin (a
>>> framework for ASM), reflectively exposing new APIs in mods for other
>>> developers to use, bytecode-patching bugs in abandoned libraries, and
>>> anything else I can do to make the ecosystem a bit better than how I found
>>> it. I also attempt to fix any issues I encounter in open-source software;
>>> I already spent the time tracking it down, I might as well take one more
>>> step and fix it for everyone too. I just like to make helpful things, and I
>>> >> >>
>>>
>>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Caleb Brandt <ca...@gmail.com>.
Well, maybe Groovy did get a better static analyzer, but I sure haven't
seen it. Marketing is the other biggest thing, and my (and the entire
Minecraft community's) poor experience with Gradle makes me cringe at the
idea of using Groovy for a larger project, even if it's actually really
well made.
So yeah, Groovy absolutely has everything I'm talking about, but I want
*Java* to have it too. It seems like it would be pretty straightforward to
do so, so do you think it's as feasible as I'd imagine it to be?
On Sun, Mar 24, 2024 at 7:16 PM Caleb Brandt <ca...@gmail.com>
wrote:
> Oh absolutely, but the impression I and a lot of other users who aren't
> familiar with Groovy got was unfortunately fairly far from that. Lack of
> first-class static analysis, Gradle being... not the *best*
> representation let's say, and the aggressive use of closures make it feel
> like it's a much more complicated language than it is.
>
> The biggest problem is the *STATIC ANALYSIS*, though. If you can't use
> the high-octane intellisense features, type inference, and code refactoring
> tools you're used to in your home language, you'll bear with the minor
> annoyance of its drawbacks, even though it's really grating after a while.
> As a compiled language, static analysis has to be built from the ground up
> with its compiler in mind, and Groovy unfortunately never received
> first-class support like Kotlin or Scala...
>
> The Java transpilation would completely solve the static analysis problem
> though, as we would easily be compatible with the highest-end static
> analysis tools through the same mechanism that C macros get linted.
>
> On Sun, Mar 24, 2024 at 7:04 PM Paul King <pa...@asert.com.au> wrote:
>
>> One of Groovy's goals is to be simple to learn for Java users, so you
>> can in fact just use the Java syntax that you are familiar with and
>> take on board as many (or as few) Groovy idioms as you feel
>> comfortable with.
>>
>> On Mon, Mar 25, 2024 at 8:27 AM Caleb Brandt <ca...@gmail.com>
>> wrote:
>> >
>> > Thank you so much for the reply, Paul!
>> >
>> > And you're absolutely right: Groovy does give you all of those things,
>> as do Kotlin and Scala. The issue I'm trying to solve isn't one of "not
>> enough features in other languages", but one of "too many features". For
>> example, Kotlin has every single one of the features I mentioned, but the
>> amount of changes makes the jump from Java a steep one.
>> >
>> > Similarly, Groovy is extremely intimidating to long-time Java
>> developers because of the sheer amount that it changes. While it's
>> certainly the closest of the non-Java JVM languages to Java, it still has
>> entirely new syntax, new libraries, new standards, and many things that
>> don't have a direct Java analogue due to the bytecode tricks used.
>> >
>> > The whole point of this is to essentially "trickle down" some of those
>> advanced JVM-language features to pure Java, so people can use some of
>> these quality-of-life features without needing to learn a whole new
>> language to use them. A dialect, if you will.
>> >
>> > On Sun, Mar 24, 2024 at 6:09 PM Paul King <pa...@asert.com.au> wrote:
>> >>
>> >> Hi Caleb, what you are describing as your desired goal sounds alot
>> >> like Groovy to me. Can you elaborate on anything that you desire that
>> >> Groovy doesn't already give you?
>> >>
>> >> Thanks, Paul.
>> >>
>> >> On Mon, Mar 25, 2024 at 1:58 AM Caleb Brandt <ca...@gmail.com>
>> wrote:
>> >> >
>> >> > I..... forgot to subscribe to this list first. :/ Please prune the
>> duplicate that's under moderation.
>> >> >
>> >> > Also, if this isn't the right place for this, please tell me where I
>> should send it. I don't want to come barging in ignoring the way you guys
>> do things. I'm just really excited to possibly work with you guys.
>> >> >
>> >> >
>> >> > On Sun, Mar 24, 2024, 10:38 AM Caleb Brandt <ca...@gmail.com>
>> wrote:
>> >> >>
>> >> >> Hi all,
>> >> >>
>> >> >> I wanted to submit a new idea for this summer's GSoC. You should
>> stick around, because I trust you'll find this as interesting as I do.
>> >> >>
>> >> >>
>> >> >> Motivation:
>> >> >>
>> >> >> I know you made Groovy, but if you're anything like me, you love
>> Java.
>> >> >>
>> >> >> I mean, how could you not: Java is unparalleled when it comes to
>> readability and structure while still being powerful. You can track data
>> flow through a program at a glance, there are a thousand easy-to-use and
>> intuitive libraries, and - as much as I love C++ - there aren't any
>> ambiguous operators, syntax that's only valid in one specific place, or
>> random macro usage in the main library functions. You know exactly what
>> something does just by looking at it, and that's still such a breath of
>> fresh air even in the modern programming space. These new languages try to
>> be as concise as possible for writing, but they sometimes forget that
>> people have to read the dang thing too, am I right?
>> >> >>
>> >> >> But... Java can also be a bit too verbose at times, can't it? We
>> only recently got a concise syntax for POJOs in the form of Records, and
>> they come with their own set of stipulations that make using them somewhat
>> niche. And that's not to mention the continued waiting for destructuring
>> declarations, the getters and setters left floating around in the class,
>> the endless if-elseif trees checking the same value against different
>> things that make it so hard to track... There are a few areas of
>> improvement; let's say that.
>> >> >>
>> >> >> Languages like Scala and Kotlin try to remedy this, but they end up
>> with their own problems like enforced programming models, completely
>> overhauled libraries that lose the intuitiveness of Java's, and just the
>> overall learning curve of being a completely different language. Same thing
>> with Groovy to a lesser extent: these languages are powerful, but they lose
>> the familiarity that comes with Java.
>> >> >>
>> >> >> What we need is the ability to just... add some stuff to Java,
>> without making people learn a whole new language to use it.
>> >> >>
>> >> >>
>> >> >>
>> >> >> So what if we did?
>> >> >>
>> >> >> Proposal: Add Some Stuff To Java
>> >> >>
>> >> >> Essentially, the plan is to make a set of
>> syntactically-sugary-delicious constructs that transpile to plain ol' Java
>> 8 source code, similar to how TypeScript's advanced features still compile
>> to ECMA2016.
>> >> >>
>> >> >> The core principles are zero overhead and improved readability;
>> this isn't remaking the wheel and constructing new libraries, this is just
>> adding shorthand for ubiquitous and consistent features that we wish we
>> could have saved time doing by hand. It's gotta feel like you're just
>> using a version of Java from the near future: no syntax weirdness, just
>> some extra intuitive constructs so it's easier both to write and to read.
>> >> >>
>> >> >> Things like:
>> >> >>
>> >> >> Getters and setters being part of the variable declaration, and
>> being called via the property name itself;
>> >> >> If/else-if trees that check the same variable against different
>> things being allowed to be in the form of a `switchif` statement, similar
>> to Kotlin's sequential switch statements;
>> >> >> Python-style "group imports" to save space and local renaming for
>> imported functions and classes, so people can still give their items
>> descriptive names without being forced to type the whole thing out every
>> single time they want to use it;
>> >> >> Kotlin-style `with` blocks for the convenience and readability of
>> "chaining" when chaining isn't an option;
>> >> >> The `as` keyword so you aren't forced to relearn lisp every time
>> you need to cast something multiple times;
>> >> >> Destructuring declarations using annotations instead of waiting for
>> pattern matching to come through
>> >> >> Operator overloading so we can do things like "accessing lists
>> through brackets" and "doing boolean algebra in a readable manner", again
>> declared using annotations so method names remain informative instead of
>> letting developers hide actual behavior inside a non-descriptive function
>> name;
>> >> >> Extension functions for grouping utility methods with the classes
>> that use them; and
>> >> >> All syntactic sugar added since Java 8, now available for those of
>> us living in the past (and also a lot of the world, because they don't even
>> make a JRE for the latest version anymore) to use freely too.
>> >> >>
>> >> >>
>> >> >> This would be accomplished using a Gradle plugin as a preprocessor,
>> converting any J+ constructs to their Java 8 counterparts and then sending
>> the new source off to javac to be compiled, eliminating the need for
>> brittle ASM invocations to hook into the compiler directly, while still
>> having relatively-low added runtime. For the most part it would be simple
>> regex find-and-replace, avoiding any bytecode generation on purpose so the
>> end user can see exactly what their code is ending up as.
>> >> >>
>> >> >> If possible, I'd like to also add the ability to apply the
>> annotation-based parts - operators and destructuring - to preexisting
>> libraries too, using what's essentially a ".d.ts" file but for Java. This
>> would allow the convenience factor for advanced users without requiring it
>> of newer ones, but it's likely out of scope for this project.
>> >> >>
>> >> >>
>> >> >> To be honest, I'm just tired of having to keep track of my getters
>> and setters. If I can replace this:
>> >> >>>
>> >> >>> private String foo = "bar;
>> >> >>>
>> >> >>> public String getFoo() {
>> >> >>>
>> >> >>> return this.foo;
>> >> >>>
>> >> >>> }
>> >> >>>
>> >> >>> public void setFoo(String newVal) {
>> >> >>>
>> >> >>> this.foo = newVal;
>> >> >>>
>> >> >>> doOtherThing();
>> >> >>>
>> >> >>> }
>> >> >>
>> >> >>
>> >> >> with this:
>> >> >>>
>> >> >>> String foo = "bar";
>> >> >>>
>> >> >>> get() {
>> >> >>> return foo;
>> >> >>> }
>> >> >>>
>> >> >>> set(newVal) {
>> >> >>> foo = newVal;
>> >> >>> doOtherThing();
>> >> >>> }
>> >> >>
>> >> >> while still being able to use my precious Java syntax? And all it
>> takes is banging my head against some regex for a couple hundred hours?
>> That sounds like a fair trade to me.
>> >> >>
>> >> >> I have a full plan formulated with a finalized process for every
>> step, but this is a "brief" overview of it. For the most part, I just
>> desperately need the input of people who are experienced with this area.
>> Even if you don't like this for GSoC, I would still love to chat about it
>> in the future, because I think it will make Java just a little bit better
>> for everyone.
>> >> >>
>> >> >>
>> >> >>
>> >> >> So, what do you think? Does this sound like a good proposal idea?
>> Let me know your thoughts in the replies; I look forward to your feedback,
>> and I happily await this being torn apart by people more knowledgeable in
>> the field than I.
>> >> >>
>> >> >>
>> >> >> Thank you so much for your time,
>> >> >>
>> >> >> Caleb Brandt
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> About Me:
>> >> >> I'm a hobbyist programmer and Fixer of Things: if I see something
>> wrong that I can fix, I might as well help out. The power of programming
>> is that if you solve a problem for yourself, you also solve it for every
>> single person who will ever live, which is why I admire open-source
>> consortiums such as you guys so greatly. You're everything I wanted to be
>> when I grew up, and I'm applying because you still represent the hallmark
>> of what good coding is to me: helping people do stuff better, just because
>> you can.
>> >> >>
>> >> >> I'm finishing up my Bachelor's degree in Computer Science at the
>> University of Central Florida, and in my off-time I make compatibility mods
>> for Minecraft: optimizing interactions between other mods using Mixin (a
>> framework for ASM), reflectively exposing new APIs in mods for other
>> developers to use, bytecode-patching bugs in abandoned libraries, and
>> anything else I can do to make the ecosystem a bit better than how I found
>> it. I also attempt to fix any issues I encounter in open-source software;
>> I already spent the time tracking it down, I might as well take one more
>> step and fix it for everyone too. I just like to make helpful things, and I
>> >> >>
>>
>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Caleb Brandt <ca...@gmail.com>.
Oh absolutely, but the impression I and a lot of other users who aren't
familiar with Groovy got was unfortunately fairly far from that. Lack of
first-class static analysis, Gradle being... not the *best* representation
let's say, and the aggressive use of closures make it feel like it's a much
more complicated language than it is.
The biggest problem is the *STATIC ANALYSIS*, though. If you can't use the
high-octane intellisense features, type inference, and code refactoring
tools you're used to in your home language, you'll bear with the minor
annoyance of its drawbacks, even though it's really grating after a while.
As a compiled language, static analysis has to be built from the ground up
with its compiler in mind, and Groovy unfortunately never received
first-class support like Kotlin or Scala...
The Java transpilation would completely solve the static analysis problem
though, as we would easily be compatible with the highest-end static
analysis tools through the same mechanism that C macros get linted.
On Sun, Mar 24, 2024 at 7:04 PM Paul King <pa...@asert.com.au> wrote:
> One of Groovy's goals is to be simple to learn for Java users, so you
> can in fact just use the Java syntax that you are familiar with and
> take on board as many (or as few) Groovy idioms as you feel
> comfortable with.
>
> On Mon, Mar 25, 2024 at 8:27 AM Caleb Brandt <ca...@gmail.com>
> wrote:
> >
> > Thank you so much for the reply, Paul!
> >
> > And you're absolutely right: Groovy does give you all of those things,
> as do Kotlin and Scala. The issue I'm trying to solve isn't one of "not
> enough features in other languages", but one of "too many features". For
> example, Kotlin has every single one of the features I mentioned, but the
> amount of changes makes the jump from Java a steep one.
> >
> > Similarly, Groovy is extremely intimidating to long-time Java developers
> because of the sheer amount that it changes. While it's certainly the
> closest of the non-Java JVM languages to Java, it still has entirely new
> syntax, new libraries, new standards, and many things that don't have a
> direct Java analogue due to the bytecode tricks used.
> >
> > The whole point of this is to essentially "trickle down" some of those
> advanced JVM-language features to pure Java, so people can use some of
> these quality-of-life features without needing to learn a whole new
> language to use them. A dialect, if you will.
> >
> > On Sun, Mar 24, 2024 at 6:09 PM Paul King <pa...@asert.com.au> wrote:
> >>
> >> Hi Caleb, what you are describing as your desired goal sounds alot
> >> like Groovy to me. Can you elaborate on anything that you desire that
> >> Groovy doesn't already give you?
> >>
> >> Thanks, Paul.
> >>
> >> On Mon, Mar 25, 2024 at 1:58 AM Caleb Brandt <ca...@gmail.com>
> wrote:
> >> >
> >> > I..... forgot to subscribe to this list first. :/ Please prune the
> duplicate that's under moderation.
> >> >
> >> > Also, if this isn't the right place for this, please tell me where I
> should send it. I don't want to come barging in ignoring the way you guys
> do things. I'm just really excited to possibly work with you guys.
> >> >
> >> >
> >> > On Sun, Mar 24, 2024, 10:38 AM Caleb Brandt <ca...@gmail.com>
> wrote:
> >> >>
> >> >> Hi all,
> >> >>
> >> >> I wanted to submit a new idea for this summer's GSoC. You should
> stick around, because I trust you'll find this as interesting as I do.
> >> >>
> >> >>
> >> >> Motivation:
> >> >>
> >> >> I know you made Groovy, but if you're anything like me, you love
> Java.
> >> >>
> >> >> I mean, how could you not: Java is unparalleled when it comes to
> readability and structure while still being powerful. You can track data
> flow through a program at a glance, there are a thousand easy-to-use and
> intuitive libraries, and - as much as I love C++ - there aren't any
> ambiguous operators, syntax that's only valid in one specific place, or
> random macro usage in the main library functions. You know exactly what
> something does just by looking at it, and that's still such a breath of
> fresh air even in the modern programming space. These new languages try to
> be as concise as possible for writing, but they sometimes forget that
> people have to read the dang thing too, am I right?
> >> >>
> >> >> But... Java can also be a bit too verbose at times, can't it? We
> only recently got a concise syntax for POJOs in the form of Records, and
> they come with their own set of stipulations that make using them somewhat
> niche. And that's not to mention the continued waiting for destructuring
> declarations, the getters and setters left floating around in the class,
> the endless if-elseif trees checking the same value against different
> things that make it so hard to track... There are a few areas of
> improvement; let's say that.
> >> >>
> >> >> Languages like Scala and Kotlin try to remedy this, but they end up
> with their own problems like enforced programming models, completely
> overhauled libraries that lose the intuitiveness of Java's, and just the
> overall learning curve of being a completely different language. Same thing
> with Groovy to a lesser extent: these languages are powerful, but they lose
> the familiarity that comes with Java.
> >> >>
> >> >> What we need is the ability to just... add some stuff to Java,
> without making people learn a whole new language to use it.
> >> >>
> >> >>
> >> >>
> >> >> So what if we did?
> >> >>
> >> >> Proposal: Add Some Stuff To Java
> >> >>
> >> >> Essentially, the plan is to make a set of
> syntactically-sugary-delicious constructs that transpile to plain ol' Java
> 8 source code, similar to how TypeScript's advanced features still compile
> to ECMA2016.
> >> >>
> >> >> The core principles are zero overhead and improved readability; this
> isn't remaking the wheel and constructing new libraries, this is just
> adding shorthand for ubiquitous and consistent features that we wish we
> could have saved time doing by hand. It's gotta feel like you're just
> using a version of Java from the near future: no syntax weirdness, just
> some extra intuitive constructs so it's easier both to write and to read.
> >> >>
> >> >> Things like:
> >> >>
> >> >> Getters and setters being part of the variable declaration, and
> being called via the property name itself;
> >> >> If/else-if trees that check the same variable against different
> things being allowed to be in the form of a `switchif` statement, similar
> to Kotlin's sequential switch statements;
> >> >> Python-style "group imports" to save space and local renaming for
> imported functions and classes, so people can still give their items
> descriptive names without being forced to type the whole thing out every
> single time they want to use it;
> >> >> Kotlin-style `with` blocks for the convenience and readability of
> "chaining" when chaining isn't an option;
> >> >> The `as` keyword so you aren't forced to relearn lisp every time you
> need to cast something multiple times;
> >> >> Destructuring declarations using annotations instead of waiting for
> pattern matching to come through
> >> >> Operator overloading so we can do things like "accessing lists
> through brackets" and "doing boolean algebra in a readable manner", again
> declared using annotations so method names remain informative instead of
> letting developers hide actual behavior inside a non-descriptive function
> name;
> >> >> Extension functions for grouping utility methods with the classes
> that use them; and
> >> >> All syntactic sugar added since Java 8, now available for those of
> us living in the past (and also a lot of the world, because they don't even
> make a JRE for the latest version anymore) to use freely too.
> >> >>
> >> >>
> >> >> This would be accomplished using a Gradle plugin as a preprocessor,
> converting any J+ constructs to their Java 8 counterparts and then sending
> the new source off to javac to be compiled, eliminating the need for
> brittle ASM invocations to hook into the compiler directly, while still
> having relatively-low added runtime. For the most part it would be simple
> regex find-and-replace, avoiding any bytecode generation on purpose so the
> end user can see exactly what their code is ending up as.
> >> >>
> >> >> If possible, I'd like to also add the ability to apply the
> annotation-based parts - operators and destructuring - to preexisting
> libraries too, using what's essentially a ".d.ts" file but for Java. This
> would allow the convenience factor for advanced users without requiring it
> of newer ones, but it's likely out of scope for this project.
> >> >>
> >> >>
> >> >> To be honest, I'm just tired of having to keep track of my getters
> and setters. If I can replace this:
> >> >>>
> >> >>> private String foo = "bar;
> >> >>>
> >> >>> public String getFoo() {
> >> >>>
> >> >>> return this.foo;
> >> >>>
> >> >>> }
> >> >>>
> >> >>> public void setFoo(String newVal) {
> >> >>>
> >> >>> this.foo = newVal;
> >> >>>
> >> >>> doOtherThing();
> >> >>>
> >> >>> }
> >> >>
> >> >>
> >> >> with this:
> >> >>>
> >> >>> String foo = "bar";
> >> >>>
> >> >>> get() {
> >> >>> return foo;
> >> >>> }
> >> >>>
> >> >>> set(newVal) {
> >> >>> foo = newVal;
> >> >>> doOtherThing();
> >> >>> }
> >> >>
> >> >> while still being able to use my precious Java syntax? And all it
> takes is banging my head against some regex for a couple hundred hours?
> That sounds like a fair trade to me.
> >> >>
> >> >> I have a full plan formulated with a finalized process for every
> step, but this is a "brief" overview of it. For the most part, I just
> desperately need the input of people who are experienced with this area.
> Even if you don't like this for GSoC, I would still love to chat about it
> in the future, because I think it will make Java just a little bit better
> for everyone.
> >> >>
> >> >>
> >> >>
> >> >> So, what do you think? Does this sound like a good proposal idea?
> Let me know your thoughts in the replies; I look forward to your feedback,
> and I happily await this being torn apart by people more knowledgeable in
> the field than I.
> >> >>
> >> >>
> >> >> Thank you so much for your time,
> >> >>
> >> >> Caleb Brandt
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> About Me:
> >> >> I'm a hobbyist programmer and Fixer of Things: if I see something
> wrong that I can fix, I might as well help out. The power of programming
> is that if you solve a problem for yourself, you also solve it for every
> single person who will ever live, which is why I admire open-source
> consortiums such as you guys so greatly. You're everything I wanted to be
> when I grew up, and I'm applying because you still represent the hallmark
> of what good coding is to me: helping people do stuff better, just because
> you can.
> >> >>
> >> >> I'm finishing up my Bachelor's degree in Computer Science at the
> University of Central Florida, and in my off-time I make compatibility mods
> for Minecraft: optimizing interactions between other mods using Mixin (a
> framework for ASM), reflectively exposing new APIs in mods for other
> developers to use, bytecode-patching bugs in abandoned libraries, and
> anything else I can do to make the ecosystem a bit better than how I found
> it. I also attempt to fix any issues I encounter in open-source software;
> I already spent the time tracking it down, I might as well take one more
> step and fix it for everyone too. I just like to make helpful things, and I
> >> >>
>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Paul King <pa...@asert.com.au>.
One of Groovy's goals is to be simple to learn for Java users, so you
can in fact just use the Java syntax that you are familiar with and
take on board as many (or as few) Groovy idioms as you feel
comfortable with.
On Mon, Mar 25, 2024 at 8:27 AM Caleb Brandt <ca...@gmail.com> wrote:
>
> Thank you so much for the reply, Paul!
>
> And you're absolutely right: Groovy does give you all of those things, as do Kotlin and Scala. The issue I'm trying to solve isn't one of "not enough features in other languages", but one of "too many features". For example, Kotlin has every single one of the features I mentioned, but the amount of changes makes the jump from Java a steep one.
>
> Similarly, Groovy is extremely intimidating to long-time Java developers because of the sheer amount that it changes. While it's certainly the closest of the non-Java JVM languages to Java, it still has entirely new syntax, new libraries, new standards, and many things that don't have a direct Java analogue due to the bytecode tricks used.
>
> The whole point of this is to essentially "trickle down" some of those advanced JVM-language features to pure Java, so people can use some of these quality-of-life features without needing to learn a whole new language to use them. A dialect, if you will.
>
> On Sun, Mar 24, 2024 at 6:09 PM Paul King <pa...@asert.com.au> wrote:
>>
>> Hi Caleb, what you are describing as your desired goal sounds alot
>> like Groovy to me. Can you elaborate on anything that you desire that
>> Groovy doesn't already give you?
>>
>> Thanks, Paul.
>>
>> On Mon, Mar 25, 2024 at 1:58 AM Caleb Brandt <ca...@gmail.com> wrote:
>> >
>> > I..... forgot to subscribe to this list first. :/ Please prune the duplicate that's under moderation.
>> >
>> > Also, if this isn't the right place for this, please tell me where I should send it. I don't want to come barging in ignoring the way you guys do things. I'm just really excited to possibly work with you guys.
>> >
>> >
>> > On Sun, Mar 24, 2024, 10:38 AM Caleb Brandt <ca...@gmail.com> wrote:
>> >>
>> >> Hi all,
>> >>
>> >> I wanted to submit a new idea for this summer's GSoC. You should stick around, because I trust you'll find this as interesting as I do.
>> >>
>> >>
>> >> Motivation:
>> >>
>> >> I know you made Groovy, but if you're anything like me, you love Java.
>> >>
>> >> I mean, how could you not: Java is unparalleled when it comes to readability and structure while still being powerful. You can track data flow through a program at a glance, there are a thousand easy-to-use and intuitive libraries, and - as much as I love C++ - there aren't any ambiguous operators, syntax that's only valid in one specific place, or random macro usage in the main library functions. You know exactly what something does just by looking at it, and that's still such a breath of fresh air even in the modern programming space. These new languages try to be as concise as possible for writing, but they sometimes forget that people have to read the dang thing too, am I right?
>> >>
>> >> But... Java can also be a bit too verbose at times, can't it? We only recently got a concise syntax for POJOs in the form of Records, and they come with their own set of stipulations that make using them somewhat niche. And that's not to mention the continued waiting for destructuring declarations, the getters and setters left floating around in the class, the endless if-elseif trees checking the same value against different things that make it so hard to track... There are a few areas of improvement; let's say that.
>> >>
>> >> Languages like Scala and Kotlin try to remedy this, but they end up with their own problems like enforced programming models, completely overhauled libraries that lose the intuitiveness of Java's, and just the overall learning curve of being a completely different language. Same thing with Groovy to a lesser extent: these languages are powerful, but they lose the familiarity that comes with Java.
>> >>
>> >> What we need is the ability to just... add some stuff to Java, without making people learn a whole new language to use it.
>> >>
>> >>
>> >>
>> >> So what if we did?
>> >>
>> >> Proposal: Add Some Stuff To Java
>> >>
>> >> Essentially, the plan is to make a set of syntactically-sugary-delicious constructs that transpile to plain ol' Java 8 source code, similar to how TypeScript's advanced features still compile to ECMA2016.
>> >>
>> >> The core principles are zero overhead and improved readability; this isn't remaking the wheel and constructing new libraries, this is just adding shorthand for ubiquitous and consistent features that we wish we could have saved time doing by hand. It's gotta feel like you're just using a version of Java from the near future: no syntax weirdness, just some extra intuitive constructs so it's easier both to write and to read.
>> >>
>> >> Things like:
>> >>
>> >> Getters and setters being part of the variable declaration, and being called via the property name itself;
>> >> If/else-if trees that check the same variable against different things being allowed to be in the form of a `switchif` statement, similar to Kotlin's sequential switch statements;
>> >> Python-style "group imports" to save space and local renaming for imported functions and classes, so people can still give their items descriptive names without being forced to type the whole thing out every single time they want to use it;
>> >> Kotlin-style `with` blocks for the convenience and readability of "chaining" when chaining isn't an option;
>> >> The `as` keyword so you aren't forced to relearn lisp every time you need to cast something multiple times;
>> >> Destructuring declarations using annotations instead of waiting for pattern matching to come through
>> >> Operator overloading so we can do things like "accessing lists through brackets" and "doing boolean algebra in a readable manner", again declared using annotations so method names remain informative instead of letting developers hide actual behavior inside a non-descriptive function name;
>> >> Extension functions for grouping utility methods with the classes that use them; and
>> >> All syntactic sugar added since Java 8, now available for those of us living in the past (and also a lot of the world, because they don't even make a JRE for the latest version anymore) to use freely too.
>> >>
>> >>
>> >> This would be accomplished using a Gradle plugin as a preprocessor, converting any J+ constructs to their Java 8 counterparts and then sending the new source off to javac to be compiled, eliminating the need for brittle ASM invocations to hook into the compiler directly, while still having relatively-low added runtime. For the most part it would be simple regex find-and-replace, avoiding any bytecode generation on purpose so the end user can see exactly what their code is ending up as.
>> >>
>> >> If possible, I'd like to also add the ability to apply the annotation-based parts - operators and destructuring - to preexisting libraries too, using what's essentially a ".d.ts" file but for Java. This would allow the convenience factor for advanced users without requiring it of newer ones, but it's likely out of scope for this project.
>> >>
>> >>
>> >> To be honest, I'm just tired of having to keep track of my getters and setters. If I can replace this:
>> >>>
>> >>> private String foo = "bar;
>> >>>
>> >>> public String getFoo() {
>> >>>
>> >>> return this.foo;
>> >>>
>> >>> }
>> >>>
>> >>> public void setFoo(String newVal) {
>> >>>
>> >>> this.foo = newVal;
>> >>>
>> >>> doOtherThing();
>> >>>
>> >>> }
>> >>
>> >>
>> >> with this:
>> >>>
>> >>> String foo = "bar";
>> >>>
>> >>> get() {
>> >>> return foo;
>> >>> }
>> >>>
>> >>> set(newVal) {
>> >>> foo = newVal;
>> >>> doOtherThing();
>> >>> }
>> >>
>> >> while still being able to use my precious Java syntax? And all it takes is banging my head against some regex for a couple hundred hours? That sounds like a fair trade to me.
>> >>
>> >> I have a full plan formulated with a finalized process for every step, but this is a "brief" overview of it. For the most part, I just desperately need the input of people who are experienced with this area. Even if you don't like this for GSoC, I would still love to chat about it in the future, because I think it will make Java just a little bit better for everyone.
>> >>
>> >>
>> >>
>> >> So, what do you think? Does this sound like a good proposal idea? Let me know your thoughts in the replies; I look forward to your feedback, and I happily await this being torn apart by people more knowledgeable in the field than I.
>> >>
>> >>
>> >> Thank you so much for your time,
>> >>
>> >> Caleb Brandt
>> >>
>> >>
>> >>
>> >>
>> >> About Me:
>> >> I'm a hobbyist programmer and Fixer of Things: if I see something wrong that I can fix, I might as well help out. The power of programming is that if you solve a problem for yourself, you also solve it for every single person who will ever live, which is why I admire open-source consortiums such as you guys so greatly. You're everything I wanted to be when I grew up, and I'm applying because you still represent the hallmark of what good coding is to me: helping people do stuff better, just because you can.
>> >>
>> >> I'm finishing up my Bachelor's degree in Computer Science at the University of Central Florida, and in my off-time I make compatibility mods for Minecraft: optimizing interactions between other mods using Mixin (a framework for ASM), reflectively exposing new APIs in mods for other developers to use, bytecode-patching bugs in abandoned libraries, and anything else I can do to make the ecosystem a bit better than how I found it. I also attempt to fix any issues I encounter in open-source software; I already spent the time tracking it down, I might as well take one more step and fix it for everyone too. I just like to make helpful things, and I
>> >>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Caleb Brandt <ca...@gmail.com>.
Thank you so much for the reply, Paul!
And you're absolutely right: Groovy *does* give you all of those things, as
do Kotlin and Scala. The issue I'm trying to solve isn't one of "not
enough features in other languages", but one of "too *many* features". For
example, Kotlin has *every single one* of the features I mentioned, but the
amount of changes makes the jump from Java a steep one.
Similarly, Groovy is extremely intimidating to long-time Java developers
because of the sheer amount that it changes. While it's certainly the
closest of the non-Java JVM languages to Java, it still has entirely new
syntax, new libraries, new standards, and many things that don't have a
*direct* Java analogue due to the bytecode tricks used.
The whole point of this is to essentially "trickle down" some of those
advanced JVM-language features to *pure Java*, so people can use some of
these quality-of-life features without needing to learn a whole new
language to use them. A *dialect*, if you will.
On Sun, Mar 24, 2024 at 6:09 PM Paul King <pa...@asert.com.au> wrote:
> Hi Caleb, what you are describing as your desired goal sounds alot
> like Groovy to me. Can you elaborate on anything that you desire that
> Groovy doesn't already give you?
>
> Thanks, Paul.
>
> On Mon, Mar 25, 2024 at 1:58 AM Caleb Brandt <ca...@gmail.com>
> wrote:
> >
> > I..... forgot to subscribe to this list first. :/ Please prune the
> duplicate that's under moderation.
> >
> > Also, if this isn't the right place for this, please tell me where I
> should send it. I don't want to come barging in ignoring the way you guys
> do things. I'm just really excited to possibly work with you guys.
> >
> >
> > On Sun, Mar 24, 2024, 10:38 AM Caleb Brandt <ca...@gmail.com>
> wrote:
> >>
> >> Hi all,
> >>
> >> I wanted to submit a new idea for this summer's GSoC. You should stick
> around, because I trust you'll find this as interesting as I do.
> >>
> >>
> >> Motivation:
> >>
> >> I know you made Groovy, but if you're anything like me, you love Java.
> >>
> >> I mean, how could you not: Java is unparalleled when it comes to
> readability and structure while still being powerful. You can track data
> flow through a program at a glance, there are a thousand easy-to-use and
> intuitive libraries, and - as much as I love C++ - there aren't any
> ambiguous operators, syntax that's only valid in one specific place, or
> random macro usage in the main library functions. You know exactly what
> something does just by looking at it, and that's still such a breath of
> fresh air even in the modern programming space. These new languages try to
> be as concise as possible for writing, but they sometimes forget that
> people have to read the dang thing too, am I right?
> >>
> >> But... Java can also be a bit too verbose at times, can't it? We only
> recently got a concise syntax for POJOs in the form of Records, and they
> come with their own set of stipulations that make using them somewhat
> niche. And that's not to mention the continued waiting for destructuring
> declarations, the getters and setters left floating around in the class,
> the endless if-elseif trees checking the same value against different
> things that make it so hard to track... There are a few areas of
> improvement; let's say that.
> >>
> >> Languages like Scala and Kotlin try to remedy this, but they end up
> with their own problems like enforced programming models, completely
> overhauled libraries that lose the intuitiveness of Java's, and just the
> overall learning curve of being a completely different language. Same thing
> with Groovy to a lesser extent: these languages are powerful, but they lose
> the familiarity that comes with Java.
> >>
> >> What we need is the ability to just... add some stuff to Java, without
> making people learn a whole new language to use it.
> >>
> >>
> >>
> >> So what if we did?
> >>
> >> Proposal: Add Some Stuff To Java
> >>
> >> Essentially, the plan is to make a set of
> syntactically-sugary-delicious constructs that transpile to plain ol' Java
> 8 source code, similar to how TypeScript's advanced features still compile
> to ECMA2016.
> >>
> >> The core principles are zero overhead and improved readability; this
> isn't remaking the wheel and constructing new libraries, this is just
> adding shorthand for ubiquitous and consistent features that we wish we
> could have saved time doing by hand. It's gotta feel like you're just
> using a version of Java from the near future: no syntax weirdness, just
> some extra intuitive constructs so it's easier both to write and to read.
> >>
> >> Things like:
> >>
> >> Getters and setters being part of the variable declaration, and being
> called via the property name itself;
> >> If/else-if trees that check the same variable against different things
> being allowed to be in the form of a `switchif` statement, similar to
> Kotlin's sequential switch statements;
> >> Python-style "group imports" to save space and local renaming for
> imported functions and classes, so people can still give their items
> descriptive names without being forced to type the whole thing out every
> single time they want to use it;
> >> Kotlin-style `with` blocks for the convenience and readability of
> "chaining" when chaining isn't an option;
> >> The `as` keyword so you aren't forced to relearn lisp every time you
> need to cast something multiple times;
> >> Destructuring declarations using annotations instead of waiting for
> pattern matching to come through
> >> Operator overloading so we can do things like "accessing lists through
> brackets" and "doing boolean algebra in a readable manner", again declared
> using annotations so method names remain informative instead of letting
> developers hide actual behavior inside a non-descriptive function name;
> >> Extension functions for grouping utility methods with the classes that
> use them; and
> >> All syntactic sugar added since Java 8, now available for those of us
> living in the past (and also a lot of the world, because they don't even
> make a JRE for the latest version anymore) to use freely too.
> >>
> >>
> >> This would be accomplished using a Gradle plugin as a preprocessor,
> converting any J+ constructs to their Java 8 counterparts and then sending
> the new source off to javac to be compiled, eliminating the need for
> brittle ASM invocations to hook into the compiler directly, while still
> having relatively-low added runtime. For the most part it would be simple
> regex find-and-replace, avoiding any bytecode generation on purpose so the
> end user can see exactly what their code is ending up as.
> >>
> >> If possible, I'd like to also add the ability to apply the
> annotation-based parts - operators and destructuring - to preexisting
> libraries too, using what's essentially a ".d.ts" file but for Java. This
> would allow the convenience factor for advanced users without requiring it
> of newer ones, but it's likely out of scope for this project.
> >>
> >>
> >> To be honest, I'm just tired of having to keep track of my getters and
> setters. If I can replace this:
> >>>
> >>> private String foo = "bar;
> >>>
> >>> public String getFoo() {
> >>>
> >>> return this.foo;
> >>>
> >>> }
> >>>
> >>> public void setFoo(String newVal) {
> >>>
> >>> this.foo = newVal;
> >>>
> >>> doOtherThing();
> >>>
> >>> }
> >>
> >>
> >> with this:
> >>>
> >>> String foo = "bar";
> >>>
> >>> get() {
> >>> return foo;
> >>> }
> >>>
> >>> set(newVal) {
> >>> foo = newVal;
> >>> doOtherThing();
> >>> }
> >>
> >> while still being able to use my precious Java syntax? And all it
> takes is banging my head against some regex for a couple hundred hours?
> That sounds like a fair trade to me.
> >>
> >> I have a full plan formulated with a finalized process for every step,
> but this is a "brief" overview of it. For the most part, I just
> desperately need the input of people who are experienced with this area.
> Even if you don't like this for GSoC, I would still love to chat about it
> in the future, because I think it will make Java just a little bit better
> for everyone.
> >>
> >>
> >>
> >> So, what do you think? Does this sound like a good proposal idea? Let
> me know your thoughts in the replies; I look forward to your feedback, and
> I happily await this being torn apart by people more knowledgeable in the
> field than I.
> >>
> >>
> >> Thank you so much for your time,
> >>
> >> Caleb Brandt
> >>
> >>
> >>
> >>
> >> About Me:
> >> I'm a hobbyist programmer and Fixer of Things: if I see something wrong
> that I can fix, I might as well help out. The power of programming is that
> if you solve a problem for yourself, you also solve it for every single
> person who will ever live, which is why I admire open-source consortiums
> such as you guys so greatly. You're everything I wanted to be when I grew
> up, and I'm applying because you still represent the hallmark of what good
> coding is to me: helping people do stuff better, just because you can.
> >>
> >> I'm finishing up my Bachelor's degree in Computer Science at the
> University of Central Florida, and in my off-time I make compatibility mods
> for Minecraft: optimizing interactions between other mods using Mixin (a
> framework for ASM), reflectively exposing new APIs in mods for other
> developers to use, bytecode-patching bugs in abandoned libraries, and
> anything else I can do to make the ecosystem a bit better than how I found
> it. I also attempt to fix any issues I encounter in open-source software;
> I already spent the time tracking it down, I might as well take one more
> step and fix it for everyone too. I just like to make helpful things, and I
> >>
>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Caleb Brandt <ca...@gmail.com>.
Oh, uh, read the "reply" on the original post. That's where the actual
proposal is.
...maybe I should just resend it.
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Caleb Brandt <ca...@gmail.com>.
Sam,
That is... amazing. I wish I'd known that existed, it seems really useful.
But that's kind of the kicker, isn't it? People don't really know it
exists. In the same vein, we've actually had access to Java 21 syntax for
half a decade now with the "jabel" plugin for Gradle, but even as someone
who works with Java professionally on a day-to-day basis, I only learned
about it a few months ago.
My ideal is that something supported by probably the most influential Java
library contributor next to Google would be able to reach - and therefore
help - a lot more people. As well, by being as *simple and bare-bones* as
possible - confidently acting as an *addon* to Java rather than a new
language - it makes it much more approachable for users who wouldn't
otherwise want to pick up a new language.
On Sun, Mar 24, 2024 at 6:25 PM Sammy Sam <be...@gmail.com> wrote:
> Hi Caleb,
> If I may add my humble opinion, it also looks a lot like the 'xtend
> programming language', which is less used than Groovy.
>
> Best
> Sam Moulem
>
> On Sun, 24 Mar 2024 at 22:09, Paul King <pa...@asert.com.au> wrote:
>
>> Hi Caleb, what you are describing as your desired goal sounds alot
>> like Groovy to me. Can you elaborate on anything that you desire that
>> Groovy doesn't already give you?
>>
>> Thanks, Paul.
>>
>> On Mon, Mar 25, 2024 at 1:58 AM Caleb Brandt <ca...@gmail.com>
>> wrote:
>> >
>> > I..... forgot to subscribe to this list first. :/ Please prune the
>> duplicate that's under moderation.
>> >
>> > Also, if this isn't the right place for this, please tell me where I
>> should send it. I don't want to come barging in ignoring the way you guys
>> do things. I'm just really excited to possibly work with you guys.
>> >
>> >
>> > On Sun, Mar 24, 2024, 10:38 AM Caleb Brandt <ca...@gmail.com>
>> wrote:
>> >>
>> >> Hi all,
>> >>
>> >> I wanted to submit a new idea for this summer's GSoC. You should
>> stick around, because I trust you'll find this as interesting as I do.
>> >>
>> >>
>> >> Motivation:
>> >>
>> >> I know you made Groovy, but if you're anything like me, you love Java.
>> >>
>> >> I mean, how could you not: Java is unparalleled when it comes to
>> readability and structure while still being powerful. You can track data
>> flow through a program at a glance, there are a thousand easy-to-use and
>> intuitive libraries, and - as much as I love C++ - there aren't any
>> ambiguous operators, syntax that's only valid in one specific place, or
>> random macro usage in the main library functions. You know exactly what
>> something does just by looking at it, and that's still such a breath of
>> fresh air even in the modern programming space. These new languages try to
>> be as concise as possible for writing, but they sometimes forget that
>> people have to read the dang thing too, am I right?
>> >>
>> >> But... Java can also be a bit too verbose at times, can't it? We only
>> recently got a concise syntax for POJOs in the form of Records, and they
>> come with their own set of stipulations that make using them somewhat
>> niche. And that's not to mention the continued waiting for destructuring
>> declarations, the getters and setters left floating around in the class,
>> the endless if-elseif trees checking the same value against different
>> things that make it so hard to track... There are a few areas of
>> improvement; let's say that.
>> >>
>> >> Languages like Scala and Kotlin try to remedy this, but they end up
>> with their own problems like enforced programming models, completely
>> overhauled libraries that lose the intuitiveness of Java's, and just the
>> overall learning curve of being a completely different language. Same thing
>> with Groovy to a lesser extent: these languages are powerful, but they lose
>> the familiarity that comes with Java.
>> >>
>> >> What we need is the ability to just... add some stuff to Java, without
>> making people learn a whole new language to use it.
>> >>
>> >>
>> >>
>> >> So what if we did?
>> >>
>> >> Proposal: Add Some Stuff To Java
>> >>
>> >> Essentially, the plan is to make a set of
>> syntactically-sugary-delicious constructs that transpile to plain ol' Java
>> 8 source code, similar to how TypeScript's advanced features still compile
>> to ECMA2016.
>> >>
>> >> The core principles are zero overhead and improved readability; this
>> isn't remaking the wheel and constructing new libraries, this is just
>> adding shorthand for ubiquitous and consistent features that we wish we
>> could have saved time doing by hand. It's gotta feel like you're just
>> using a version of Java from the near future: no syntax weirdness, just
>> some extra intuitive constructs so it's easier both to write and to read.
>> >>
>> >> Things like:
>> >>
>> >> Getters and setters being part of the variable declaration, and being
>> called via the property name itself;
>> >> If/else-if trees that check the same variable against different things
>> being allowed to be in the form of a `switchif` statement, similar to
>> Kotlin's sequential switch statements;
>> >> Python-style "group imports" to save space and local renaming for
>> imported functions and classes, so people can still give their items
>> descriptive names without being forced to type the whole thing out every
>> single time they want to use it;
>> >> Kotlin-style `with` blocks for the convenience and readability of
>> "chaining" when chaining isn't an option;
>> >> The `as` keyword so you aren't forced to relearn lisp every time you
>> need to cast something multiple times;
>> >> Destructuring declarations using annotations instead of waiting for
>> pattern matching to come through
>> >> Operator overloading so we can do things like "accessing lists through
>> brackets" and "doing boolean algebra in a readable manner", again declared
>> using annotations so method names remain informative instead of letting
>> developers hide actual behavior inside a non-descriptive function name;
>> >> Extension functions for grouping utility methods with the classes that
>> use them; and
>> >> All syntactic sugar added since Java 8, now available for those of us
>> living in the past (and also a lot of the world, because they don't even
>> make a JRE for the latest version anymore) to use freely too.
>> >>
>> >>
>> >> This would be accomplished using a Gradle plugin as a preprocessor,
>> converting any J+ constructs to their Java 8 counterparts and then sending
>> the new source off to javac to be compiled, eliminating the need for
>> brittle ASM invocations to hook into the compiler directly, while still
>> having relatively-low added runtime. For the most part it would be simple
>> regex find-and-replace, avoiding any bytecode generation on purpose so the
>> end user can see exactly what their code is ending up as.
>> >>
>> >> If possible, I'd like to also add the ability to apply the
>> annotation-based parts - operators and destructuring - to preexisting
>> libraries too, using what's essentially a ".d.ts" file but for Java. This
>> would allow the convenience factor for advanced users without requiring it
>> of newer ones, but it's likely out of scope for this project.
>> >>
>> >>
>> >> To be honest, I'm just tired of having to keep track of my getters and
>> setters. If I can replace this:
>> >>>
>> >>> private String foo = "bar;
>> >>>
>> >>> public String getFoo() {
>> >>>
>> >>> return this.foo;
>> >>>
>> >>> }
>> >>>
>> >>> public void setFoo(String newVal) {
>> >>>
>> >>> this.foo = newVal;
>> >>>
>> >>> doOtherThing();
>> >>>
>> >>> }
>> >>
>> >>
>> >> with this:
>> >>>
>> >>> String foo = "bar";
>> >>>
>> >>> get() {
>> >>> return foo;
>> >>> }
>> >>>
>> >>> set(newVal) {
>> >>> foo = newVal;
>> >>> doOtherThing();
>> >>> }
>> >>
>> >> while still being able to use my precious Java syntax? And all it
>> takes is banging my head against some regex for a couple hundred hours?
>> That sounds like a fair trade to me.
>> >>
>> >> I have a full plan formulated with a finalized process for every step,
>> but this is a "brief" overview of it. For the most part, I just
>> desperately need the input of people who are experienced with this area.
>> Even if you don't like this for GSoC, I would still love to chat about it
>> in the future, because I think it will make Java just a little bit better
>> for everyone.
>> >>
>> >>
>> >>
>> >> So, what do you think? Does this sound like a good proposal idea? Let
>> me know your thoughts in the replies; I look forward to your feedback, and
>> I happily await this being torn apart by people more knowledgeable in the
>> field than I.
>> >>
>> >>
>> >> Thank you so much for your time,
>> >>
>> >> Caleb Brandt
>> >>
>> >>
>> >>
>> >>
>> >> About Me:
>> >> I'm a hobbyist programmer and Fixer of Things: if I see something
>> wrong that I can fix, I might as well help out. The power of programming
>> is that if you solve a problem for yourself, you also solve it for every
>> single person who will ever live, which is why I admire open-source
>> consortiums such as you guys so greatly. You're everything I wanted to be
>> when I grew up, and I'm applying because you still represent the hallmark
>> of what good coding is to me: helping people do stuff better, just because
>> you can.
>> >>
>> >> I'm finishing up my Bachelor's degree in Computer Science at the
>> University of Central Florida, and in my off-time I make compatibility mods
>> for Minecraft: optimizing interactions between other mods using Mixin (a
>> framework for ASM), reflectively exposing new APIs in mods for other
>> developers to use, bytecode-patching bugs in abandoned libraries, and
>> anything else I can do to make the ecosystem a bit better than how I found
>> it. I also attempt to fix any issues I encounter in open-source software;
>> I already spent the time tracking it down, I might as well take one more
>> step and fix it for everyone too. I just like to make helpful things, and I
>> >>
>>
>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Sammy Sam <be...@gmail.com>.
Hi Caleb,
If I may add my humble opinion, it also looks a lot like the 'xtend
programming language', which is less used than Groovy.
Best
Sam Moulem
On Sun, 24 Mar 2024 at 22:09, Paul King <pa...@asert.com.au> wrote:
> Hi Caleb, what you are describing as your desired goal sounds alot
> like Groovy to me. Can you elaborate on anything that you desire that
> Groovy doesn't already give you?
>
> Thanks, Paul.
>
> On Mon, Mar 25, 2024 at 1:58 AM Caleb Brandt <ca...@gmail.com>
> wrote:
> >
> > I..... forgot to subscribe to this list first. :/ Please prune the
> duplicate that's under moderation.
> >
> > Also, if this isn't the right place for this, please tell me where I
> should send it. I don't want to come barging in ignoring the way you guys
> do things. I'm just really excited to possibly work with you guys.
> >
> >
> > On Sun, Mar 24, 2024, 10:38 AM Caleb Brandt <ca...@gmail.com>
> wrote:
> >>
> >> Hi all,
> >>
> >> I wanted to submit a new idea for this summer's GSoC. You should stick
> around, because I trust you'll find this as interesting as I do.
> >>
> >>
> >> Motivation:
> >>
> >> I know you made Groovy, but if you're anything like me, you love Java.
> >>
> >> I mean, how could you not: Java is unparalleled when it comes to
> readability and structure while still being powerful. You can track data
> flow through a program at a glance, there are a thousand easy-to-use and
> intuitive libraries, and - as much as I love C++ - there aren't any
> ambiguous operators, syntax that's only valid in one specific place, or
> random macro usage in the main library functions. You know exactly what
> something does just by looking at it, and that's still such a breath of
> fresh air even in the modern programming space. These new languages try to
> be as concise as possible for writing, but they sometimes forget that
> people have to read the dang thing too, am I right?
> >>
> >> But... Java can also be a bit too verbose at times, can't it? We only
> recently got a concise syntax for POJOs in the form of Records, and they
> come with their own set of stipulations that make using them somewhat
> niche. And that's not to mention the continued waiting for destructuring
> declarations, the getters and setters left floating around in the class,
> the endless if-elseif trees checking the same value against different
> things that make it so hard to track... There are a few areas of
> improvement; let's say that.
> >>
> >> Languages like Scala and Kotlin try to remedy this, but they end up
> with their own problems like enforced programming models, completely
> overhauled libraries that lose the intuitiveness of Java's, and just the
> overall learning curve of being a completely different language. Same thing
> with Groovy to a lesser extent: these languages are powerful, but they lose
> the familiarity that comes with Java.
> >>
> >> What we need is the ability to just... add some stuff to Java, without
> making people learn a whole new language to use it.
> >>
> >>
> >>
> >> So what if we did?
> >>
> >> Proposal: Add Some Stuff To Java
> >>
> >> Essentially, the plan is to make a set of
> syntactically-sugary-delicious constructs that transpile to plain ol' Java
> 8 source code, similar to how TypeScript's advanced features still compile
> to ECMA2016.
> >>
> >> The core principles are zero overhead and improved readability; this
> isn't remaking the wheel and constructing new libraries, this is just
> adding shorthand for ubiquitous and consistent features that we wish we
> could have saved time doing by hand. It's gotta feel like you're just
> using a version of Java from the near future: no syntax weirdness, just
> some extra intuitive constructs so it's easier both to write and to read.
> >>
> >> Things like:
> >>
> >> Getters and setters being part of the variable declaration, and being
> called via the property name itself;
> >> If/else-if trees that check the same variable against different things
> being allowed to be in the form of a `switchif` statement, similar to
> Kotlin's sequential switch statements;
> >> Python-style "group imports" to save space and local renaming for
> imported functions and classes, so people can still give their items
> descriptive names without being forced to type the whole thing out every
> single time they want to use it;
> >> Kotlin-style `with` blocks for the convenience and readability of
> "chaining" when chaining isn't an option;
> >> The `as` keyword so you aren't forced to relearn lisp every time you
> need to cast something multiple times;
> >> Destructuring declarations using annotations instead of waiting for
> pattern matching to come through
> >> Operator overloading so we can do things like "accessing lists through
> brackets" and "doing boolean algebra in a readable manner", again declared
> using annotations so method names remain informative instead of letting
> developers hide actual behavior inside a non-descriptive function name;
> >> Extension functions for grouping utility methods with the classes that
> use them; and
> >> All syntactic sugar added since Java 8, now available for those of us
> living in the past (and also a lot of the world, because they don't even
> make a JRE for the latest version anymore) to use freely too.
> >>
> >>
> >> This would be accomplished using a Gradle plugin as a preprocessor,
> converting any J+ constructs to their Java 8 counterparts and then sending
> the new source off to javac to be compiled, eliminating the need for
> brittle ASM invocations to hook into the compiler directly, while still
> having relatively-low added runtime. For the most part it would be simple
> regex find-and-replace, avoiding any bytecode generation on purpose so the
> end user can see exactly what their code is ending up as.
> >>
> >> If possible, I'd like to also add the ability to apply the
> annotation-based parts - operators and destructuring - to preexisting
> libraries too, using what's essentially a ".d.ts" file but for Java. This
> would allow the convenience factor for advanced users without requiring it
> of newer ones, but it's likely out of scope for this project.
> >>
> >>
> >> To be honest, I'm just tired of having to keep track of my getters and
> setters. If I can replace this:
> >>>
> >>> private String foo = "bar;
> >>>
> >>> public String getFoo() {
> >>>
> >>> return this.foo;
> >>>
> >>> }
> >>>
> >>> public void setFoo(String newVal) {
> >>>
> >>> this.foo = newVal;
> >>>
> >>> doOtherThing();
> >>>
> >>> }
> >>
> >>
> >> with this:
> >>>
> >>> String foo = "bar";
> >>>
> >>> get() {
> >>> return foo;
> >>> }
> >>>
> >>> set(newVal) {
> >>> foo = newVal;
> >>> doOtherThing();
> >>> }
> >>
> >> while still being able to use my precious Java syntax? And all it
> takes is banging my head against some regex for a couple hundred hours?
> That sounds like a fair trade to me.
> >>
> >> I have a full plan formulated with a finalized process for every step,
> but this is a "brief" overview of it. For the most part, I just
> desperately need the input of people who are experienced with this area.
> Even if you don't like this for GSoC, I would still love to chat about it
> in the future, because I think it will make Java just a little bit better
> for everyone.
> >>
> >>
> >>
> >> So, what do you think? Does this sound like a good proposal idea? Let
> me know your thoughts in the replies; I look forward to your feedback, and
> I happily await this being torn apart by people more knowledgeable in the
> field than I.
> >>
> >>
> >> Thank you so much for your time,
> >>
> >> Caleb Brandt
> >>
> >>
> >>
> >>
> >> About Me:
> >> I'm a hobbyist programmer and Fixer of Things: if I see something wrong
> that I can fix, I might as well help out. The power of programming is that
> if you solve a problem for yourself, you also solve it for every single
> person who will ever live, which is why I admire open-source consortiums
> such as you guys so greatly. You're everything I wanted to be when I grew
> up, and I'm applying because you still represent the hallmark of what good
> coding is to me: helping people do stuff better, just because you can.
> >>
> >> I'm finishing up my Bachelor's degree in Computer Science at the
> University of Central Florida, and in my off-time I make compatibility mods
> for Minecraft: optimizing interactions between other mods using Mixin (a
> framework for ASM), reflectively exposing new APIs in mods for other
> developers to use, bytecode-patching bugs in abandoned libraries, and
> anything else I can do to make the ecosystem a bit better than how I found
> it. I also attempt to fix any issues I encounter in open-source software;
> I already spent the time tracking it down, I might as well take one more
> step and fix it for everyone too. I just like to make helpful things, and I
> >>
>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Paul King <pa...@asert.com.au>.
Hi Caleb, what you are describing as your desired goal sounds alot
like Groovy to me. Can you elaborate on anything that you desire that
Groovy doesn't already give you?
Thanks, Paul.
On Mon, Mar 25, 2024 at 1:58 AM Caleb Brandt <ca...@gmail.com> wrote:
>
> I..... forgot to subscribe to this list first. :/ Please prune the duplicate that's under moderation.
>
> Also, if this isn't the right place for this, please tell me where I should send it. I don't want to come barging in ignoring the way you guys do things. I'm just really excited to possibly work with you guys.
>
>
> On Sun, Mar 24, 2024, 10:38 AM Caleb Brandt <ca...@gmail.com> wrote:
>>
>> Hi all,
>>
>> I wanted to submit a new idea for this summer's GSoC. You should stick around, because I trust you'll find this as interesting as I do.
>>
>>
>> Motivation:
>>
>> I know you made Groovy, but if you're anything like me, you love Java.
>>
>> I mean, how could you not: Java is unparalleled when it comes to readability and structure while still being powerful. You can track data flow through a program at a glance, there are a thousand easy-to-use and intuitive libraries, and - as much as I love C++ - there aren't any ambiguous operators, syntax that's only valid in one specific place, or random macro usage in the main library functions. You know exactly what something does just by looking at it, and that's still such a breath of fresh air even in the modern programming space. These new languages try to be as concise as possible for writing, but they sometimes forget that people have to read the dang thing too, am I right?
>>
>> But... Java can also be a bit too verbose at times, can't it? We only recently got a concise syntax for POJOs in the form of Records, and they come with their own set of stipulations that make using them somewhat niche. And that's not to mention the continued waiting for destructuring declarations, the getters and setters left floating around in the class, the endless if-elseif trees checking the same value against different things that make it so hard to track... There are a few areas of improvement; let's say that.
>>
>> Languages like Scala and Kotlin try to remedy this, but they end up with their own problems like enforced programming models, completely overhauled libraries that lose the intuitiveness of Java's, and just the overall learning curve of being a completely different language. Same thing with Groovy to a lesser extent: these languages are powerful, but they lose the familiarity that comes with Java.
>>
>> What we need is the ability to just... add some stuff to Java, without making people learn a whole new language to use it.
>>
>>
>>
>> So what if we did?
>>
>> Proposal: Add Some Stuff To Java
>>
>> Essentially, the plan is to make a set of syntactically-sugary-delicious constructs that transpile to plain ol' Java 8 source code, similar to how TypeScript's advanced features still compile to ECMA2016.
>>
>> The core principles are zero overhead and improved readability; this isn't remaking the wheel and constructing new libraries, this is just adding shorthand for ubiquitous and consistent features that we wish we could have saved time doing by hand. It's gotta feel like you're just using a version of Java from the near future: no syntax weirdness, just some extra intuitive constructs so it's easier both to write and to read.
>>
>> Things like:
>>
>> Getters and setters being part of the variable declaration, and being called via the property name itself;
>> If/else-if trees that check the same variable against different things being allowed to be in the form of a `switchif` statement, similar to Kotlin's sequential switch statements;
>> Python-style "group imports" to save space and local renaming for imported functions and classes, so people can still give their items descriptive names without being forced to type the whole thing out every single time they want to use it;
>> Kotlin-style `with` blocks for the convenience and readability of "chaining" when chaining isn't an option;
>> The `as` keyword so you aren't forced to relearn lisp every time you need to cast something multiple times;
>> Destructuring declarations using annotations instead of waiting for pattern matching to come through
>> Operator overloading so we can do things like "accessing lists through brackets" and "doing boolean algebra in a readable manner", again declared using annotations so method names remain informative instead of letting developers hide actual behavior inside a non-descriptive function name;
>> Extension functions for grouping utility methods with the classes that use them; and
>> All syntactic sugar added since Java 8, now available for those of us living in the past (and also a lot of the world, because they don't even make a JRE for the latest version anymore) to use freely too.
>>
>>
>> This would be accomplished using a Gradle plugin as a preprocessor, converting any J+ constructs to their Java 8 counterparts and then sending the new source off to javac to be compiled, eliminating the need for brittle ASM invocations to hook into the compiler directly, while still having relatively-low added runtime. For the most part it would be simple regex find-and-replace, avoiding any bytecode generation on purpose so the end user can see exactly what their code is ending up as.
>>
>> If possible, I'd like to also add the ability to apply the annotation-based parts - operators and destructuring - to preexisting libraries too, using what's essentially a ".d.ts" file but for Java. This would allow the convenience factor for advanced users without requiring it of newer ones, but it's likely out of scope for this project.
>>
>>
>> To be honest, I'm just tired of having to keep track of my getters and setters. If I can replace this:
>>>
>>> private String foo = "bar;
>>>
>>> public String getFoo() {
>>>
>>> return this.foo;
>>>
>>> }
>>>
>>> public void setFoo(String newVal) {
>>>
>>> this.foo = newVal;
>>>
>>> doOtherThing();
>>>
>>> }
>>
>>
>> with this:
>>>
>>> String foo = "bar";
>>>
>>> get() {
>>> return foo;
>>> }
>>>
>>> set(newVal) {
>>> foo = newVal;
>>> doOtherThing();
>>> }
>>
>> while still being able to use my precious Java syntax? And all it takes is banging my head against some regex for a couple hundred hours? That sounds like a fair trade to me.
>>
>> I have a full plan formulated with a finalized process for every step, but this is a "brief" overview of it. For the most part, I just desperately need the input of people who are experienced with this area. Even if you don't like this for GSoC, I would still love to chat about it in the future, because I think it will make Java just a little bit better for everyone.
>>
>>
>>
>> So, what do you think? Does this sound like a good proposal idea? Let me know your thoughts in the replies; I look forward to your feedback, and I happily await this being torn apart by people more knowledgeable in the field than I.
>>
>>
>> Thank you so much for your time,
>>
>> Caleb Brandt
>>
>>
>>
>>
>> About Me:
>> I'm a hobbyist programmer and Fixer of Things: if I see something wrong that I can fix, I might as well help out. The power of programming is that if you solve a problem for yourself, you also solve it for every single person who will ever live, which is why I admire open-source consortiums such as you guys so greatly. You're everything I wanted to be when I grew up, and I'm applying because you still represent the hallmark of what good coding is to me: helping people do stuff better, just because you can.
>>
>> I'm finishing up my Bachelor's degree in Computer Science at the University of Central Florida, and in my off-time I make compatibility mods for Minecraft: optimizing interactions between other mods using Mixin (a framework for ASM), reflectively exposing new APIs in mods for other developers to use, bytecode-patching bugs in abandoned libraries, and anything else I can do to make the ecosystem a bit better than how I found it. I also attempt to fix any issues I encounter in open-source software; I already spent the time tracking it down, I might as well take one more step and fix it for everyone too. I just like to make helpful things, and I
>>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by MG <mg...@arscreat.com>.
Hi Caleb,
literally what OC wrote.
Groovy has many hats, and the one you seem to know (and it seems dread)
is it being used to create a non-static DSL for Gradle.
The other two hats are Groovy being used as a script language, and - and
this is the one you should have a closer look at - being used as a full
blown, nearly 100% Java compatible programming language.
What OC writes below is true, Groovy is - by ongoing design, which many
discussions on this mailing list on how to integrate new Java/JVM
features into Groovy attest to - a drop in replacement for Java, aiming
to make Java more Groovy.
When someone finds a Java sample code snippet on the internet, all he
needs to do use it in Groovy is to copy & paste it into his project, and
do a regex search & replace of \s*;\s*$ w an empty string to remove the
redundant semicolons at the end of each line.
Also, while e.g. IntelliJ Support for Groovy is not perfect or
completely bug free, it is still very good, and it does not have the
problems you describe in your last posts: e.g. jumping to definitions of
classes/methods works, even when using standard (= dynamic) Groovy (i.e.
not @CompileStatic/@TypeChecked annotated).
While all JVM languages stand in the long shadow of Java, Groovy is the
second largest of them by many metrics, and support for it is
accordingly high.
(Your trans-compiled Java+ would face problems with IDEs, btw, since no
IDE will understand your extensions, and will therfore only support
Intellisense with regards to the transcompile pure Java code, not Java+.)
But most importantly: You would loose so many great Groovy features,
such as:
1. The multitude of ways to define string constants (multiline,
regex-friendly, etc).
2. Strings with embedded variables (which can even be closures), i.e.
GString|s.
3. The multitude of useful annotations, such as @InheritConstructors,
@Canonical, etc.
4. Newer Groovy convenience features such as e.g.
SV(myLongVariableName), which auto-expands to the GString
"myLongVariableName=$myLongVariableName", which is very useful for
debug logging.
1. (and which is made possible by the underlying Groovy's macro
feature)
5. The clever Closure syntax which allows to pass the last argument of
a method outside of the paramter enclosing brackets if that
parameter is a closure, which allows for the creation of extremely
elegant AND readable APIs.
1. we use e.g. database.withTransaction { /* SQL that shall be
executed within a database transaction bracket */ } for our own
SQL code as well as for Ebean.
2. or database.eachRow(sql) { row -> ... } for code that shall be
applied to each row in a result set.
6. and so forth.
7. all of which have Intellisense support in e.g. IntelliJ.
Getting people to try a different language is a matter of ease of
transition (which Java to Groovy definitely has in troves over any
alternative), as well as enticing new features - it is not about fooling
people into believing that they are still using Java, it is about them
realizing how many cool treasures lie on the other side of the fence,
and no language can make that easier with regards to Java than Groovy G-)
Cheers,
mg
On 25/03/2024 16:34, OCsite wrote:
> The vast advantage of Groovy is that you can take a big project, just
> rename all *.java to *.groovy, and it will essentially work (well, as
> someone already wrote, 99 % — my experience is rather 99.99 %, but
> indeed there are things which need fixing and there are a couple of
> gotchas, but there's really a very very small number of them). Then
> you can work on with the project and gradually change the stupid Java
> patterns to the pretty decent Groovy ones, part by part, method by
> method and if need be, practically line by line, without losing any
> functionality during the process. No other language I know of allows
> anything like this.
>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by MG <mg...@arscreat.com>.
Hi Caleb,
1. a few years back I dabbled a bit in Minecraft development myself, so
I could teach my son about programming (we were working on a new
sport/arena-type-game mode, which alas never saw the light of day
due to time constraints, even though we got pretty far (that the
Minecraft code base is pretty awful & a constantly moving target did
not help either ;-) ) ), and of course I did that using Groovy.
2. Ironically, after what I said in my last post, Minecraft development
is one of the few areas where Groovy is not a 100% drop in Java
replacement, due to the fact that the compiled bytecode needs to be
transformed to be compatible with Minecraft, and this runs into some
issues:
1. https://issues.apache.org/jira/browse/GROOVY-8385
3. Afaik this never got resolved and the ticket accordingly closed
after some time. This is something you could have a look at on your
own, asking on the mailing list if a question arises - or maybe
someone has the time & knowledge to guide you... G-)
Cheers,
mg
On 25/03/2024 21:38, Caleb Brandt wrote:
> But uh, the biggest thing is that I want to spend my summer working on
> a passion project with some really knowledgeable people and get
> real-world experience in open-source software development. So like,
> if this even /somewhat/ sounds like a good idea... would anyone be
> willing to mentor me? 🥺
>
Re: [EXT] Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by "Milles, Eric (TR Technology) via dev" <de...@groovy.apache.org>.
There is so much to unpack here. I'll likely miss key points here, but wanted to add a couple.
1.
If your goal is to add some ability directly to Java, then a library or an annotation processor like Vavr or Lombok respectively may be a better approach. These integrate directly into Java projects and into Java source files, so no intimidating file extension change.
2.
As stated by MG or OC, if you need to write in a new dialect, I'm assuming you'll need to have a different file extension like "*.jp" or "*.javap" in which case, I don't see how you overcome the "it's not .java" perception/problem. IDEs would be expected to provide sensing within your source file and I don't think they would be doing so through the transpiled sources.
3.
As MG or OC stated, IDEs do actually perform a lot of static analysis (without @TypeChecked or @CompileStatic – the native Groovy type-checker) to show you what the elements of a source text mean and provide navigation, refactoring, etc. So yes, there are circumstances where a dev gets creative and the IDE loses track or has no trail to follow. But by and large, you can tell a lot about a Groovy source file to assist the reader or writer.
4.
Groovy may not be java source and it may be compiled, but it does compile to JVM bytecode. So all the years of tooling built to analyze class files can still be brought to bear. And if a particular groovy construct makes bytecode that you feel could be better represented, it can be changed. The static compiler has brought groovy bytecode closer and closer to java bytecode for common scenarios.
5.
From my perspective, Groovy was a great option over Scala, Kotlin, Gosu and others. We could add the compiler to our toolchain and our development environment. Then we could move just 1 Java source file over to Groovy, in place. And we could make no or minimal changes to that file. So the transition could be done in very, very small steps. And our projects still retain Java sources to this day. The intent was not to convert to Groovy 100%. IIRC, Groovy was the only option to allow living in the same source tree with bi-directional dependency.
6.
As Paul mentioned, your number one problem IMO is uptake/marketing/maintenance. There are tons of projects like these out there. I wasn't aware of Jactl or Manifold until this email chain. But Beanshell, Painless and Gosu are some more. Getting the word out and keeping interest up is a very difficult, non-technical problem.
7.
If there is a specific area of Groovy that seems like it is/was intimidating, lacking documentation, or performed with bugs or something, I would encourage you to file an issue ticket and we can try to fix the bug or doc or the feature itself. There is always lots to do to smooth out the rough edges. Groovy has lots of them and to your subset comment, has a lot of bits added that cannot be removed but could be safely ignored.
________________________________
From: Caleb Brandt <ca...@gmail.com>
Sent: Monday, March 25, 2024 3:38 PM
To: dev@groovy.apache.org <de...@groovy.apache.org>
Subject: [EXT] Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
External Email: Use caution with links and attachments.
Oh, and the reason it adds so few features is (well one to be in scope for a summer programming gig, but two:) so that it's not overwhelming to people. Again: a small handful of features that help a bit, but don't completely outshine Java's own features, and don't require constantly checking docs for new stuff you can do.
On that note, it's possible that once we have a preprocessor framework developed, we could expand on its functionality with plugins (with their own separate documentations to avoid overwhelming people) to expand on its features.
But uh, the biggest thing is that I want to spend my summer working on a passion project with some really knowledgeable people and get real-world experience in open-source software development. So like, if this even somewhat sounds like a good idea... would anyone be willing to mentor me? 🥺
On Mon, Mar 25, 2024 at 4:22 PM Caleb Brandt <ca...@gmail.com>> wrote:
IDEs will still interpret stuff incorrectly at times.*
On Mon, Mar 25, 2024 at 4:17 PM Caleb Brandt <ca...@gmail.com>> wrote:
Thank you all so much for your insight! And I'm not being facetious here; you guys keep blasting away the points that don't hold water, so I think I've finally nailed down why I feel this project is so necessary.
Because you're absolutely right: Groovy already does do much of what I want. In terms of contributing new functionality to the ecosystem, my project isn't necessary in the slightest. My argument is entirely borne out of ignorance to what Groovy can do.
But to be honest... that's kind of the point. It's absolutely IGNORANT, and that's absolutely WRONG, but even still, it is.
See, I've been programming in Java for around seven years at this point. I'm very immersed in the Minecraft dev space, and I've worked with others on non-Minecraft things as well, like working on toolchains and libraries, contributing to a handful of personal projects, etc. And as a member of those spaces, the "vibe" that I've gotten is this: "the non-Java JVM languages are clunky".
See, Groovy has exactly two things going against it for reaching the most people: it's a language, and it's compiled. Now that might sound odd to criticize, but bear with me.
1. As another language, it is inherently intimidating to people who aren't familiar with it.
People are closed-minded, and like to stick to what they know. I know when I see "Foo.groovy" on Github, I immediately go "oh god", though it absolutely isn't warranted! Fact is, people who use Java and know their way around it like the back of their hand don't want to go relearn how to speak in code just to do the same thing a tiny bit easier.
Their instinct is to go:
"I've never used Groovy, and I never intend to, because I'm fine with Java. I can do everything I need to with Java. Why do people have to be weird and use something that isn't Java when writing a Java program? I don't want to have to learn a new language just to sift through this."
It doesn't really matter if it's identical to Java in most places, the very name not being "Java" is enough to spook people who aren't familiar with it. Sure, once you get to know it, you realize there was never any reason to be intimidated, but that's a leap too far for most people when they could just... not use it, without any consequence.
Even as someone who tries to be more open-minded than most people, I still find myself having that instinct. Even though I know my fear of Groovy was unwarranted, it doesn't change the fact that it took this conversation to change my mind about it. Very few people are going to have this conversation; most are just going to say "oh, that's neat, I guess" and leave it.
And also:
2. As a compiled language, any analysis tools need to be specifically written for Groovy, and they just can't match the ones for Java.
And that's no fault of Groovy's! See, even if we got the brightest minds in the world together to make a static analyzer, debugger, and suite of tools for Groovy, Java still has twenty years on us. It's just a fact: without massive resources, we can't match the tools made for Java. Debuggers will fail inside Closures, static analyzers will infer the wrong types and throw false errors, and IDEs
Even if we could theoretically do all of that better than Java, we'll inevitably still be working in a Java-based ecosystem. Any tools made are implemented in a Java IDE: analyzers are slower, intellisense loses track of where things are defined, postfix completions have to be redefined, templates stop working; every single thing has to be retooled for Groovy. And that includes community-made plugins too!
It's unfortunate, but it's a fact: any non-Java JVM language will - by virtue of not being Java - be slightly more clunky than Java in a Java-based ecosystem.
But they're still worth it, right?
Of course they are! But that doesn't matter if no one uses them.
See, you can tell when it fails where Java wouldn't. You notice when it takes slightly longer for errors to pop up, when types get inferred incorrectly, when intellisense can't find your class and you have to manually go and search for the reference to import. It's annoying to have to take over for something that worked seamlessly before.
Again, it's no fault of the language, it's just the fact that our tools are inevitably going to be slightly less refined than ones made by a company doing it for profit.
But when you're already feeling the malaise from being immersed in a somewhat-new language and you notice that the things you've taken for granted are suddenly failing, what impression do you get about the language? In my experience: that it's a novelty, one that's slightly worse in your experience than the one you're used to.
That's what I'm trying to solve here. It's not a matter of features, it's a matter of accessibility and making sure people don't feel disinclined to continue past their first glance at it.
So how do you do that? How do you get people to take that leap - to continue past that cliff that stops people from continuing past their first impression?
It's simple: don't let there be any leap at all.
1. Forget the "language" part. Show your features for what they are: tiny addons for the language they already know.
There are a few parts to making it as approachable as possible:
1. The NAME:
There's a reason I didn't call it "Latte", "Javaccino", or "Mocha" instead of "Java Plus". To be honest, even THAT might be too much; everything about it needs to emphasize that it is NOT a new language.
I'd describe it as "A few tiny (eensy-weensy teeny-weeny) snippets to save you time writing things you constantly use", and specifically accentuate the small part. It needs to feel like something you can just "click on" without any commitment on your part.
2. DROP-IN INSTALLATION:
People need to be able to plug it into their preexisting project without any action on their part besides pasting in the plugin. Not even any file extension changes. If it looks like it isn't Java from far away, people will feel like it isn't Java.
We can do this fairly easily: take all of the Java files, scan them for our constructs, generate new source files with their transpiled counterparts, and give the new files to javac. We actually do a very similar thing in MinecraftForge already: source files are copied to the `out` directory, where tokens are replaced and deobfuscated method calls are mapped to their obfuscated counterparts before the new sources are passed on to the `compile` task.
The only problem with this approach is that you end up having two identical sets of source files: one in the src directory, and one in the out directory. However, this actually turns from a bug into a feature because of the third step:
3. DROP-OUT REMOVAL:
It's Java allllll the way down. If you want to stop using it, awesome! Everything gets converted to plain ol' Java, so every single one of the vanilla Java files are RIGHT THERE for you to use outside of this project. This is also why TypeScript is so approachable: you can add or remove it at any time without any impact to your project. There's no commitment to using the plugin in everything; you're still a Java developer like everyone else, you just have some new things in your toolbelt that Oracle didn't add.
Speaking of:
4. IT'S JUST "MORE" JAVA:
Everything that's added needs to "feel like Java". Again, it's a psychological thing: people will feel some malaise if they're using something that doesn't look like something they're used to, so it all has to be an intuitive analogue to something that already exists in Java.
We all know what a getter and a setter is, so condensing them into one place is easy to understand. But what's a "closure"? What's a "delegate"? What's a "virtual thread"??? (I'm kidding.) People don't have a basis for these things in Java, so it's just more stuff to learn instead of already making sense to a Java-only programmer.
I actually removed the idea of the `pojo` keyword from this proposal for this very reason: while it's clever shorthand for something that people do a lot, it hides too much from the writer. Where are the getters? Where are the setters? Do we access them by field or by method? How do we do internal member referencing? Can we extend classes? It's just too much hidden behind a single keyword, so it's not a good fit for this project, instead being partially covered by the declaration get/setters. Every addition needs to scan like Java at face value and feel like something Oracle themselves would have added.
And on the backend:
2. Instead of COMPILING, we transpile it to Java source code
Unlike with JVM bytecode, this one would transpile to Java 8 source code, letting a few things happen that completely change the game:
1. WE CAN USE JAVA'S TOOLS
Yeah so remember what I said about how "nothing will ever match Java in a Java space"? If you can't beat 'em, join 'em. By acting as a transparent frontend to real Java source code, we can leverage existing Java analyzers to do our linting for us. The IntelliJ system already has a variant of this for CLion's macro processing, being able to detect errors in the applied macro and display the code it'll be replaced with in a hover popup.
We can also use Java debuggers to their fullest extent too: it'll link to the processed Java8 sources when we freeze on a breakpoint instead of the J+ sources, but once again that's a feature, not a bug. With a good enough formatter on the processor, they'll even thank us for it.
We don't return anything, only being syntactic sugar instead of library sugar, so type-checking is a non-issue as well. (I wanted to add the ability to return from an outer function from inside an Optional, so I wouldn't have to do the "Optional Dance" whenever I wanted to get or return if null, but that would break the rules I highlighted above so it was a no-go.)
No Java syntax rules are broken either - nothing new goes outside a method, for starters - so any community-made Java source plugins will work exactly the same on the unprocessed source as they would on the vanilla source.
2. W E C A N U S E J A V A ' S T O O L S
Again, you don't realize how huge this is. There's no overhead. There's no stuttering. No incorrect typing, no invalid templates, no broken plugins; it works exactly like normal Java, just with additional features. People won't have any excuse not to use it. It's purely helpful without breaking people's workflows in the slightest. (...save for some additional gradle configuration to point any other plugins to the processed sources, but just sneezing on the project does the same thing, so it's an acceptable loss imo)
3. It's great marketing for Groovy
Like I said before, people don't like to stray too far from what they know. They know Java, so they stick with Java. Oh, but now they know Java Plus too! But... by its very design, Java Plus can only do half of the things that Groovy can. So, if they want even more features, we tell them to go try Groovy! "It's just like this, but more!!!"
So, do you get what I'm going for now? In the end, it won't end up all that different from Groovy in function, but that's not the point. The point is to be something that doesn't exist yet: an approachable set of useful features for people who otherwise would look at a whole other "language" and run away.
As for marketing: I'm friends with some of the biggest Minecraft developers in the space; if something's going to be used by new Java developers, it'll be recommended by them. I can even get it packaged into the major modding frameworks for the game if it's intuitive enough, and from there it'll spread by word-of-mouth as long as there's no learning curve at all. It will improve readability, make you have to keep fewer things in your head while writing, and sort through your code easier; there will be no reason not to use it, which is exactly what I have in mind. Hell, if the features prove stable enough, we could even pitch them to Oracle for inclusion in the language proper.
It'll be a great stress-test for some sorely-needed features in Java. Plus, it'll let me keep track of where my getters and setters are without having to open the Structure tab every five minutes. Win-win.
So, have I sold you on it yet?
Cheers,
Caleb
On Mon, Mar 25, 2024 at 11:35 AM OCsite <oc...@ocs.cz>> wrote:
Caleb,
On 24. 3. 2024, at 16:57, Caleb Brandt <ca...@gmail.com>> wrote:
I know you made Groovy, but if you're anything like me, you love Java.
just for one, although I haven't co-operated on the Groovy creation (am just a very satisfied user), I hate Java very bitterly.
The language design is simply terrible, all the worse since the people who made that abomination, i.e., Sun, knew Objective C well (they used to cooperate with NeXT on OpenStep) and thus knew how to do an object-oriented language right.
Instead they botched it terribly. No real polymorphism. Very limited encapsulation. Type-system which effectively prevents (or at the very least makes highly complicated and expensive) all the best and most important object-oriented patterns like e.g., proxying and message forwarding. Classes are not objects and their „methods“ do not support inheritance properly. It is quite normal to access instance variables directly, instead of consistent usage of accessors. Heaps and heaps of boilerplate. Often, the darned thing limitations just force the IDEs to generate code — compare e.g., WOLips. Could rant on for months like this :(
Whilst languages like e.g., Kotlin or Scala fix some of the problems all right, they, alas, do not allow to switch a big project from the Java disaster without re-writing it at once and completely, which is a big show-stopper.
The vast advantage of Groovy is that you can take a big project, just rename all *.java to *.groovy, and it will essentially work (well, as someone already wrote, 99 % — my experience is rather 99.99 %, but indeed there are things which need fixing and there are a couple of gotchas, but there's really a very very small number of them). Then you can work on with the project and gradually change the stupid Java patterns to the pretty decent Groovy ones, part by part, method by method and if need be, practically line by line, without losing any functionality during the process. No other language I know of allows anything like this.
All the best,
OC
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Caleb Brandt <ca...@gmail.com>.
Oh, and the reason it adds so few features is (well *one* to be in scope
for a summer programming gig, but *two:*) so that it's not overwhelming to
people. Again: a small handful of features that help a *bit*, but don't
completely outshine Java's own features, and don't require constantly
checking docs for new stuff you can do.
On that note, it's possible that once we have a preprocessor framework
developed, we could expand on its functionality with plugins (with their
own *separate* documentations to avoid overwhelming people) to expand on
its features.
But uh, the biggest thing is that I want to spend my summer working on a
passion project with some really knowledgeable people and get real-world
experience in open-source software development. So like, if this even
*somewhat* sounds like a good idea... would anyone be willing to mentor me?
🥺
On Mon, Mar 25, 2024 at 4:22 PM Caleb Brandt <ca...@gmail.com>
wrote:
> IDEs will still interpret stuff incorrectly at times.*
>
> On Mon, Mar 25, 2024 at 4:17 PM Caleb Brandt <ca...@gmail.com>
> wrote:
>
>> Thank you all so much for your insight! And I'm not being facetious
>> here; you guys keep blasting away the points that don't hold water, so I
>> think I've finally nailed down *why* I feel this project is so necessary.
>>
>> Because you're absolutely right: Groovy already *does* do much of what I
>> want. In terms of contributing new functionality to the ecosystem, my
>> project isn't necessary in the slightest. My argument is entirely borne
>> out of *ignorance* to what Groovy can do.
>>
>> But to be honest... that's kind of the *point*. It's absolutely
>> IGNORANT, and that's absolutely *WRONG*, but even still, it *is*.
>>
>>
>> See, I've been programming in Java for around seven years at this point.
>> I'm very immersed in the Minecraft dev space, and I've worked with others
>> on non-Minecraft things as well, like working on toolchains and libraries,
>> contributing to a handful of personal projects, etc. And as a member of
>> those spaces, the "vibe" that I've gotten is this: "the non-Java JVM
>> languages are clunky".
>>
>>
>> See, Groovy has exactly two things going against it for reaching the most
>> people: it's a *language*, and it's *compiled*. Now that might sound
>> odd to criticize, but bear with me.
>>
>>
>> 1. As another language, it is *inherently* intimidating to people who
>> aren't familiar with it.
>>
>> People are closed-minded, and like to stick to what they know. I know
>> when I see "Foo.groovy" on Github, I immediately go "oh god", though it
>> *absolutely* isn't warranted! Fact is, people who use Java and know
>> their way around it like the back of their hand don't want to go relearn
>> how to speak in code just to do the same thing a tiny bit easier.
>>
>> Their instinct is to go:
>>
>>> "I've never used Groovy, and I never intend to, because I'm fine with
>>> Java. I can do everything I need to with Java. Why do people have to be
>>> weird and use something that isn't Java when writing a Java program? I
>>> don't want to have to learn a new language just to sift through this."
>>>
>>
>> It doesn't really matter if it's identical to Java in most places, the
>> very *name* not being "Java" is enough to spook people who aren't
>> familiar with it. Sure, once you get to know it, you realize there was
>> never any reason to be intimidated, but that's a leap too far for most
>> people when they could just... *not* use it, without any consequence.
>>
>> Even as someone who tries to be more open-minded than most people, I
>> *still* find myself having that instinct. Even though I know my fear of
>> Groovy was unwarranted, it doesn't change the fact that it *took this
>> conversation* to change my mind about it. Very few people are going to
>> have this conversation; most are just going to say "oh, that's neat, I
>> guess" and leave it.
>>
>>
>> And also:
>>
>> 2. As a compiled language, any analysis tools need to be specifically
>> written *for Groovy*, and they just can't match the ones for Java.
>>
>> And that's no fault of Groovy's! See, even if we got the* brightest
>> minds* in the world together to make a static analyzer, debugger, and
>> suite of tools for Groovy, Java still has *twenty years* on us. It's
>> just a fact: without massive resources, we can't match the tools made for
>> Java. Debuggers will fail inside Closures, static analyzers will infer the
>> wrong types and throw false errors, and IDEs
>>
>> Even if we could theoretically do all of that *better than Java*, we'll
>> inevitably still be working in a *Java-based* ecosystem. Any tools made
>> are implemented in a Java IDE: analyzers are slower, intellisense loses
>> track of where things are defined, postfix completions have to be
>> redefined, templates stop working; *every single thing* has to be
>> retooled for Groovy. And that includes community-made plugins too!
>>
>> It's unfortunate, but it's a fact: any non-Java JVM language will - by
>> virtue of not being Java - be slightly more clunky than Java in a
>> Java-based ecosystem.
>>
>>
>>
>> But they're still worth it, right?
>>
>> Of course they are! But that doesn't matter if no one *uses them*.
>>
>> See, you can *tell* when it fails where Java wouldn't. You notice when
>> it takes slightly longer for errors to pop up, when types get inferred
>> incorrectly, when intellisense can't find your class and you have to
>> manually go and search for the reference to import. It's *annoying* to
>> have to take over for something that worked seamlessly before.
>>
>> Again, it's no fault of the *language*, it's just the fact that our
>> tools are *inevitably* going to be slightly less refined than ones made
>> by a company doing it for profit.
>>
>> But when you're *already* feeling the malaise from being immersed in a
>> somewhat-new language and you notice that the things you've taken for
>> granted are suddenly *failing*, what impression do you get about the
>> language? In my experience: that it's a novelty, one that's slightly worse
>> in your experience than the one you're used to.
>>
>>
>>
>>
>> *That's* what I'm trying to solve here. It's not a matter of *features*,
>> it's a matter of *accessibility* and making sure people *don't feel
>> disinclined* to continue past their first glance at it.
>>
>> So how do you do that? How do you get people to take that leap - to
>> continue past that cliff that stops people from continuing past their first
>> impression?
>>
>>
>> It's simple: don't let there be any leap at all.
>>
>> 1. Forget the "language" part. Show your features for what they are: *tiny
>> addons* for the language they already know.
>>
>> There are a few parts to making it as approachable as possible:
>>
>> *1. The NAME:*
>>
>> There's a reason I didn't call it "Latte", "Javaccino", or "Mocha"
>> instead of "Java Plus". To be honest, even *THAT* might be too much; *everything
>> about it* needs to emphasize that it is *NOT* a new language.
>>
>> I'd describe it as "A *few* *tiny* (eensy-weensy teeny-weeny) snippets
>> to save you time writing things you constantly use", and specifically
>> accentuate the *small* part. It needs to *feel* like something you can
>> just "click on" without any commitment on your part.
>>
>>
>> *2. DROP-IN INSTALLATION:*
>> People need to be able to plug it into their preexisting project without
>> *any* action on their part besides pasting in the plugin. *Not even any
>> file extension changes.* If it *looks* like it isn't Java from far
>> away, people will *feel* like it isn't Java.
>>
>> We can do this fairly easily: take all of the Java files, scan them for
>> our constructs, generate new source files with their transpiled
>> counterparts, and give the new files to javac. We actually do a very
>> similar thing in MinecraftForge already: source files are copied to the
>> `out` directory, where tokens are replaced and deobfuscated method calls
>> are mapped to their obfuscated counterparts before the new sources are
>> passed on to the `compile` task.
>>
>> The only problem with this approach is that you end up having two
>> identical sets of source files: one in the src directory, and one in the
>> out directory. However, this actually turns from a bug into a *feature*
>> because of the third step:
>>
>>
>>
>> *3. DROP-OUT REMOVAL:*
>> It's Java allllll the way down. If you want to stop using it, awesome!
>> Everything gets converted to plain ol' Java, so every single one of the
>> vanilla Java files are RIGHT THERE for you to use outside of this project.
>> This is also why TypeScript is so approachable: you can add or remove it at
>> any time without any impact to your project. There's *no commitment* to
>> using the plugin in everything; you're still a Java developer like everyone
>> else, you just have some new things in your toolbelt that Oracle didn't add.
>>
>> Speaking of:
>>
>>
>> *4. IT'S JUST "MORE" JAVA:*
>> Everything that's added needs to "feel like Java". Again, it's a
>> psychological thing: people will feel some malaise if they're using
>> something that doesn't look like something they're used to, so it all has
>> to be an *intuitive analogue* to something that already exists in Java.
>>
>> We all know what a getter and a setter is, so condensing them into one
>> place is easy to understand. But what's a "closure"? What's a "delegate"?
>> What's a "virtual thread"??? (I'm kidding.) People don't have a basis for
>> these things in Java, so it's just *more* stuff to learn instead of
>> already making sense to a Java-only programmer.
>>
>> I actually removed the idea of the `pojo` keyword from this proposal for
>> this very reason: while it's clever shorthand for something that people do
>> a lot, it *hides too much* from the writer. Where are the getters?
>> Where are the setters? Do we access them by field or by method? How do we
>> do internal member referencing? Can we extend classes? It's just too
>> much hidden behind a single keyword, so it's not a good fit for this
>> project, instead being partially covered by the declaration get/setters.
>> Every addition needs to scan like Java at face value and feel like
>> something Oracle themselves would have added.
>>
>>
>> And on the backend:
>>
>> 2. Instead of COMPILING, we transpile it to Java source code
>>
>> Unlike with JVM bytecode, this one would transpile to Java 8 *source
>> code*, letting a few things happen that *completely* change the game:
>>
>>
>> *1. WE CAN USE JAVA'S TOOLS*
>> Yeah so remember what I said about how "nothing will ever match Java in a
>> Java space"? If you can't beat 'em, join 'em. By acting as a transparent
>> frontend to real Java source code, we can leverage existing Java analyzers
>> to do our linting for us. The IntelliJ system already has a variant of
>> this for CLion's macro processing, being able to detect errors in the
>> applied macro and display the code it'll be replaced with in a hover popup.
>>
>> We can also use Java debuggers to their fullest extent too: it'll link to
>> the processed Java8 sources when we freeze on a breakpoint instead of the
>> J+ sources, but once again that's a *feature*, not a bug. With a good
>> enough formatter on the processor, they'll even thank us for it.
>>
>> We don't return anything, only being *syntactic* sugar instead of
>> *library* sugar, so type-checking is a non-issue as well. (I *wanted*
>> to add the ability to return from an outer function from inside an
>> Optional, so I wouldn't have to do the "Optional Dance" whenever I wanted
>> to get or return if null, but that would break the rules I highlighted
>> above so it was a no-go.)
>>
>> No Java syntax rules are broken either - nothing new goes outside a
>> method, for starters - so any community-made Java source plugins will work
>> exactly the same on the unprocessed source as they would on the vanilla
>> source.
>>
>>
>> *2. W E C A N U S E J A V A ' S T O O L S*
>> Again, you don't realize how huge this is. There's *no* overhead.
>> There's no stuttering. No incorrect typing, no invalid templates, no
>> broken plugins; it works *exactly* like normal Java, just with
>> additional features. People won't have any excuse *not* to use it.
>> It's purely helpful without breaking people's workflows in the slightest.
>> (...save for some additional gradle configuration to point any other
>> plugins to the processed sources, but just *sneezing* on the project
>> does the same thing, so it's an acceptable loss imo)
>>
>>
>> *3. It's great marketing for Groovy*
>>
>> Like I said before, people don't like to stray too far from what they
>> know. They know Java, so they stick with Java. Oh, but now they know Java
>> Plus too! But... by its very design, Java Plus can only do half of the
>> things that Groovy can. So, if they want even *more* features, we tell
>> them to go try Groovy! "It's just like this, but more!!!"
>>
>>
>>
>>
>> So, do you get what I'm going for now? In the end, it *won't* end up
>> all that different from Groovy in function, but that's not the point. The
>> point is to be something that doesn't exist yet: an approachable set of
>> useful features for people who otherwise would look at a whole other
>> "language" and run away.
>>
>>
>> As for marketing: I'm friends with some of the biggest Minecraft
>> developers in the space; if something's going to be used by new Java
>> developers, it'll be recommended by them. I can even get it packaged into
>> the major modding frameworks for the game if it's intuitive enough, and
>> from there it'll spread by word-of-mouth as long as there's no learning
>> curve at all. It will improve readability, make you have to keep fewer
>> things in your head while writing, and sort through your code easier; there
>> will be no reason *not* to use it, which is exactly what I have in
>> mind. Hell, if the features prove stable enough, we could even pitch them
>> to Oracle for inclusion in the language proper.
>>
>> It'll be a great stress-test for some sorely-needed features in Java.
>> Plus, it'll let me keep track of where my getters and setters are without
>> having to open the Structure tab every five minutes. Win-win.
>>
>>
>> So, have I sold you on it yet?
>>
>>
>> Cheers,
>>
>> Caleb
>>
>> On Mon, Mar 25, 2024 at 11:35 AM OCsite <oc...@ocs.cz> wrote:
>>
>>> Caleb,
>>>
>>> On 24. 3. 2024, at 16:57, Caleb Brandt <ca...@gmail.com> wrote:
>>>
>>>> I know you made Groovy, but if you're anything like me, you *love*
>>>> Java.
>>>>
>>>
>>> just for one, although I haven't co-operated on the Groovy creation (am
>>> just a very satisfied user), I *hate* Java very bitterly.
>>>
>>> The language design is simply *terrible*, all the worse since the
>>> people who made that abomination, i.e., Sun, knew Objective C well (they
>>> used to cooperate with NeXT on OpenStep) and thus *knew* how to do an
>>> object-oriented language right.
>>>
>>> Instead they botched it *terribly*. No real polymorphism. Very limited
>>> encapsulation. Type-system which effectively prevents (or at the very least
>>> makes highly complicated and expensive) all the best and most important
>>> object-oriented patterns like e.g., proxying and message forwarding.
>>> Classes are not objects and their „methods“ do not support inheritance
>>> properly. It is quite normal to access instance variables directly, instead
>>> of consistent usage of accessors. *Heaps and heaps* of boilerplate.
>>> Often, the darned thing limitations just force the IDEs to generate code —
>>> compare e.g., WOLips. Could rant on for months like this :(
>>>
>>> Whilst languages like e.g., Kotlin or Scala fix some of the problems all
>>> right, they, alas, do not allow to switch a big project from the Java
>>> disaster without re-writing it at once and completely, which is a big
>>> show-stopper.
>>>
>>> The vast advantage of Groovy is that you can take a big project, just
>>> rename all *.java to *.groovy, and it will essentially work (well, as
>>> someone already wrote, 99 % — my experience is rather 99.99 %, but indeed
>>> there are things which need fixing and there are a couple of gotchas, but
>>> there's really a very very small number of them). Then you can work on with
>>> the project and gradually change the stupid Java patterns to the pretty
>>> decent Groovy ones, part by part, method by method and if need be,
>>> practically line by line, without losing any functionality during the
>>> process. No other language I know of allows anything like this.
>>>
>>> All the best,
>>> OC
>>>
>>>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Caleb Brandt <ca...@gmail.com>.
IDEs will still interpret stuff incorrectly at times.*
On Mon, Mar 25, 2024 at 4:17 PM Caleb Brandt <ca...@gmail.com>
wrote:
> Thank you all so much for your insight! And I'm not being facetious here;
> you guys keep blasting away the points that don't hold water, so I think
> I've finally nailed down *why* I feel this project is so necessary.
>
> Because you're absolutely right: Groovy already *does* do much of what I
> want. In terms of contributing new functionality to the ecosystem, my
> project isn't necessary in the slightest. My argument is entirely borne
> out of *ignorance* to what Groovy can do.
>
> But to be honest... that's kind of the *point*. It's absolutely
> IGNORANT, and that's absolutely *WRONG*, but even still, it *is*.
>
>
> See, I've been programming in Java for around seven years at this point.
> I'm very immersed in the Minecraft dev space, and I've worked with others
> on non-Minecraft things as well, like working on toolchains and libraries,
> contributing to a handful of personal projects, etc. And as a member of
> those spaces, the "vibe" that I've gotten is this: "the non-Java JVM
> languages are clunky".
>
>
> See, Groovy has exactly two things going against it for reaching the most
> people: it's a *language*, and it's *compiled*. Now that might sound odd
> to criticize, but bear with me.
>
>
> 1. As another language, it is *inherently* intimidating to people who
> aren't familiar with it.
>
> People are closed-minded, and like to stick to what they know. I know when
> I see "Foo.groovy" on Github, I immediately go "oh god", though it
> *absolutely* isn't warranted! Fact is, people who use Java and know
> their way around it like the back of their hand don't want to go relearn
> how to speak in code just to do the same thing a tiny bit easier.
>
> Their instinct is to go:
>
>> "I've never used Groovy, and I never intend to, because I'm fine with
>> Java. I can do everything I need to with Java. Why do people have to be
>> weird and use something that isn't Java when writing a Java program? I
>> don't want to have to learn a new language just to sift through this."
>>
>
> It doesn't really matter if it's identical to Java in most places, the
> very *name* not being "Java" is enough to spook people who aren't
> familiar with it. Sure, once you get to know it, you realize there was
> never any reason to be intimidated, but that's a leap too far for most
> people when they could just... *not* use it, without any consequence.
>
> Even as someone who tries to be more open-minded than most people, I
> *still* find myself having that instinct. Even though I know my fear of
> Groovy was unwarranted, it doesn't change the fact that it *took this
> conversation* to change my mind about it. Very few people are going to
> have this conversation; most are just going to say "oh, that's neat, I
> guess" and leave it.
>
>
> And also:
>
> 2. As a compiled language, any analysis tools need to be specifically
> written *for Groovy*, and they just can't match the ones for Java.
>
> And that's no fault of Groovy's! See, even if we got the* brightest
> minds* in the world together to make a static analyzer, debugger, and
> suite of tools for Groovy, Java still has *twenty years* on us. It's
> just a fact: without massive resources, we can't match the tools made for
> Java. Debuggers will fail inside Closures, static analyzers will infer the
> wrong types and throw false errors, and IDEs
>
> Even if we could theoretically do all of that *better than Java*, we'll
> inevitably still be working in a *Java-based* ecosystem. Any tools made
> are implemented in a Java IDE: analyzers are slower, intellisense loses
> track of where things are defined, postfix completions have to be
> redefined, templates stop working; *every single thing* has to be
> retooled for Groovy. And that includes community-made plugins too!
>
> It's unfortunate, but it's a fact: any non-Java JVM language will - by
> virtue of not being Java - be slightly more clunky than Java in a
> Java-based ecosystem.
>
>
>
> But they're still worth it, right?
>
> Of course they are! But that doesn't matter if no one *uses them*.
>
> See, you can *tell* when it fails where Java wouldn't. You notice when
> it takes slightly longer for errors to pop up, when types get inferred
> incorrectly, when intellisense can't find your class and you have to
> manually go and search for the reference to import. It's *annoying* to
> have to take over for something that worked seamlessly before.
>
> Again, it's no fault of the *language*, it's just the fact that our tools
> are *inevitably* going to be slightly less refined than ones made by a
> company doing it for profit.
>
> But when you're *already* feeling the malaise from being immersed in a
> somewhat-new language and you notice that the things you've taken for
> granted are suddenly *failing*, what impression do you get about the
> language? In my experience: that it's a novelty, one that's slightly worse
> in your experience than the one you're used to.
>
>
>
>
> *That's* what I'm trying to solve here. It's not a matter of *features*,
> it's a matter of *accessibility* and making sure people *don't feel
> disinclined* to continue past their first glance at it.
>
> So how do you do that? How do you get people to take that leap - to
> continue past that cliff that stops people from continuing past their first
> impression?
>
>
> It's simple: don't let there be any leap at all.
>
> 1. Forget the "language" part. Show your features for what they are: *tiny
> addons* for the language they already know.
>
> There are a few parts to making it as approachable as possible:
>
> *1. The NAME:*
>
> There's a reason I didn't call it "Latte", "Javaccino", or "Mocha" instead
> of "Java Plus". To be honest, even *THAT* might be too much; *everything
> about it* needs to emphasize that it is *NOT* a new language.
>
> I'd describe it as "A *few* *tiny* (eensy-weensy teeny-weeny) snippets to
> save you time writing things you constantly use", and specifically
> accentuate the *small* part. It needs to *feel* like something you can
> just "click on" without any commitment on your part.
>
>
> *2. DROP-IN INSTALLATION:*
> People need to be able to plug it into their preexisting project without
> *any* action on their part besides pasting in the plugin. *Not even any
> file extension changes.* If it *looks* like it isn't Java from far away,
> people will *feel* like it isn't Java.
>
> We can do this fairly easily: take all of the Java files, scan them for
> our constructs, generate new source files with their transpiled
> counterparts, and give the new files to javac. We actually do a very
> similar thing in MinecraftForge already: source files are copied to the
> `out` directory, where tokens are replaced and deobfuscated method calls
> are mapped to their obfuscated counterparts before the new sources are
> passed on to the `compile` task.
>
> The only problem with this approach is that you end up having two
> identical sets of source files: one in the src directory, and one in the
> out directory. However, this actually turns from a bug into a *feature*
> because of the third step:
>
>
>
> *3. DROP-OUT REMOVAL:*
> It's Java allllll the way down. If you want to stop using it, awesome!
> Everything gets converted to plain ol' Java, so every single one of the
> vanilla Java files are RIGHT THERE for you to use outside of this project.
> This is also why TypeScript is so approachable: you can add or remove it at
> any time without any impact to your project. There's *no commitment* to
> using the plugin in everything; you're still a Java developer like everyone
> else, you just have some new things in your toolbelt that Oracle didn't add.
>
> Speaking of:
>
>
> *4. IT'S JUST "MORE" JAVA:*
> Everything that's added needs to "feel like Java". Again, it's a
> psychological thing: people will feel some malaise if they're using
> something that doesn't look like something they're used to, so it all has
> to be an *intuitive analogue* to something that already exists in Java.
>
> We all know what a getter and a setter is, so condensing them into one
> place is easy to understand. But what's a "closure"? What's a "delegate"?
> What's a "virtual thread"??? (I'm kidding.) People don't have a basis for
> these things in Java, so it's just *more* stuff to learn instead of
> already making sense to a Java-only programmer.
>
> I actually removed the idea of the `pojo` keyword from this proposal for
> this very reason: while it's clever shorthand for something that people do
> a lot, it *hides too much* from the writer. Where are the getters? Where
> are the setters? Do we access them by field or by method? How do we do
> internal member referencing? Can we extend classes? It's just too much
> hidden behind a single keyword, so it's not a good fit for this project,
> instead being partially covered by the declaration get/setters. Every
> addition needs to scan like Java at face value and feel like something
> Oracle themselves would have added.
>
>
> And on the backend:
>
> 2. Instead of COMPILING, we transpile it to Java source code
>
> Unlike with JVM bytecode, this one would transpile to Java 8 *source code*,
> letting a few things happen that *completely* change the game:
>
>
> *1. WE CAN USE JAVA'S TOOLS*
> Yeah so remember what I said about how "nothing will ever match Java in a
> Java space"? If you can't beat 'em, join 'em. By acting as a transparent
> frontend to real Java source code, we can leverage existing Java analyzers
> to do our linting for us. The IntelliJ system already has a variant of
> this for CLion's macro processing, being able to detect errors in the
> applied macro and display the code it'll be replaced with in a hover popup.
>
> We can also use Java debuggers to their fullest extent too: it'll link to
> the processed Java8 sources when we freeze on a breakpoint instead of the
> J+ sources, but once again that's a *feature*, not a bug. With a good
> enough formatter on the processor, they'll even thank us for it.
>
> We don't return anything, only being *syntactic* sugar instead of
> *library* sugar, so type-checking is a non-issue as well. (I *wanted* to
> add the ability to return from an outer function from inside an Optional,
> so I wouldn't have to do the "Optional Dance" whenever I wanted to get or
> return if null, but that would break the rules I highlighted above so it
> was a no-go.)
>
> No Java syntax rules are broken either - nothing new goes outside a
> method, for starters - so any community-made Java source plugins will work
> exactly the same on the unprocessed source as they would on the vanilla
> source.
>
>
> *2. W E C A N U S E J A V A ' S T O O L S*
> Again, you don't realize how huge this is. There's *no* overhead.
> There's no stuttering. No incorrect typing, no invalid templates, no
> broken plugins; it works *exactly* like normal Java, just with additional
> features. People won't have any excuse *not* to use it. It's purely
> helpful without breaking people's workflows in the slightest. (...save for
> some additional gradle configuration to point any other plugins to the
> processed sources, but just *sneezing* on the project does the same
> thing, so it's an acceptable loss imo)
>
>
> *3. It's great marketing for Groovy*
>
> Like I said before, people don't like to stray too far from what they
> know. They know Java, so they stick with Java. Oh, but now they know Java
> Plus too! But... by its very design, Java Plus can only do half of the
> things that Groovy can. So, if they want even *more* features, we tell
> them to go try Groovy! "It's just like this, but more!!!"
>
>
>
>
> So, do you get what I'm going for now? In the end, it *won't* end up all
> that different from Groovy in function, but that's not the point. The
> point is to be something that doesn't exist yet: an approachable set of
> useful features for people who otherwise would look at a whole other
> "language" and run away.
>
>
> As for marketing: I'm friends with some of the biggest Minecraft
> developers in the space; if something's going to be used by new Java
> developers, it'll be recommended by them. I can even get it packaged into
> the major modding frameworks for the game if it's intuitive enough, and
> from there it'll spread by word-of-mouth as long as there's no learning
> curve at all. It will improve readability, make you have to keep fewer
> things in your head while writing, and sort through your code easier; there
> will be no reason *not* to use it, which is exactly what I have in mind.
> Hell, if the features prove stable enough, we could even pitch them to
> Oracle for inclusion in the language proper.
>
> It'll be a great stress-test for some sorely-needed features in Java.
> Plus, it'll let me keep track of where my getters and setters are without
> having to open the Structure tab every five minutes. Win-win.
>
>
> So, have I sold you on it yet?
>
>
> Cheers,
>
> Caleb
>
> On Mon, Mar 25, 2024 at 11:35 AM OCsite <oc...@ocs.cz> wrote:
>
>> Caleb,
>>
>> On 24. 3. 2024, at 16:57, Caleb Brandt <ca...@gmail.com> wrote:
>>
>>> I know you made Groovy, but if you're anything like me, you *love* Java.
>>>
>>
>> just for one, although I haven't co-operated on the Groovy creation (am
>> just a very satisfied user), I *hate* Java very bitterly.
>>
>> The language design is simply *terrible*, all the worse since the people
>> who made that abomination, i.e., Sun, knew Objective C well (they used to
>> cooperate with NeXT on OpenStep) and thus *knew* how to do an
>> object-oriented language right.
>>
>> Instead they botched it *terribly*. No real polymorphism. Very limited
>> encapsulation. Type-system which effectively prevents (or at the very least
>> makes highly complicated and expensive) all the best and most important
>> object-oriented patterns like e.g., proxying and message forwarding.
>> Classes are not objects and their „methods“ do not support inheritance
>> properly. It is quite normal to access instance variables directly, instead
>> of consistent usage of accessors. *Heaps and heaps* of boilerplate.
>> Often, the darned thing limitations just force the IDEs to generate code —
>> compare e.g., WOLips. Could rant on for months like this :(
>>
>> Whilst languages like e.g., Kotlin or Scala fix some of the problems all
>> right, they, alas, do not allow to switch a big project from the Java
>> disaster without re-writing it at once and completely, which is a big
>> show-stopper.
>>
>> The vast advantage of Groovy is that you can take a big project, just
>> rename all *.java to *.groovy, and it will essentially work (well, as
>> someone already wrote, 99 % — my experience is rather 99.99 %, but indeed
>> there are things which need fixing and there are a couple of gotchas, but
>> there's really a very very small number of them). Then you can work on with
>> the project and gradually change the stupid Java patterns to the pretty
>> decent Groovy ones, part by part, method by method and if need be,
>> practically line by line, without losing any functionality during the
>> process. No other language I know of allows anything like this.
>>
>> All the best,
>> OC
>>
>>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Caleb Brandt <ca...@gmail.com>.
Hey all,
Welp, it looks like my summer will be completely booked in order to
graduate on time, so this idea is on hold for now. Thank you everyone for
your feedback! I look forward to speaking with you next year.
Cheers,
Caleb Brandt
On Sun, Mar 31, 2024 at 12:34 PM Jochen Theodorou <bl...@gmx.org> wrote:
> On 29.03.24 21:10, Caleb Brandt wrote:
> > Hey all,
> >
> > I'm very grateful for your feedback, and it's clear that you aren't
> > convinced that this will be helpful enough to be an Apache-sponsored
> > project.
>
> What do you understand under "Apache-sponsored"? I do for example use
> Project Lombok if I have the chance to do so and it has to be in Java. I
> think many here would. The things people have been pointing out are that
> you probably underestimate some of the problems and that there can be
> really silly reasons to reject something.
>
> I would for one not speak of that as a language, but just as a tool. And
> next you need good integration. It must be easy to use from an IDE and
> in a build... at least potentially.
>
> I can see how you could make the build variant a GSOC project. But under
> the Apache Groovy flag? I mean there is no advantage for Groovy we would
> get out of this. Right now it is mostly unrelated.
>
> If you wanted to make this a transform and with this a compiler
> extension, then this is a whole different matter. It would then be at
> least related to Groovy. But is there a path forward from this?
>
> Just why to explain why I mention transforms... they are annotation
> based pre-processors to some extend, just on the AST level instead the
> source level. Unlike in Java transforms are allowed to mutate the
> classes in almost any way.
>
> bye Jochen
>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Jochen Theodorou <bl...@gmx.org>.
On 29.03.24 21:10, Caleb Brandt wrote:
> Hey all,
>
> I'm very grateful for your feedback, and it's clear that you aren't
> convinced that this will be helpful enough to be an Apache-sponsored
> project.
What do you understand under "Apache-sponsored"? I do for example use
Project Lombok if I have the chance to do so and it has to be in Java. I
think many here would. The things people have been pointing out are that
you probably underestimate some of the problems and that there can be
really silly reasons to reject something.
I would for one not speak of that as a language, but just as a tool. And
next you need good integration. It must be easy to use from an IDE and
in a build... at least potentially.
I can see how you could make the build variant a GSOC project. But under
the Apache Groovy flag? I mean there is no advantage for Groovy we would
get out of this. Right now it is mostly unrelated.
If you wanted to make this a transform and with this a compiler
extension, then this is a whole different matter. It would then be at
least related to Groovy. But is there a path forward from this?
Just why to explain why I mention transforms... they are annotation
based pre-processors to some extend, just on the AST level instead the
source level. Unlike in Java transforms are allowed to mutate the
classes in almost any way.
bye Jochen
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Caleb Brandt <ca...@gmail.com>.
Hey all,
I'm very grateful for your feedback, and it's clear that you aren't
convinced that this will be helpful enough to be an Apache-sponsored
project. With that in mind, I ask this:
If you don't think it's good enough, then do something about it. Mentor me.
1. GSoC participant organizations are under no obligation to use the code
at the end of the project, and not a single cent comes out of the
organization's pocket for the work.
2. All that would be required of any mentor is a brief survey of my
progress every 4 weeks and giving me access to people who can answer
questions over the course of the summer.
3. If it *truly* ends up not being useful, then all you've done is 1: allow
a moderately-niche tool to be developed, and 2: provide a young creator
with the skills to be a POWERFUL Groovy contributor in the future. But, if
it ends up being what I think it is, then you've both allowed a
tremendously-helpful project to succeed and created the best advertisement
for Groovy possible. Either way, everyone involved wins.
This idea is provably workable, I believe it fills a niche that is not
currently covered by Groovy, and I have the connections to popularize its
usage. If you don't trust anything, trust that.
Please consider mentoring for this project. Even if it flops, it will be a
tremendous experience that can only help my contributions to Apache in the
future.
Thank you,
Caleb Brandt
On Wed, Mar 27, 2024 at 8:28 AM Jochen Theodorou <bl...@gmx.org> wrote:
> On 25.03.24 21:17, Caleb Brandt wrote:
> [...]
>
> If you do
>
> class X {
> String foo = "bar"
> get() { return this.foo; }
> set(x) { this.foo = x; doSomethingElse()}
> }
>
> then the call to doSomethingElse is on line 4. But what will happen if
> the IDE find doSomethingElse does not exist and wants to mark the call?
> If the IDE works on the Java code for this the position will be wrong.
> Yes, you would get an error message that is fitting as in
> "soSomethingElse not found"... maybe even the correct line. This means
> your IDE would have to know how to translate back to the code you
> actually wrote. That is why this probably ends up as extension for the
> compiler... which the IDEs may or may not support. I think Manifold is
> doing that.
>
> > We all know what a getter and a setter is, so condensing them into one
> > place is easy to understand.
>
> Sure, then I can write
> private String foo = ("bar", {->this.foo}, {x->this.foo=;
> doSomethingElse()})
> And you will totally understand... right.. right?? I mean there are so
> much in one place, you can barely compress this more and still write the
> code. Well.. to get more serious again. You should not underestimate the
> challenges of language design. And yes, this can be as bad as: "eh... it
> is using begin/end instead of curly braces? Nah, don't like it".. "why
> are there no blocks? There are? Oh the space is significant for this!?".
> And I am not kidding. the first Is a C-guy disliking anything Pascal,
> the second is all about Python.
>
> > But what's a "closure"? What's a
> > "delegate"? What's a "virtual thread"??? (I'm kidding.) People don't
> > have a basis for these things in Java, so it's just /more/ stuff to
> > learn instead of already making sense to a Java-only programmer.
>
> closures are quite similar to lambdas. The delegate concept is not the
> difficult part. The difficult part is that you attach a code block to a
> method and then the method does something with the code block. Ah yes...
> conceptually those lambdas are also very near to anonymous inner
> classes. A concept existing in Java for a long time already. It is all
> about the approach really. Of course if the people you are showing this
> are not open to the concepts and different views, then you can forget
> about it. I for example never discuss with people about static
> compilation if I get the impression they are thinking the false security
> of static compilation solves all their problems in life.
>
> [...]
> > Every addition needs to scan like Java at face value and
> > feel like something Oracle themselves would have added.
>
> With lambdas they did quite the style break in my opinion. They did it
> before though... with enums for example. And don't get me started about
> generics or the switch-case. I really doubt I would be able to tell of a
> new feature if it is as if Oracle themselves would have added it. In the
> end that is not the key-point. It is how the new features work and look
> together with the overall language. For example we had a feature request
> to support "statement if expression", meaning "if (expression)
> statement". Which exists in some language, but we decided against,
> because it does not fit the style of the Groovy language.
>
> [...]
> > _*1. WE CAN USE JAVA'S TOOLS*
> > _
> > Yeah so remember what I said about how "nothing will ever match Java in
> > a Java space"? If you can't beat 'em, join 'em. By acting as a
> > transparent frontend to real Java source code, we can leverage existing
> > Java analyzers to do our linting for us.
>
> But it is not fully transparent. It is one-way.
>
> > The IntelliJ system already
> > has a variant of this for CLion's macro processing, being able to detect
> > errors in the applied macro and display the code it'll be replaced with
> > in a hover popup.
>
> But the preprocessor in C/C++ was made part of the compiler even though
> it originally existed and was intended as independent tool. It just did
> not work, because of the line numbering being messed up. Back in the day
> there existed quite a few languages that transpiled to C, all of them
> got eventually their own compiler. In the word of gcc for example you
> have many languages that compile to shared representation in memory,
> which is then actually compiled to the target platform. This way you
> have a front-end for Modula and one for C++, but lots of the back-end
> part is still the same. In the end it is still like transpiling to C,
> just on a different level, where the source does not matter.
>
> > We can also use Java debuggers to their fullest extent too: it'll link
> > to the processed Java8 sources when we freeze on a breakpoint instead of
> > the J+ sources, but once again that's a /feature/, not a bug. With a
> > good enough formatter on the processor, they'll even thank us for it.
>
> For this there is actually support in the Java bytecode world. If the
> IDE can figure out from the file name attribute and the class name what
> file to open, then the correct position in that source can be opened.
> In your case the opened source would have to be the generated Java
> source, since the IDE would not automatically know how that position
> translates to a position in J+ sources.
>
> [...]
> > No Java syntax rules are broken either - nothing new goes outside a
> > method, for starters - so any community-made Java source plugins will
> > work exactly the same on the unprocessed source as they would on the
> > vanilla source.
>
> I think your getter/setter sugar has potential to break this.
>
> > String foo = "bar";
> >
> > get() {
> > return foo;
> > }
> >
> > set(newVal) {
> > foo = newVal;
> > doOtherThing();
> > }
>
> If I let Javadoc process this, it will not see getBar and setBar, it
> will see get() and set(newVal), probably getting a fit other the
> variable not having a type. And if you have multiple properties you will
> have multiple set and get method with very equal signatures. Many tools
> will not expect that, since that is not valid Java syntax.
>
> [...]
> > People won't have any excuse /not/ to use it.
>
> People have excuses for still using Java8. I myself hated generics so
> much I tried to avoid using them for many years whenever possible. And I
> still try to use them sparingly.
>
> bye blackdrag
>
>
>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Jochen Theodorou <bl...@gmx.org>.
On 25.03.24 21:17, Caleb Brandt wrote:
[...]
If you do
class X {
String foo = "bar"
get() { return this.foo; }
set(x) { this.foo = x; doSomethingElse()}
}
then the call to doSomethingElse is on line 4. But what will happen if
the IDE find doSomethingElse does not exist and wants to mark the call?
If the IDE works on the Java code for this the position will be wrong.
Yes, you would get an error message that is fitting as in
"soSomethingElse not found"... maybe even the correct line. This means
your IDE would have to know how to translate back to the code you
actually wrote. That is why this probably ends up as extension for the
compiler... which the IDEs may or may not support. I think Manifold is
doing that.
> We all know what a getter and a setter is, so condensing them into one
> place is easy to understand.
Sure, then I can write
private String foo = ("bar", {->this.foo}, {x->this.foo=;
doSomethingElse()})
And you will totally understand... right.. right?? I mean there are so
much in one place, you can barely compress this more and still write the
code. Well.. to get more serious again. You should not underestimate the
challenges of language design. And yes, this can be as bad as: "eh... it
is using begin/end instead of curly braces? Nah, don't like it".. "why
are there no blocks? There are? Oh the space is significant for this!?".
And I am not kidding. the first Is a C-guy disliking anything Pascal,
the second is all about Python.
> But what's a "closure"? What's a
> "delegate"? What's a "virtual thread"??? (I'm kidding.) People don't
> have a basis for these things in Java, so it's just /more/ stuff to
> learn instead of already making sense to a Java-only programmer.
closures are quite similar to lambdas. The delegate concept is not the
difficult part. The difficult part is that you attach a code block to a
method and then the method does something with the code block. Ah yes...
conceptually those lambdas are also very near to anonymous inner
classes. A concept existing in Java for a long time already. It is all
about the approach really. Of course if the people you are showing this
are not open to the concepts and different views, then you can forget
about it. I for example never discuss with people about static
compilation if I get the impression they are thinking the false security
of static compilation solves all their problems in life.
[...]
> Every addition needs to scan like Java at face value and
> feel like something Oracle themselves would have added.
With lambdas they did quite the style break in my opinion. They did it
before though... with enums for example. And don't get me started about
generics or the switch-case. I really doubt I would be able to tell of a
new feature if it is as if Oracle themselves would have added it. In the
end that is not the key-point. It is how the new features work and look
together with the overall language. For example we had a feature request
to support "statement if expression", meaning "if (expression)
statement". Which exists in some language, but we decided against,
because it does not fit the style of the Groovy language.
[...]
> _*1. WE CAN USE JAVA'S TOOLS*
> _
> Yeah so remember what I said about how "nothing will ever match Java in
> a Java space"? If you can't beat 'em, join 'em. By acting as a
> transparent frontend to real Java source code, we can leverage existing
> Java analyzers to do our linting for us.
But it is not fully transparent. It is one-way.
> The IntelliJ system already
> has a variant of this for CLion's macro processing, being able to detect
> errors in the applied macro and display the code it'll be replaced with
> in a hover popup.
But the preprocessor in C/C++ was made part of the compiler even though
it originally existed and was intended as independent tool. It just did
not work, because of the line numbering being messed up. Back in the day
there existed quite a few languages that transpiled to C, all of them
got eventually their own compiler. In the word of gcc for example you
have many languages that compile to shared representation in memory,
which is then actually compiled to the target platform. This way you
have a front-end for Modula and one for C++, but lots of the back-end
part is still the same. In the end it is still like transpiling to C,
just on a different level, where the source does not matter.
> We can also use Java debuggers to their fullest extent too: it'll link
> to the processed Java8 sources when we freeze on a breakpoint instead of
> the J+ sources, but once again that's a /feature/, not a bug. With a
> good enough formatter on the processor, they'll even thank us for it.
For this there is actually support in the Java bytecode world. If the
IDE can figure out from the file name attribute and the class name what
file to open, then the correct position in that source can be opened.
In your case the opened source would have to be the generated Java
source, since the IDE would not automatically know how that position
translates to a position in J+ sources.
[...]
> No Java syntax rules are broken either - nothing new goes outside a
> method, for starters - so any community-made Java source plugins will
> work exactly the same on the unprocessed source as they would on the
> vanilla source.
I think your getter/setter sugar has potential to break this.
> String foo = "bar";
>
> get() {
> return foo;
> }
>
> set(newVal) {
> foo = newVal;
> doOtherThing();
> }
If I let Javadoc process this, it will not see getBar and setBar, it
will see get() and set(newVal), probably getting a fit other the
variable not having a type. And if you have multiple properties you will
have multiple set and get method with very equal signatures. Many tools
will not expect that, since that is not valid Java syntax.
[...]
> People won't have any excuse /not/ to use it.
People have excuses for still using Java8. I myself hated generics so
much I tried to avoid using them for many years whenever possible. And I
still try to use them sparingly.
bye blackdrag
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by Caleb Brandt <ca...@gmail.com>.
Thank you all so much for your insight! And I'm not being facetious here;
you guys keep blasting away the points that don't hold water, so I think
I've finally nailed down *why* I feel this project is so necessary.
Because you're absolutely right: Groovy already *does* do much of what I
want. In terms of contributing new functionality to the ecosystem, my
project isn't necessary in the slightest. My argument is entirely borne
out of *ignorance* to what Groovy can do.
But to be honest... that's kind of the *point*. It's absolutely IGNORANT,
and that's absolutely *WRONG*, but even still, it *is*.
See, I've been programming in Java for around seven years at this point.
I'm very immersed in the Minecraft dev space, and I've worked with others
on non-Minecraft things as well, like working on toolchains and libraries,
contributing to a handful of personal projects, etc. And as a member of
those spaces, the "vibe" that I've gotten is this: "the non-Java JVM
languages are clunky".
See, Groovy has exactly two things going against it for reaching the most
people: it's a *language*, and it's *compiled*. Now that might sound odd
to criticize, but bear with me.
1. As another language, it is *inherently* intimidating to people who
aren't familiar with it.
People are closed-minded, and like to stick to what they know. I know when
I see "Foo.groovy" on Github, I immediately go "oh god", though it
*absolutely* isn't warranted! Fact is, people who use Java and know their
way around it like the back of their hand don't want to go relearn how to
speak in code just to do the same thing a tiny bit easier.
Their instinct is to go:
> "I've never used Groovy, and I never intend to, because I'm fine with
> Java. I can do everything I need to with Java. Why do people have to be
> weird and use something that isn't Java when writing a Java program? I
> don't want to have to learn a new language just to sift through this."
>
It doesn't really matter if it's identical to Java in most places, the very
*name* not being "Java" is enough to spook people who aren't familiar with
it. Sure, once you get to know it, you realize there was never any reason
to be intimidated, but that's a leap too far for most people when they
could just... *not* use it, without any consequence.
Even as someone who tries to be more open-minded than most people, I *still*
find myself having that instinct. Even though I know my fear of Groovy was
unwarranted, it doesn't change the fact that it *took this conversation* to
change my mind about it. Very few people are going to have this
conversation; most are just going to say "oh, that's neat, I guess" and
leave it.
And also:
2. As a compiled language, any analysis tools need to be specifically
written *for Groovy*, and they just can't match the ones for Java.
And that's no fault of Groovy's! See, even if we got the* brightest minds*
in the world together to make a static analyzer, debugger, and suite of
tools for Groovy, Java still has *twenty years* on us. It's just a fact:
without massive resources, we can't match the tools made for Java.
Debuggers will fail inside Closures, static analyzers will infer the wrong
types and throw false errors, and IDEs
Even if we could theoretically do all of that *better than Java*, we'll
inevitably still be working in a *Java-based* ecosystem. Any tools made
are implemented in a Java IDE: analyzers are slower, intellisense loses
track of where things are defined, postfix completions have to be
redefined, templates stop working; *every single thing* has to be retooled
for Groovy. And that includes community-made plugins too!
It's unfortunate, but it's a fact: any non-Java JVM language will - by
virtue of not being Java - be slightly more clunky than Java in a
Java-based ecosystem.
But they're still worth it, right?
Of course they are! But that doesn't matter if no one *uses them*.
See, you can *tell* when it fails where Java wouldn't. You notice when it
takes slightly longer for errors to pop up, when types get inferred
incorrectly, when intellisense can't find your class and you have to
manually go and search for the reference to import. It's *annoying* to
have to take over for something that worked seamlessly before.
Again, it's no fault of the *language*, it's just the fact that our tools
are *inevitably* going to be slightly less refined than ones made by a
company doing it for profit.
But when you're *already* feeling the malaise from being immersed in a
somewhat-new language and you notice that the things you've taken for
granted are suddenly *failing*, what impression do you get about the
language? In my experience: that it's a novelty, one that's slightly worse
in your experience than the one you're used to.
*That's* what I'm trying to solve here. It's not a matter of *features*,
it's a matter of *accessibility* and making sure people *don't feel
disinclined* to continue past their first glance at it.
So how do you do that? How do you get people to take that leap - to
continue past that cliff that stops people from continuing past their first
impression?
It's simple: don't let there be any leap at all.
1. Forget the "language" part. Show your features for what they are: *tiny
addons* for the language they already know.
There are a few parts to making it as approachable as possible:
*1. The NAME:*
There's a reason I didn't call it "Latte", "Javaccino", or "Mocha" instead
of "Java Plus". To be honest, even *THAT* might be too much; *everything
about it* needs to emphasize that it is *NOT* a new language.
I'd describe it as "A *few* *tiny* (eensy-weensy teeny-weeny) snippets to
save you time writing things you constantly use", and specifically
accentuate the *small* part. It needs to *feel* like something you can
just "click on" without any commitment on your part.
*2. DROP-IN INSTALLATION:*
People need to be able to plug it into their preexisting project without
*any* action on their part besides pasting in the plugin. *Not even any
file extension changes.* If it *looks* like it isn't Java from far away,
people will *feel* like it isn't Java.
We can do this fairly easily: take all of the Java files, scan them for our
constructs, generate new source files with their transpiled counterparts,
and give the new files to javac. We actually do a very similar thing in
MinecraftForge already: source files are copied to the `out` directory,
where tokens are replaced and deobfuscated method calls are mapped to their
obfuscated counterparts before the new sources are passed on to the
`compile` task.
The only problem with this approach is that you end up having two identical
sets of source files: one in the src directory, and one in the out
directory. However, this actually turns from a bug into a *feature*
because of the third step:
*3. DROP-OUT REMOVAL:*
It's Java allllll the way down. If you want to stop using it, awesome!
Everything gets converted to plain ol' Java, so every single one of the
vanilla Java files are RIGHT THERE for you to use outside of this project.
This is also why TypeScript is so approachable: you can add or remove it at
any time without any impact to your project. There's *no commitment* to
using the plugin in everything; you're still a Java developer like everyone
else, you just have some new things in your toolbelt that Oracle didn't add.
Speaking of:
*4. IT'S JUST "MORE" JAVA:*
Everything that's added needs to "feel like Java". Again, it's a
psychological thing: people will feel some malaise if they're using
something that doesn't look like something they're used to, so it all has
to be an *intuitive analogue* to something that already exists in Java.
We all know what a getter and a setter is, so condensing them into one
place is easy to understand. But what's a "closure"? What's a "delegate"?
What's a "virtual thread"??? (I'm kidding.) People don't have a basis for
these things in Java, so it's just *more* stuff to learn instead of already
making sense to a Java-only programmer.
I actually removed the idea of the `pojo` keyword from this proposal for
this very reason: while it's clever shorthand for something that people do
a lot, it *hides too much* from the writer. Where are the getters? Where
are the setters? Do we access them by field or by method? How do we do
internal member referencing? Can we extend classes? It's just too much
hidden behind a single keyword, so it's not a good fit for this project,
instead being partially covered by the declaration get/setters. Every
addition needs to scan like Java at face value and feel like something
Oracle themselves would have added.
And on the backend:
2. Instead of COMPILING, we transpile it to Java source code
Unlike with JVM bytecode, this one would transpile to Java 8 *source code*,
letting a few things happen that *completely* change the game:
*1. WE CAN USE JAVA'S TOOLS*
Yeah so remember what I said about how "nothing will ever match Java in a
Java space"? If you can't beat 'em, join 'em. By acting as a transparent
frontend to real Java source code, we can leverage existing Java analyzers
to do our linting for us. The IntelliJ system already has a variant of
this for CLion's macro processing, being able to detect errors in the
applied macro and display the code it'll be replaced with in a hover popup.
We can also use Java debuggers to their fullest extent too: it'll link to
the processed Java8 sources when we freeze on a breakpoint instead of the
J+ sources, but once again that's a *feature*, not a bug. With a good
enough formatter on the processor, they'll even thank us for it.
We don't return anything, only being *syntactic* sugar instead of *library*
sugar, so type-checking is a non-issue as well. (I *wanted* to add the
ability to return from an outer function from inside an Optional, so I
wouldn't have to do the "Optional Dance" whenever I wanted to get or return
if null, but that would break the rules I highlighted above so it was a
no-go.)
No Java syntax rules are broken either - nothing new goes outside a method,
for starters - so any community-made Java source plugins will work exactly
the same on the unprocessed source as they would on the vanilla source.
*2. W E C A N U S E J A V A ' S T O O L S*
Again, you don't realize how huge this is. There's *no* overhead. There's
no stuttering. No incorrect typing, no invalid templates, no broken
plugins; it works *exactly* like normal Java, just with additional
features. People won't have any excuse *not* to use it. It's purely
helpful without breaking people's workflows in the slightest. (...save for
some additional gradle configuration to point any other plugins to the
processed sources, but just *sneezing* on the project does the same thing,
so it's an acceptable loss imo)
*3. It's great marketing for Groovy*
Like I said before, people don't like to stray too far from what they
know. They know Java, so they stick with Java. Oh, but now they know Java
Plus too! But... by its very design, Java Plus can only do half of the
things that Groovy can. So, if they want even *more* features, we tell
them to go try Groovy! "It's just like this, but more!!!"
So, do you get what I'm going for now? In the end, it *won't* end up all
that different from Groovy in function, but that's not the point. The
point is to be something that doesn't exist yet: an approachable set of
useful features for people who otherwise would look at a whole other
"language" and run away.
As for marketing: I'm friends with some of the biggest Minecraft developers
in the space; if something's going to be used by new Java developers, it'll
be recommended by them. I can even get it packaged into the major modding
frameworks for the game if it's intuitive enough, and from there it'll
spread by word-of-mouth as long as there's no learning curve at all. It
will improve readability, make you have to keep fewer things in your head
while writing, and sort through your code easier; there will be no reason
*not* to use it, which is exactly what I have in mind. Hell, if the
features prove stable enough, we could even pitch them to Oracle for
inclusion in the language proper.
It'll be a great stress-test for some sorely-needed features in Java.
Plus, it'll let me keep track of where my getters and setters are without
having to open the Structure tab every five minutes. Win-win.
So, have I sold you on it yet?
Cheers,
Caleb
On Mon, Mar 25, 2024 at 11:35 AM OCsite <oc...@ocs.cz> wrote:
> Caleb,
>
> On 24. 3. 2024, at 16:57, Caleb Brandt <ca...@gmail.com> wrote:
>
>> I know you made Groovy, but if you're anything like me, you *love* Java.
>>
>
> just for one, although I haven't co-operated on the Groovy creation (am
> just a very satisfied user), I *hate* Java very bitterly.
>
> The language design is simply *terrible*, all the worse since the people
> who made that abomination, i.e., Sun, knew Objective C well (they used to
> cooperate with NeXT on OpenStep) and thus *knew* how to do an
> object-oriented language right.
>
> Instead they botched it *terribly*. No real polymorphism. Very limited
> encapsulation. Type-system which effectively prevents (or at the very least
> makes highly complicated and expensive) all the best and most important
> object-oriented patterns like e.g., proxying and message forwarding.
> Classes are not objects and their „methods“ do not support inheritance
> properly. It is quite normal to access instance variables directly, instead
> of consistent usage of accessors. *Heaps and heaps* of boilerplate.
> Often, the darned thing limitations just force the IDEs to generate code —
> compare e.g., WOLips. Could rant on for months like this :(
>
> Whilst languages like e.g., Kotlin or Scala fix some of the problems all
> right, they, alas, do not allow to switch a big project from the Java
> disaster without re-writing it at once and completely, which is a big
> show-stopper.
>
> The vast advantage of Groovy is that you can take a big project, just
> rename all *.java to *.groovy, and it will essentially work (well, as
> someone already wrote, 99 % — my experience is rather 99.99 %, but indeed
> there are things which need fixing and there are a couple of gotchas, but
> there's really a very very small number of them). Then you can work on with
> the project and gradually change the stupid Java patterns to the pretty
> decent Groovy ones, part by part, method by method and if need be,
> practically line by line, without losing any functionality during the
> process. No other language I know of allows anything like this.
>
> All the best,
> OC
>
>
Re: [GSoC 2024] Idea: A Basic Superset of Java | Java+
Posted by OCsite <oc...@ocs.cz>.
Caleb,
> On 24. 3. 2024, at 16:57, Caleb Brandt <ca...@gmail.com> wrote:
>> I know you made Groovy, but if you're anything like me, you love Java.
just for one, although I haven't co-operated on the Groovy creation (am just a very satisfied user), I hate Java very bitterly.
The language design is simply terrible, all the worse since the people who made that abomination, i.e., Sun, knew Objective C well (they used to cooperate with NeXT on OpenStep) and thus knew how to do an object-oriented language right.
Instead they botched it terribly. No real polymorphism. Very limited encapsulation. Type-system which effectively prevents (or at the very least makes highly complicated and expensive) all the best and most important object-oriented patterns like e.g., proxying and message forwarding. Classes are not objects and their „methods“ do not support inheritance properly. It is quite normal to access instance variables directly, instead of consistent usage of accessors. Heaps and heaps of boilerplate. Often, the darned thing limitations just force the IDEs to generate code — compare e.g., WOLips. Could rant on for months like this :(
Whilst languages like e.g., Kotlin or Scala fix some of the problems all right, they, alas, do not allow to switch a big project from the Java disaster without re-writing it at once and completely, which is a big show-stopper.
The vast advantage of Groovy is that you can take a big project, just rename all *.java to *.groovy, and it will essentially work (well, as someone already wrote, 99 % — my experience is rather 99.99 %, but indeed there are things which need fixing and there are a couple of gotchas, but there's really a very very small number of them). Then you can work on with the project and gradually change the stupid Java patterns to the pretty decent Groovy ones, part by part, method by method and if need be, practically line by line, without losing any functionality during the process. No other language I know of allows anything like this.
All the best,
OC