User Command File and Namespace Names

General APL language issues
Post Reply
paulmansour
Posts: 431
Joined: Fri Oct 03, 2008 4:14 pm

User Command File and Namespace Names

Post by paulmansour »

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?
User avatar
Adam|Dyalog
Posts: 143
Joined: Thu Jun 25, 2015 1:13 pm

Re: User Command File and Namespace Names

Post by Adam|Dyalog »

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.
paulmansour
Posts: 431
Joined: Fri Oct 03, 2008 4:14 pm

Re: User Command File and Namespace Names

Post by paulmansour »

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?
User avatar
Adam|Dyalog
Posts: 143
Joined: Thu Jun 25, 2015 1:13 pm

Re: User Command File and Namespace Names

Post by Adam|Dyalog »

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.
paulmansour
Posts: 431
Joined: Fri Oct 03, 2008 4:14 pm

Re: User Command File and Namespace Names

Post by paulmansour »

Thanks Adam.

I'm going to ask for an enhancement for a consistent and documented way to determine the source file.
Post Reply