This was trivial a long time ago. Now, all Java GCs move objects in memory.
814 karma · joined January 8, 2017
This was trivial a long time ago. Now, all Java GCs move objects in memory.
So you have to use composition.
The code model can be computed by the compiler, inserted in the classfile in a specific binary or text format and read at runtime using the reflection API.
I've not taken a look to the implementation so it's speculation but I do not think the JVM need to be changed.
https://arstechnica.com/gadgets/2024/05/google-starts-deprec...
And you have JavaScript were all functions have an implicit this ...
s/jpackage/jextract/g> Iterative process
please send a link to a video of a designer from Oracle presenting the string templates at a conference. This is not Loom, there is no iterative process.
> Python, JS, and C# also don't allow for such a shortcut
The syntax of C# or Python is also lightweight, fine by me.
> it's not some special prefix
I get that, but not using a constant like STR is an anti-pattern, as you said it's a virtual method call.
> The criticism, on the other hand, seems to mostly come from people who have not actually tried it out
Ask designers to go to conferences and you will get real feedback.
Using '\' instead of '$' does not allow $variable as a shortcut to ${variable} making the syntax objectively harder to read.
Using '\' cleverly helps to detect when the processor is missing at compile time but it does not matter because the syntax mandates a big STR in front.
And editors will use different colors.
Using \ or $ is not about backward compatibility but about ergonomics.
If the string template is prefixed by a processor STR."foo" instead of "foo" then you do not need \{variable} instead of $variable.
Processor should not require to allocate a list of objects do to string templating. Only STR and FMT get good perf because they are specialized by the compiler.
Perhaps there is a manifest entry/flag so the command line flag is not required ?
Optional.of(op)
.filter(v -> !v.cond)
.map(v -> op2(v))
.filter(v2 -> !v2.cond)
.map(/* do more stuff */)
.orElseGet(() -> my_else)G1 only does the marking concurrently, the evacuation is done in small pauses. A decade ago, there was only one concurrent evacuation GC available in Java, C4 from Azul. Now, we have Shenandoah and ZGC.
The consequence is that you may define two classes, one non-mutable and one mutable like String/StringBuilder.
https://www.quora.com/The-license-agreement-of-Java-says-You...
ZGC is a concurrent GC, both the marking phase and the evacuation phase are done concurrently with the program running. A generational ZGC is a generational concurrent GC.
MS does not have such kind of tech.
It remember me the first proposed syntax for lambdas. Let's hope the next preview will fix that.
public class Main {
private static <T,R> Function<T,R> fun(Function<T,R> function) {
return function;
}
public static void main(String[] args) {
var add = fun(x -> fun(y -> x + y));
var addFive = add.apply(5);
int result = addFive.apply(3); // Output will be 8
}
}
Those helpers should be part of the JDK.In Java, value types are immutable so the VM can pass by value or by copy, as a user you don't see the difference and there are backward compatible (per the article), you don't need to recompile the user code when you replace an existing class by a value class.
C# has value types since the beginning so primitive types are value types while in Java it seems there will be 3 kinds of types instead of 2.
[1] https://learn.microsoft.com/en-us/dotnet/csharp/programming-...
For example, if your application receive JSON objects, you know all of them so, it's a closed hierarchy.
If the hierarchy is open, the behavior is defined in each subtypes and it's easy to add a new subtypes but you can not add a new operation (a new method). That's the OOP way.
If the hierarchy is closed, the behavior is defined in each function, it's easy to add a new operation (new function) but you can not add a new subtype. That's the ADT way.
This is known as the https://en.wikipedia.org/wiki/Expression_problem