[jawsscripts] Re: New import compiler directive

  • From: Andrew Hart <ahart@xxxxxxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Fri, 16 Mar 2012 11:27:42 -0300

Jim,

I'm afraid so.  You use "Use" to import a JAWS Script Binary file.  In
comparison, it appears you use "Import" to import a JAWS Script
Documentation file.

Now, most of the time, you don't need to use import because the Script
Compiler nows that when it Uses a .jsb file, it should also import the
corresponding .jsd file.  But if the .jsb file Uses other .jsb files,
which in turn use other .jsb files, and so on, the .jsd files
corresponding to those .jsb files that are nested deeper down in the
scope do not get imported because the Compiler simply isn't clever
enough to do it.  I don't know why FS just didn't modify the Compiler to
recursively scan Used .jsb files and make sure that all available .jsd
files were imported along with them, but I imagine is was simply more
expedient to create the new directive.

Oh, and on a lighter note and as an aside, please note that grok has no
"c" in it.  It is written g r o k.  The past participle is grokked (two
k's) while the present participle is grokking (also with two k's).  And
although it was invented by Robert Heinlein, it now appears in the
Oxford english dictionary.  For those on the list who haven't heard of
"to grok"before, Jim and I were using it in the sense of the OED
definition, rather than Heinlein's real meaning, which is somewhat more
profound.

Cheers,
Andrew.

On 15/03/2012 11:30 PM, Jim Snowbarger wrote:
> Did I fail to properly "grock" this discussion about Import?
> Does this import a jsb?  Or, what.
> 
> Such as
> Import "ttt.jsb"
> 
> I tried this under jaws 12 and it compiled.  But, it didn't actually work. 
> I was thinking this was a similar facility to that provided by the use 
> statement.
> I had a delicious theory about what it might actually be,  but isn't.  I'm 
> disphoric.
> 
> By the way, in case you don't grock the meaning of grock, contemplate the 
> following statement
> 
> Import Heinlein::Stranger In A Strange Land,
> 
> and see what comes up.
> If it still doesn't compute,  don't worry about it.
> 
> 
> ----- Original Message ----- 
> From: "Jim Snowbarger" <Snowman@xxxxxxxxxxxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Thursday, March 15, 2012 9:02 PM
> Subject: [jawsscripts] Re: New import compiler directive
> 
> 
> About Prototype,  too bad that jaws 10 remains one of my personal favorites.
> Fewer features, fewer quirks.
> 
> What I often found in HotSpotClicker, was that the main file got so huge,
> and I staarted to try to get more moduler and logically organized, and
> dedicate lower level files to particular logical portions of the program.
> It really is an application, written in jaws script, which stretches the
> language far beyond that for which it was intended.  I realize that.  But,
> often, I found that in one of those lower-level modules, I wanted to call a
> function that resided in another low-level file.  Naturally, the compiler
> didn't chase up the tree, then back down a different branch to find my
> prototype.
> So, this would have been handy.  Except ... dot dot dot
> 
> 
> 
> 
> 
> ----- Original Message ----- 
> From: "Doug Lee" <doug.lee@xxxxxxxxxxxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Wednesday, March 14, 2012 11:30 PM
> Subject: [jawsscripts] Re: New import compiler directive
> 
> 
> If a feature exists but is neither documented nor often used, and this
> condition long persists, there's sometimes a good reason. :-)
> 
> In this case, I think the Prototype directivve is useful, but not in
> very many situations as compared to an actual jsd entry. Most of the
> functions you'd want to call are declared in builtin.jsd, default.jsd,
> or directly in scripts you'd be chaining onto. Complex solutions like
> the scripts for Office applications are of course notable exceptions
> to this, but even there, the jsd files declaring the functions you
> want might load because they're downstream of your script file, unless
> you're doing something really outlandish like putting a wrapper of
> your own around a script file like WordFunc.jsb. I've been scripting
> for 12 years and have never had to pull a stunt quite like that.
> 
> So my advice is to consider first whether there's a more sensible
> solution, but if not, feel free to use Prototype, as long as you're
> fine with your scripts not compiling under anything older than JAWS
> 11, or maybe even JAWS 12 to be safe (in case early JAWS 11 versions
> don't support Prototype).
> 
> On Wed, Mar 14, 2012 at 10:39:34PM -0500, Jim Snowbarger wrote:
> Doug,
> What I would like to know is how the heck did you "stumble" across that.
> I've never seen that anywhere.
> You could make a jsh that just had lots of prototype statements, and in
> clude them in a host of jss files that all wanted to use those functions, ,
> and get around a lot of headaches.
> 
> 
> 
> 
> ----- Original Message ----- 
> From: "Doug Lee" <doug.lee@xxxxxxxxxxxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Wednesday, March 14, 2012 8:09 AM
> Subject: [jawsscripts] Re: New import compiler directive
> 
> 
> I believe the usage and function of the Import directive was explained
> in subsequent messages to this one. Someone raised the question of
> backward compatibility though.
> 
> Import will probably not work before JAWS 13. There is an undocumented
> alternative though, one I found years ago but that seems not to have
> started working until JAWS 11:
> 
> prototype string function f1(int a, string b)
> 
> can be used in a jss file to declare a function that is not declared
> in a jsd file in scope.  Practically, this means you can handle a
> compile error on a function call by copying its first line from its
> originating jss file into your jss file and putting the word
> "prototype" in front of the new line.
> 
> On Wed, Mar 14, 2012 at 12:13:09AM -0300, Andrew Hart wrote:
> Hi folks,
> 
> I stumbled across the following line of code in QuickSet.jsd recently,
> and a rather terse explanation buried in FileIO.jss.  However, it seems
> to be undocumented in the FSDN.  Grepping the all users settings\enu
> directory, There are a pile of scripts that use the Import directive.
> 
> I can't say I truely grok it, but it appears that the Import command is
> used for getting the Script Manager to load up function declarations
> (from jsd files) that are deeply nested in the script binary load scope.
>  I always thought that the Script Manager automatically loaded the jsd
> files associated with binaries referenced using the Use directive.  I am
> assuming that Import is needed because the compiler isn't actually
> clever enough to recursively scan through "Used" jsb files to find all
> the associated jsd files necessary to provide all the required function
> declarations, in case the top level script file calls a function buried
> 2 or more levels down in the scope (excluding functions in default.jss
> whose documentation one would expect the Script Manager to always have
> on hand).
> 
> Is anyone else aware of this or have I just been living on another
> planet for the last few years?
> 
> Cheers,
> Andrew.
> 
> 
> __________???
> 
> View the list's information and change your settings at
> //www.freelists.org/list/jawsscripts
> 


__________�

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

Other related posts: