User Command File and Namespace Names

General APL language issues

User Command File and Namespace Names

Postby paulmansour on Sat Jul 20, 2019 9:21 pm

It appears that a user command file (a .dyalog file) can have any arbitrary name, and that the namespace specified inside can have any arbitrary name (it is essentially anonymous). In other words, the group name of the user commands(s) is totally determined by the result if the List function. I am hoping this is a feature and not a bug. Is that correct?
paulmansour
 
Posts: 311
Joined: Fri Oct 03, 2008 4:14 pm

Re: User Command File and Namespace Names

Postby Adam|Dyalog on Sun Jul 21, 2019 3:26 am

That is correct. The file name and namespace name has no bearing on the user commands defined inside, or on which group they are in.
User avatar
Adam|Dyalog
 
Posts: 63
Joined: Thu Jun 25, 2015 1:13 pm

Re: User Command File and Namespace Names

Postby paulmansour on Sun Jul 21, 2019 12:44 pm

Thanks Adam.

One more:

When the Run function is executed, it appears I can rely on the namespace SALT_Data existing, where I can get SALT_Data.SourceFile. When the List function executes, presumably the first of the functions in a user command space that gets executed, the SALT_Data namespace appears not be instantiated (yet). I can get the sourcefile by looking at ##.t which is just the loop variable in the calling function but that of course is a horrible way to do it. Is there any reason it is not there, or could not be there?
paulmansour
 
Posts: 311
Joined: Fri Oct 03, 2008 4:14 pm

Re: User Command File and Namespace Names

Postby Adam|Dyalog on Sun Jul 21, 2019 1:57 pm

The List function is only called when SALT needs to update its cache of user commands. For this, it doesn't keep a connection between the file and the namespace, so there's no SALT_Data.

Yes, it is horrible to "break out of the box", but quite a few of our user commands do strange things like that. I really wouldn't recommend any of these tricks, as it makes it so much harder for us to update the user command system in the future.
User avatar
Adam|Dyalog
 
Posts: 63
Joined: Thu Jun 25, 2015 1:13 pm

Re: User Command File and Namespace Names

Postby paulmansour on Tue Jul 23, 2019 9:05 pm

Thanks Adam.

I'm going to ask for an enhancement for a consistent and documented way to determine the source file.
paulmansour
 
Posts: 311
Joined: Fri Oct 03, 2008 4:14 pm


Return to Language

Who is online

Users browsing this forum: No registered users and 1 guest