bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] scripting )copy question


From: Juergen Sauermann
Subject: Re: [Bug-apl] scripting )copy question
Date: Mon, 6 Feb 2017 21:03:56 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

Hi Louis,

thanks, now I understand. The reason is most likely the way in which GNU APL executes scripts.

If one does )COPY script (as opposed to )COPY a workspace) then this causes the script to
be executed when APL returns to immediate execution mode. The main reason for this is that
if you execute the )COPY from a function (like enztec does) then variables and functions defined
in the script could become localized which I believe is fairly undesirable. Therefore the ⍎')COPY' basically
"orders" the execution of the script named in )COPY but does not execute the script before the interpreter
has returned to immediate ex3ecution. So when ⍎')FNS' is executed in the example, the copy has not
yet taken place. while the )FNS after returning from the function is in immediate execution after the )COPY
was done.

Maybe we should distribute our workspaces in .xml format rather than in .apl format (which is not
subject to this behavior).

/// Jürgen


On 02/06/2017 08:08 PM, Louis de Forcrand wrote:
If I understood correctly, you are asking why executing 

')COPY SQL.apl'

with the execute primitive inside another function does not copy the SQL workspace until after the surrounding function has ended.

I regret that I cannot answer you, but I am sure others here can. It would make their task easier however if you would use some punctuation and perhaps be somewhat more polite.

Louis

On 06 Feb 2017, at 19:04, address@hidden wrote:


yea the code in the script being run in the workspace with fns - not taking the code pieces out and running it in immediate execution in the workspace

i sure hope you see the difference between running immediate execution in a workspace and as a fns in a workspace



On Mon, 6 Feb 2017 18:54:23 +0100
Juergen Sauermann <address@hidden> wrote:

Hi,

maybe i am stupid, but for me it looks like you are opening a function called sqlite
in your script (between 1 and 2. If so then the subsequent lines belong to your function sqlite) ?

And further down I reads:
it is the same behavior in apl workspace which I interpret as meaning that the behavior in an apl script is the same as in an apl workspace?

But later you say:
i didn't ask about it in a workspace - my example was in a SCRIPT /// Jürgen



On 02/06/2017 04:47 PM, address@hidden wrote:

did you read the post?

i didn't ask about it in a workspace - my example was in a SCRIPT


On Mon, 6 Feb 2017 11:33:51 +0800
Elias Mårtenson <address@hidden> wrote:

It works for me:

Network listener started. Connection information: mode:tcp addr:40267
*      )fns*
*      )copy 5 SQL*
DUMPED 2017-02-06 11:25:33 (GMT+8)
*      )fns*
SQL∆Begin       SQL∆Columns     SQL∆Commit      SQL∆Connect
SQL∆Disconnect  SQL∆Exec        SQL∆Rollback    SQL∆Select
SQL∆Tables      SQL⍙metadata

Regards,
Elias

On 6 February 2017 at 10:10, <address@hidden> wrote:

#!/usr/local/bin/apl --script --

1
⍝⍎')copy SQL.apl' ⍝ for sqlite fns

∇sqlite

2
⍎')copy SQL.apl' ⍝ for sqlite fns

⍎')fns'   ⍝ doesn't show SQL∆Connect

db←'sqlite' SQL∆Connect '/sqlite/tutorial.db'
⍝db←'sqlite' ⎕sql[1] '/sqlite/tutorial.db'

....


∇

)fns    ⍝ shows SQL∆Connect

)off




the ⎕sql[1] is in the apl so using it doesn't require anything but
starting apl

the SQL∆Connect is a fns in the SQL.apl so to use it the )copy must be done

the question is why doesn't the 2 )copy in the sqlite fns bring in the
function SQL∆Connect until after the sqlite function is run - it says
dumped?

if i uncomment the   1 )copy the SQL.apl fns are loaded

it is the same behavior in apl workspace

      




reply via email to

[Prev in Thread] Current Thread [Next in Thread]