Difference between C3.typesys.FunctionType and FunctionType Type

#1

I’m trying to inspect the methods defined on a Type, and realized that in Javascript I was getting C3.typesys.FunctionType instead of the FunctionType Type.
The documentation for the former can be found at:
http://localhost:8080/static/jsduck/index.html#!/api/C3.typesys.FunctionType
while the documentation for the latter can be obtained from the c3 javascript console via c3ShowType(FunctionType).

It looks like methods defined on FunctionType are different from those defined on C3.typesys.FunctionType . Why do we have the Javascript version? And how do I get access to the C3 Typesystem version, on an object?

Here’s an example of what I’m trying to do at the JS console:

// my example
scoreMetric = MLScoringMetric.make({
  name: "rootMeanSquaredError",
  higherIsBetter: false
});

// this fails because isOptional() is not defined on javascript's C3.typesys.FunctionArgumentType
scoreMetric.type().valueType("score").argument("prediction").isOptional()

// this returns "type FunctionType", indicating this is C3.typesys.FunctionType, not FunctionType
scoreMetric.type().valueType("score").type().toString()

I would like to get a FunctionType back from scoreMetric.type().valueType(“score”), so I can do more careful inspection of it’s declaration, particularly on the function arguments. I believe C3.typesys.FunctionType does not provide as rich a set of methods to query such information. How do I get back FunctionType in javascript (especially on the server side, where I intend to put this code)?

0 Likes