User Command File and Namespace Names
-
- Posts: 431
- Joined: Fri Oct 03, 2008 4:14 pm
User Command File and Namespace Names
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?
- Adam|Dyalog
- Posts: 143
- Joined: Thu Jun 25, 2015 1:13 pm
Re: User Command File and Namespace Names
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.
-
- Posts: 431
- Joined: Fri Oct 03, 2008 4:14 pm
Re: User Command File and Namespace Names
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?
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?
- Adam|Dyalog
- Posts: 143
- Joined: Thu Jun 25, 2015 1:13 pm
Re: User Command File and Namespace Names
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.
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.
-
- Posts: 431
- Joined: Fri Oct 03, 2008 4:14 pm
Re: User Command File and Namespace Names
Thanks Adam.
I'm going to ask for an enhancement for a consistent and documented way to determine the source file.
I'm going to ask for an enhancement for a consistent and documented way to determine the source file.