You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When compiled, this will produce no code, since the constructor is correctly determined to be pure.
When the class is generated through a factory, this inference does not seem to work. Consider for instance a factory which generates a class of points on a certain ray. Using this factory, we create a class DiagonalVec, which is the set of points with x=y.
the compiler outputs new ((b=>class{constructor(a){this.x=a;this.y=b*a}})(1))(2); In particular, the factory generated constructor was not proven to be pure.
How can I make the compiler figure this out, potentially using unsafe annotations such as @pureOrBreakMyCode ?
The text was updated successfully, but these errors were encountered:
In most cases, GCC is able to figure out if a constructor is pure. As an example, consider the
Vec
class, which is a 2 dimensional vector.When compiled, this will produce no code, since the constructor is correctly determined to be pure.
When the class is generated through a factory, this inference does not seem to work. Consider for instance a factory which generates a class of points on a certain ray. Using this factory, we create a class
DiagonalVec
, which is the set of points with x=y.Now if we compile this using
the compiler outputs
new ((b=>class{constructor(a){this.x=a;this.y=b*a}})(1))(2);
In particular, the factory generated constructor was not proven to be pure.How can I make the compiler figure this out, potentially using unsafe annotations such as
@pureOrBreakMyCode
?The text was updated successfully, but these errors were encountered: