Shoutbox

[sug-script] Trace error with duplicate function names - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: WLM Plus! General (/forumdisplay.php?fid=23)
+----- Thread: [sug-script] Trace error with duplicate function names (/showthread.php?tid=86012)

[sug-script] Trace error with duplicate function names by SmokingCookie on 09-18-2008 at 03:56 PM

Hi,

Isn't it an idea to have Plus! trace an error if a function name is used more than once?


RE: [sug-script] Trac error with duplicate function names by Spunky on 09-18-2008 at 04:11 PM

Not really... If anything it could generate a warning in the debug window. IIRC using duplicate functions does not cause an error, but just uses the last instance of the function that has been defined (as if it has over-written the pevious function). The same happens for events I think; I can't check I'm at work


RE: RE: [sug-script] Trace error with duplicate function names by SmokingCookie on 09-18-2008 at 04:16 PM

quote:
Originally posted by SpunkyLoveMuff
IIRC using duplicate functions does not cause an error, but just uses the last instance of the function that has been defined (as if it has over-written the pevious function).

Or no events are called any more.....
RE: [sug-script] Trace error with duplicate function names by Spunky on 09-18-2008 at 06:25 PM

If that is the case, I'm sure I could make something that would alert you somehow...


RE: [sug-script] Trace error with duplicate function names by SmokingCookie on 09-18-2008 at 06:34 PM

Yeah, but I think Pathcou should make something in Plus! itself to alert scripters.. But that's just my opinion.


RE: [sug-script] Trace error with duplicate function names by matty on 09-18-2008 at 07:11 PM

In my honest opinion this shouldn't be added into the scripting engine. It is the developers responsibility to know what functions have been coded and what ones need to be coded. If something like this was added then where would addidtions to the engine stop?

When I found the problem with your script I commented everything out in the main js file and added a debug line to the Initialize. When it still didn't print out I removed every other .js file and slowly one by one added them back and restarted the script eachtime. When the script no longer would debug anything I knew the problem was with the file itself. So I commented every function and slowly uncommented 1 at a time to see what function was causing the problem. When I came across the duplicate function I knew what the problem was. This probably took me maybe 5 minutes.


RE: [sug-script] Trace error with duplicate function names by Burningmace on 09-23-2008 at 10:38 PM

The only place that features like this should be placed is in an IDE. If you want to go ahead and code one then feel free, otherwise just remember what function names you have used and what names you haven't.

In fact the feature request here should be that the scripting language (is it JavaScript?) should support overloading methods! If JavaScript is indeed used, then send that request over to Microsoft or whoever the hell regulates that god-awful language these days.