@evDistance, what @ means ?

hervé_pipon
hervé_pipon Member Posts: 60 ✭✭
Hello

When I look at the evDistance function définition in evaluate.fs, there is a callback to @evDistance...
What does that means?
Is the source code available ?


export function evDistance(context is Context, arg is map) returns DistanceResult
{
    var result = @evDistance(context, arg);
...

Comments

  • MichaelPascoe
    MichaelPascoe Member Posts: 2,965 PRO
    edited December 2023

    @ functions are faster. If calling the function thousands of times, this can make a difference.

    See this comment from Jacob explaining more on evDistance vs @ evDistance
    https://forum.onshape.com/discussion/comment/88979/#Comment_88979


    RENDERCAD - Photorealistic product rendering.
    CADSharp - Professional CAD + software consulting.

    ▚▞▚▞▚▞▚▞▚
  • _anton
    _anton Member, Onshape Employees Posts: 555 image
    edited December 2023
    Any identifier starting with '@' is a FeatureScript built-in. We don't expose the internals of these calls.

    We wrap our built-ins in FS functions in part because the results may need some massaging to be more nicely consumable. evDistance itself is a good example.

    (Michael is right, though - the function call overhead is nonzero, and you don't always need the wrapper.)