Announcement

Collapse
No announcement yet.

Oracle Releases GraalVM 21.3 With Java 17 Support, Other Enhancements

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
    GreenToad
    Junior Member

  • GreenToad
    replied
    Originally posted by uid313 View Post

    Lambdas, streams, default parameters, C# has so much that you take for granted and then you code in Java and none of it is there.
    I much prefer C#.

    Thanks for the reply!
    True, I now write C# and there are some very few of things that c# lacks compared to java and it's annoying, so for someone coming from c# to java it would be incredibly infuriating to not have all the features of c#.

    Leave a comment:

  • Ironmask
    Senior Member

  • Ironmask
    replied
    Originally posted by tildearrow View Post
    By the way, C++ does have exceptions as well and the standard library does use many of them.
    It technically has exceptions but they're considered deprecated/bad practice due to being poorly implemented. I've never seen anyone actually suggest anyone use them. The total opposite, in fact. I'm pretty sure the standards committee says not to use them.

    Leave a comment:

  • uid313
    Senior Member

  • uid313
    replied
    Originally posted by bug77 View Post

    Well, Java6 was also 2013. Java has gained lambdas and streams since 8. 17 has stabilized records (~properties), which have been available for 2 or 3 releases in preview form.
    It's still missing coroutines/fibers and default parameters, for example.
    Lambdas, streams, default parameters, C# has so much that you take for granted and then you code in Java and none of it is there.
    I much prefer C#.

    Thanks for the reply!

    Leave a comment:

  • bug77
    Senior Member

  • bug77
    replied
    Originally posted by uid313 View Post
    Well, Java 6 (pretty much) when I used it was shitty, there were no properties (you had to declare your own get and set methods), there were no lambda/closures, etc. I much prefer C# over Java, but I don't know if Java has improved since then.
    Well, Java6 was also 2013. Java has gained lambdas and streams since 8. 17 has stabilized records (~properties), which have been available for 2 or 3 releases in preview form.
    It's still missing coroutines/fibers and default parameters, for example.

    Leave a comment:

  • uid313
    Senior Member

  • uid313
    replied
    Originally posted by barti_ddu View Post
    But even on old (pre-8) versions of Java You could use anonymous methods like this:

    Code:
    int x = new Object() {
    int fact(int i) {
    return i < 2 ? 1 : i * fact(i - 1);
    }
    }.fact(8);
    This wasn't idiomatic Java though.
    I see. In the code I wrote it was often I had to new up a class and override a function or something if I recall correctly, it was quite much boilerplate code.

    Leave a comment:

  • barti_ddu
    Phoronix Member

  • barti_ddu
    replied
    Originally posted by uid313 View Post
    Ah, thanks!
    Nice to see that Java got lambdas, I remember the lack of such was a pain point back when I used it for Android development.
    But even on old (pre-8) versions of Java You could use anonymous methods like this:

    Code:
    int x = new Object() {
        int fact(int i) {
            return i < 2 ? 1 : i * fact(i - 1);
        }
    }.fact(8);
    This wasn't idiomatic Java though.

    Leave a comment:

  • uid313
    Senior Member

  • uid313
    replied
    Originally posted by tildearrow View Post

    Fixed my post.
    By the way, C++ does have exceptions as well and the standard library does use many of them.
    Thanks, I didn't know this, I thought it didn't. I thought C++ was very low level and it couldn't have support for exceptions because exceptions requires rewinding the callstack which would require running the code in a virtual machine.

    Originally posted by tildearrow View Post
    Java 8 and higher have support for lambdas in the form of Predicate, using this syntax:
    Code:
    (arg) -> {
    CODE
    return <value>;
    }
    Ah, thanks!
    Nice to see that Java got lambdas, I remember the lack of such was a pain point back when I used it for Android development.

    Leave a comment:

  • tildearrow
    Senior Member

  • tildearrow
    replied
    Originally posted by uid313 View Post

    Yeah, that's one way to see it, but it also provides also garbage collection and exceptions.
    Fixed my post.
    By the way, C++ does have exceptions as well and the standard library does use many of them.

    Originally posted by uid313 View Post
    Well, Java 6 (pretty much) when I used it was shitty, there were no properties (you had to declare your own get and set methods), there were no lambda/closures, etc. I much prefer C# over Java, but I don't know if Java has improved since then.
    Java 8 and higher have support for lambdas in the form of Predicate, using this syntax:
    Code:
    (arg) -> {
      CODE
      return <value>;
    }
    tildearrow
    Senior Member
    Last edited by tildearrow; 20 October 2021, 03:39 PM.

    Leave a comment:

  • uid313
    Senior Member

  • uid313
    replied
    Originally posted by tildearrow View Post

    I think of it like a C++ but with more verbosity, no header files and a ultra-simplified type system in where everything is a pointer except for int, long, float, double, short, byte and char.
    Yeah, that's one way to see it, but it also provides also garbage collection and exceptions.

    Originally posted by bug77 View Post

    8 brought some functional-like traits to the language, but it has barely improved since. Everything in Java these days (the language, not JVM) is about catching up with features Kotlin or Scala have offered for years. GraalVM ain't gonna fix any of that
    It's not that the language itself is bad (it's quite readable, compared to many others), it's just that OOP everywhere doesn't really fit many of the things you're required to implement these days.
    Well, Java 6 (pretty much) when I used it was shitty, there were no properties (you had to declare your own get and set methods), there were no lambda/closures, etc. I much prefer C# over Java, but I don't know if Java has improved since then.

    Leave a comment:

  • bug77
    Senior Member

  • bug77
    replied
    Originally posted by uid313 View Post
    I used to code in Java 6 (and partly 7 and maybe 8) in Android, and it was really shitty, then came Kotlin which was a fresh breeze.
    How has Java evolved since then, and how is Java 17? Is it still shitty, or is it nice nowadays?
    8 brought some functional-like traits to the language, but it has barely improved since. Everything in Java these days (the language, not JVM) is about catching up with features Kotlin or Scala have offered for years. GraalVM ain't gonna fix any of that
    It's not that the language itself is bad (it's quite readable, compared to many others), it's just that OOP everywhere doesn't really fit many of the things you're required to implement these days.

    Leave a comment:

Working...
X