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

  • #11
    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.

    Comment


    • #12
      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.

      Comment


      • #13
        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.

        Comment


        • #14
          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.

          Comment


          • #15
            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!

            Comment


            • #16
              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.

              Comment


              • #17
                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#.

                Comment

                Working...
                X