News for hackers. Stuff that matters.
Re:How an Optimizing Compiler Works by _bxg1 on Tuesday November 12, 2019 @12:08AM (#21511679)
Slightly off-topic, but does Java have standalone (without a class) functions now? He said he was using Java but I didn't recognize some of this syntax. I know it's been changing a lot the past few years (and it's been a few years since I've used it).
Re:How an Optimizing Compiler Works by dodobirdlord on Tuesday November 12, 2019 @03:20AM (#21512463)
Sort of yes but not really. Java has a concept now of a Functional Interface, an interface that has only one abstract method. Classes that implement a functional interface can be treated in a lot of ways like functions, and there is syntactic sugar that amounts to inferring that an object can be treated as a function by calling its only method if it is known in the scope as an interface type with only one method. There's also syntactic sugar for a concept called "lambdas", by which one can inline declare anonymous classes with only one method by just defining the method.
Re:How an Optimizing Compiler Works by quelltext on Tuesday November 12, 2019 @06:37AM (#21513314)
Nope. I think he simply used that notation to keep things simple/concise and focus on the important pieces.
Re:How an Optimizing Compiler Works by _bxg1 on Tuesday November 12, 2019 @09:04AM (#21514128)
That's what I was wondering. Odd decision in a post that works through code line by line and then translates it straight to bytecode.