Page 1 of 1
User Command File and Namespace Names
Posted: Sat Jul 20, 2019 9:21 pm
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?
Re: User Command File and Namespace Names
Posted: Sun Jul 21, 2019 3:26 am
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.
Re: User Command File and Namespace Names
Posted: Sun Jul 21, 2019 12:44 pm
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?
Re: User Command File and Namespace Names
Posted: Sun Jul 21, 2019 1:57 pm
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.
Re: User Command File and Namespace Names
Posted: Tue Jul 23, 2019 9:05 pm
by paulmansour
Thanks Adam.
I'm going to ask for an enhancement for a consistent and documented way to determine the source file.