|
At last years APL2000 conference, I really enjoyed Fred and Jairo's
JS training. (Question. What the difference between JavaScript and
JS. Answer. A lawyer.) So this year I signed up for their sessions
again. I was very surprised by how much progress they had made,
especially with their new "baby" an APL interpreter written
in JS called "APL2000.JS".
Hopefully Fred will get time to produce a proper write up for Vector
on this new interpreter, but in the mean time, I will try to convey
to you what the significance of it is and how it all fits together
.
The Goal - Run APL code on your PC (the client) supplied via a
web page (the server), with nothing on your machine but your web
browser.
OK, using Microsoft's fully JS enabled Internet Explorer Browser
, you visit a web page. The browser downloads 3 ASCII files being
an HTML page, and two JS files (the APL interpreter "APL2000.JS",
and the workspace "<wsid>.JS"). The browser displays
the HTML, which invokes the JS APL interpreter, which loads and
runs the APL workspace. Neat.
What is amazing is that "APL2000.JS" is only 30Kb of
JavaScript, that is 30Kb of ASCII text, and the workspace is also
simple text. (How big? How long is a piece of string?) For comparison
Adrian's APL2741 font larger at 32Kb and that is after being zipped!
How is this achieved? Fred and Jairo have written a new user command
]JSAVE which the APL programmer uses to convert functions
from the workspace into the "APL JS" ASCII workspace.
What about screen interactions, forms, buttons, fields, SI
calls etc? JS supports them all via the browser. The ]JSAVE command
converts the APL2000 style parameters into JS so the JS engine in
the browser handles them all.
This is all currently working but not yet in Beta testing, as some
features still need to be finalised.
Current "issues", "problems" and "features"
This is all still under development, Fred and Jairo only got it
working a week or so before the conference. By the time you receive
the Vector containing this report, many changes will have occurred.
However at the time of the conference Fred raise the following points:
No support for multi-dimensional vectors. Vectors
and Vectors of Vectors (nested arrays) ARE supported. JS currently
just does not support multi-dimensional vectors of any data type,
so neither can APL2000.JS
RunAtServer. Some operations, rather than running
on the client, will need to be passed back over the network to
the server, to be run there. This is supported, the server can
have the standard APL2000 interpreter running, processing the
RunAtServer requests.
However the RunAtServer operations is in realty
an OPERATOR not a FUNCTION (strict APL meanings here) as it takes
both functions and data as its arguments. The current APL2000
interpreter does not support User Defined Operators, which is
what is really need here. Fred and Jairo have coded round this
is in the time honoured APL tradition effectively via "execute"
with the subsequent requirement of doubling up on quotes, but
were open to suggestions as they should code it.
The result of code being RunAtServer will effect
the style of writing your APL, just as happened between writing
APL for running under DOS and then under "Event Driven"
Windows. When running code over TCP/IP (E.G. the Internet) a result
CANNOT be guaranteed. Requests time out, connection get dropped,
networks go down, sites get overloaded. You cannot be sure a request
has been received, or if received, actioned, until an acknowledgement
has been received back. The acknowledgement itself my get lost,
or delayed. As a consequence, incoming "acknowledgements"
are effectively events that you use to trigger the next part of
you code. (This is a requirement of writing code to run over "imperfect"
networks, not a result of a poor implementation of RunAtServer.)
So following a RunAtServer request, the code awaits an event that
could be say, a time-out, the user aborts the process, or the
acknowledgment of success. How each of these events is handled
will be up to the programmer.
ListView. The ListView common custom control
is not available on all platforms. So running programs containing
ListView controls will not work without supplying additional programs
to run it on say the iMAC. (I am not clear on the exact limitations
here; my notes on this point are incomplete.)
Zero Footprint. (I am unsure of the exact details
here, what follows is my belief, but don't take it as gospel.
Much depends on the setting of your browser privacy and security
"options". ) The average web user, armed with IE 6.0,
on visiting a web page containing APL2000.JS code, will, on the
first visit, invisibly and automatically download the APL2000.JS
and the associated workspace along with the HTML. On subsequent
visits, these files will only be downloaded if they have changed.
This is normal practise at any site with JS or JavaScript, but
not quite a Zero Footprint. I believe a true Zero Footprint; can
be obtained if really required by setting your security/privacy
at the "Paranoid" type level.
Offline viewing. Can the web pages with APL2000.JS
be viewed off-line? Yes, if the do not contain RunAtServer requests,
and you save the web page explicitly for Offline viewing.
The browser BACK button. If the user who is actively
running an APL2000.JS workspace, presses the BACK button on the
browser, APL sees this effectively as ")OFF". A subsequent
press of the FORWARD button will re-load the web page and start
the LX. To prevent this, the initial web page should do
nothing except "open in new window" the web page containing
the APL2000.JS and workspace. This new window (being new) will
have its BACK button greyed out, preventing any problems. By switching
to the initial web page, the user can still navigate through the
session history via the BACK and FORWARD buttons safely without
effecting APL2000.js
Speed. A major point of issue with APL interpreters
is often speed. How fast/slow is a program? Well, in the friendly
words on the back cover of the "Hitch Hikers Guide to the
Galaxy" DON'T WORRY! In tests using, IE 6.0, APL2000.JS is
FASTER than APL2000.EXE! (Shock! Horror! Gasp!)
APL2000.JS is a major achievement, with very far reaching consequents.
|