|
From: | Juergen Sauermann |
Subject: | Re: [Bug-apl] Feature suggestion: multiple function arguments |
Date: | Thu, 17 Mar 2016 15:16:04 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
Hi Peter, almost. Except that you should not (and cannot, and need not) use the name ⌶ but instead a normal, user-defined APL name. The old ⌶ (and also ⎕-names) were old "hacks" to achieve a particular purpose. But they have considerable downsides: localization, parser impacts, and source code portability. If we instead use normal user-defined names for introducing new functionalities then we have no parser impacts and another platform can emulate that functionality via a normal user-defined APL function (that may then call specific functions in the other platform if available). In practice this makes life rather simple: 1. You write a shared library, say my_lib.so. 2. contains the implementations those function header combinations that you want to provide. For example 'Z←A f B', 'Z←f B' and 'Z←f[X] B' 3. You bind the my_lib.so to an user defined APL name, for example 'my_lib.so' ⎕FX 'NEW_FUN' Step 3 has then created a new APL function NEW_FUN that, when called, executes the code in mylib.so. More precisely, when you call A NEW_FUN B in APL then the first implemented header will be executed, when you call NEW_FUN B then the second implemented header will be executed, and with NEW_FUN[X] B the third implemented header will be executed. All this still follows APL syntax and therefore the parser is not involved (the magic happens below the parser level). Your shared library has full access to the APL Interpreter at two points in time: when it is ⎕FX'ed and when the ⎕FX'ed functionis called. That means it can (as a side effect) create, modify, or delete APL variables, and you can even overload or extend the implementation of every build-in APL function (primitive functions, operators, and ⎕-functions). I believe all this gives us a lot of freedom to extend GNU APL within the boundaries of the APL syntax so that I can't see why we would need to change that syntax of APL if all we want to do is extend its functionality. /// Jürgen On 03/16/2016 10:46 PM, Peter Teeson
wrote:
Hi Jürgen: |
[Prev in Thread] | Current Thread | [Next in Thread] |