Article View: adobe.scripting.indesign
Article #1674Re: pls explain abt prototype
From: Simon_Paterson
Date: Tue, 03 Feb 2009 06:25
Date: Tue, 03 Feb 2009 06:25
5 lines
1915 bytes
1915 bytes
I can see where you are coming from, Harbs, but my example was just that, an example. In many other instances you would need separate functions for different data types and in those instances there would no benefit to using a function instead of an prototype. In fact, as I stated, in many situations it is often far more elegant to use a prototype because you pass less arguments. There is a lot more to be said about when and where to use prototypes but in the end it will probably come down to an individual's goal in terms of how they want their code to be structured. None of the reasons given here, besides potential performance impact, really touch on the reasons why prototypes are beneficial. In the context of the original question, however, it seems that we can probably say they have very little impact on the way someone might approach scripting InDesign (unknown performance impact issues aside). You can choose to use them, or choose not to. Put it this way, when you have written enough code that organisation through class structure and inheritence becomes key to efficiency, then prototyping will be something you want, rather than something you need.
Technical Details
Message-ID:
<59b78cbc.12@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newshub.sdsu.edu!webcrossingReferences:
<59b78cbc.-1@webcrossing.la2eafNXanI> <59b78cbc.0@webcrossing.la2eafNXanI> <859B1F6D0F3E1FCF27AD0D04CAE16809@in.webcrossing.la2eafNXanI> <DDF269DF388271AD269C94A88990C450@in.webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,ba3fc2ccca9a708d X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Simon_Paterson@adobeforums.com Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: pls explain abt prototype Message-ID: <59b78cbc.12@webcrossing.la2eafNXanI> Date: Mon, 2 Feb 2009 22:25:51 -0800 References: <59b78cbc.-1@webcrossing.la2eafNXanI> <59b78cbc.0@webcrossing.la2eafNXanI> <859B1F6D0F3E1FCF27AD0D04CAE16809@in.webcrossing.la2eafNXanI> <DDF269DF388271AD269C94A88990C450@in.webcrossing.la2eafNXanI> Lines: 20 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit