Go Back   Cockos Incorporated Forums > Projects > Deprecated REAPER issue tracker > Closed Issue

JSFX compiler: function overloading confusion Issue Tools
issueid=5269 07-08-2014 03:59 AM
Human being with feelings
JSFX compiler: function overloading confusion
When an overloaded function taking one parameter appears after one with none, compiler confusion ensues.

In a JSFX script, when creating a function with no parameters and then later in the code overloading this function with one parameter, the first function with no parameters will never be called: the function with one parameter will always be used in its place, while automatically assigning the newly-included single parameter a default value of 0. i.e. fx() => fx(0)

Here's a quick example:

Code:
desc:Problem

@init

function runThis() (
  variable1 = 1;
);

function runThis(parameter) (
  variable2 = parameter;
);

runThis();

// you would expect variable1 = 1, but instead variable2 = 0
// also, variable1 is never considered to exist
Workaround-wise, if the functions are listed in the opposite order then everything works as intended. Other combinations of parameter numbers (0 and 2, 1 and 2, ...) don't seem to be affected either, and adding a third function seems to help matters as well.

I'm experiencing this issue with Reaper x64 and Reaper x86 on Windows 8.1 x64.

The discussion thread is here.
Issue Details
Issue Type Closed Issue
Project Deprecated REAPER issue tracker
Category Plugins
Status Live With It For Now
Priority 5 - Medium
Affected Version Unknown
Closed Version (none)
Yes votes 0
No votes 0
Assigned Users (none)
Tags (none)

01-05-2015 02:01 PM
Mortal
 
I set this BR as "live with it", see http://forum.cockos.com/showpost.php...&postcount=241
Reply
Reply

Issue Tools
Subscribe to this issue

All times are GMT -7. The time now is 01:34 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.