How to undo a scripted namespace ?

SALT, SPICE, Subversion, etc...

How to undo a scripted namespace ?

Postby PGilbert on Wed Apr 22, 2015 12:12 am

Suppose that you have a scripted namespace that you have downloaded from the internet and that you have installed in your workspace. What would be the procedure to 'unscript-it' (without any text representation of the namespace).

Thanks in advance.
User avatar
PGilbert
 
Posts: 361
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Re: How to undo a scripted namespace ?

Postby Phil Last on Wed Apr 22, 2015 7:02 am

I believe SALT contains a facility to read a script and disperse its contents into the root. I don't know if you can target a normal or unnamed space created with ⎕NS.

Alternatively it's a one-liner dfn to do the same thing to a script that's already in the ws.Using ⎕NS on it's own merely clones the script. It's a bit more complicated if the script is nested.
User avatar
Phil Last
 
Posts: 460
Joined: Thu Jun 18, 2009 6:29 pm

Re: How to undo a scripted namespace ?

Postby Vince|Dyalog on Wed Apr 22, 2015 9:30 am

Hi Pierre and Phil,



In this example, ns_script.txt is a namespace script in a UTF-8 file and #.myns is the (existing) namespace where you want the contents of the namespace script to go.

Regards,

Vince
Vince|Dyalog
 
Posts: 275
Joined: Wed Oct 01, 2008 9:39 am

Re: How to undo a scripted namespace ?

Postby Phil Last on Wed Apr 22, 2015 9:52 am

Looks good Vince. The target space must be "named" (created using dyadic ⎕NS) but otherwise is fine. Also rebuilds the hierarchy for a nested script as named container spaces correctly unlike my one-liner above. Well done Dan!
User avatar
Phil Last
 
Posts: 460
Joined: Thu Jun 18, 2009 6:29 pm

Re: How to undo a scripted namespace ?

Postby PGilbert on Wed Apr 22, 2015 11:56 am

User avatar
PGilbert
 
Posts: 361
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Re: How to undo a scripted namespace ?

Postby Phil Last on Wed Apr 22, 2015 5:43 pm

I was writing "off the top of my head" and here's a clearer way to do exactly the same thing:but as usual I write before researching and it seems I'm not on top of the latest developments.
My reference to nested spaces was because until I last looked the above would only have copied vars, fns and ops and would have left subspaces behind or in some cases it gave a DOMAIN ERROR - I never managed to identify precisely what cases or why - possibly something to do with external and cross refs.
I'm afraid I'm one who usually looks for a work-around rather than reporting a bug because I reason that if it doesn't already work I must be the first to try so probably it was never intended to do that and no-one else will want it anyway.
Well it turns out things have progressed and now it does copy subspaces. Strangely it gives a mix of scripted and non-scripted in terms of its behaviour with regard to both ⎕ED and ⎕SRC.both the above show a readonly namespace but"How do they DO that?"
User avatar
Phil Last
 
Posts: 460
Joined: Thu Jun 18, 2009 6:29 pm

Re: How to undo a scripted namespace ?

Postby DanB|Dyalog on Thu Apr 23, 2015 12:46 pm

DanB|Dyalog
 

Re: How to undo a scripted namespace ?

Postby ray on Tue May 12, 2015 3:26 pm

When I tried using the ]load user command to "unscript" a class, it fails with a domain error, because according to the STATUS message, the class script contains a base class (#.MiPage) and an :Include statement (:Include #HTMLInput).

Is there any way to get around this?
Ray Cannon
User avatar
ray
 
Posts: 118
Joined: Wed Feb 24, 2010 12:24 am
Location: Blackwater, Camberley. UK

Re: How to undo a scripted namespace ?

Postby DanB|Dyalog on Tue May 12, 2015 8:06 pm

You cannot "unscript" a class. You can turn a scripted namespace into a non-scripted ns but not a class.
I believe the DOMAIN error you are seeing is unrelated to the "unscripting" but is simply due to the fact that the base class is not around.
Even if there was no base class or :included ns the resulting space would be useless because it could not reconstruct names in it (most would be private and the public ones are ⎕CR resistant).
DanB|Dyalog
 


Return to Source Code Management

Who is online

Users browsing this forum: No registered users and 1 guest