1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

KSP: user-defined function

Discussion in 'Feature Suggestions' started by kotori, Aug 9, 2006.

Thread Status:
Not open for further replies.
  1. kotori

    kotori NI Product Owner

    Messages:
    1,153
    User-defined functions are absolutely vital when trying to write maintainable and modular code following the DRY (Don't Repeat Yourself) design principle. Therefore I suggest extending the syntax to allow for user-defined functions. Although I have provided a layer of extended KSP syntax in my script editor/compiler as a workaround for K2's current limitations it suffers from some problems:
    • On compilation the code size unnecessarily increases in some cases (since I have no option but to inline all functions) which causes problems for large scripts due to Kontakt's internal editor not being able to cope with large texts. This Kontakt problem/bug effectively places an upper bound on the size of a script which is a serious problem.
    • It does not support return values.
    Here is an example of what the syntax could look like:
    Code:
    function calculate($a, $b)
        { ... calculations/processing ... }
        return $result
    end function
     
Thread Status:
Not open for further replies.