java - Connection between operator overloading and JVM processing -
i need expert review on statement. encountered statement during recent java interview.
adding operator overloading java have made design more complex without it, , might have lead more complex compiler or slows jvm .
justify ?
from above lines have got 2 questions , how slow down jvm if assume there operator overloading support in java , because overloading being resolved during compile time , , jvm run time perspective (correct me if wrong @ this) .
by making complex compilers can have more freedom of business logic.
a couple of thoughts:
(1) overloading not resolvable @ compile time. subclasses may override methods , not know whether have parent or child class until code executes. don't know how operator overloading have been implemented, have same behaviour.
(2) don't think true. adding operator overloading (essentially syntactic sugar) not allow have more business logic. may express it more succinctly, it's same logic. consider following code, a
, b
, c
instances of same class (ie. they're not scalars). logic same, prefer different expression of it.
c = a.plus(b); c = + b;
Comments
Post a Comment