Clarify parametric new

Documentation on the parametric form of new{} is pretty scarce. This section says

new{T,S} can be used in any constructor definition, but for convenience the parameters to new{} are automatically derived from the type being constructed when possible.

but I wonder

  1. how exactly that works,
  2. if, in parametric methods, new(...) is just always silently replaced by an automatic new{...}(...), or the two forms are actually different.

(asking here before opening an issue)

1 Like

Question 1: If the name of the type is X, and the constructor has the form function X{...}(...) then the contents of the curly braces right after the X are passed to new.

Question 2: To make an instance, type parameters must have definite values, so new(...) is always equivalent to some new{...}(...). They will lower to the exact same thing.