🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #17876

Re: VB question: type mismatch

#17876
From: Olav Kvern
Date: Sat, 10 May 2003 19:56
23 lines
2795 bytes
Stu--

I don't want to get into a religious argument about Option Explicit. But I'll state my point of view, and let things fall where they may.

I think scripting languages should be loosly typed--why should a scripter--someone generally interested in a "fast and loose" solution to a particular problem--have to care about type type of a variable? Sure. All of Microsoft's recommendations say that it's "good programming practice" to declare all variables. And I agree--but it's not necessarily good *scripting* practice.

Yes, I like intellisense--that's the main reason that I Dim variables during development. If I am really concerned about script performance, I go back and declare variables to get the benefit of early binding.

re: "Impossible. A property or method can only return a single thing, variable or object, which has a specified type. That type can be a generic type, such as Variant or Object, but it's still a single type."

What I meant was that some properties/method return Variants that can be, for example, a constant or a string. This is slightly more difficult to deal with in VB.NET than it is in VB6.

re: "At any event, it's better to identify the errors at compile time than run time."

True, but if the error is a type mismatch error caused only by an unexpected return type vs. the variable's Dim statement, and the error would not cause the script to fail otherwise, it seems to me that the declaration is the problem itself!<g>

Again, I think loosly typed languages are better for scripting. If I want to use a strongly typed language for InDesign development, I'll write in C++ and use the SDK (which is quite good, by the way).

You also have to remember that part of my job is to teach graphic artists to script. If my example scripts start with a bunch of variable declarations, a large percentage of the folks I'm trying to reach simply give up. They're scared of words like "Double," "Integer," and the whole notion of value types. I'm not kidding.

Thanks,

Ole
Technical Details
Message-ID: <1de9125c.7@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de9125c.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,2e58c5c8e33c7ae1
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-05-10 13:07:36 PST
From: "Olav Kvern" <okvern@adobe.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: VB question: type mismatch
Message-ID: <1de9125c.7@WebX.la2eafNXanI>
Date: Sat, 10 May 2003 12:56:57 -0700
References: <1de9125c.-1@WebX.la2eafNXanI>
Lines: 45
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit