When i do interactively:
package require json
It responds with:
1.3.4
I then do:
namespace import ::json::json2dict
But the command json2dict is not available after that.
Am I doing something wrong?
On 10/3/23 04:02, Cecil Westerhof wrote:
When i do interactively:json2dict isn't exported by the library.
package require json
It responds with:
1.3.4
I then do:
namespace import ::json::json2dict
But the command json2dict is not available after that.
Am I doing something wrong?
Peter Dean <[email protected]> writes:
On 10/3/23 04:02, Cecil Westerhof wrote:
When i do interactively:json2dict isn't exported by the library.
package require json
It responds with:
1.3.4
I then do:
namespace import ::json::json2dict
But the command json2dict is not available after that.
Am I doing something wrong?
Of-course. That is what I do in my package. But if it is not done,
then it will not work.
I would have expected that an import that imports nothing would be an
error, but that is only my way of thinking.
Cecil Westerhof <[email protected]> wrote:
Peter Dean <[email protected]> writes:
On 10/3/23 04:02, Cecil Westerhof wrote:
When i do interactively:json2dict isn't exported by the library.
package require json
It responds with:
1.3.4
I then do:
namespace import ::json::json2dict
But the command json2dict is not available after that.
Am I doing something wrong?
Of-course. That is what I do in my package. But if it is not done,
then it will not work.
I would have expected that an import that imports nothing would be an
error, but that is only my way of thinking.
The manpage does not define what happens when there are no matching
exports. So a no error situation is one possible outcome.
Since json does not export anything, and presumably you want to have
the effect of an 'import', you can use an interp alias to achieve
"import like" semantics:
% interp alias {} json2dict {} ::json::json2dict
And you'll have a "json2dict" command that calls the namespaced
command.
Cecil Westerhof <[email protected]> wrote:
Peter Dean <[email protected]> writes:
On 10/3/23 04:02, Cecil Westerhof wrote:
When i do interactively:json2dict isn't exported by the library.
package require json
It responds with:
1.3.4
I then do:
namespace import ::json::json2dict
But the command json2dict is not available after that.
Am I doing something wrong?
Of-course. That is what I do in my package. But if it is not done,
then it will not work.
I would have expected that an import that imports nothing would be an
error, but that is only my way of thinking.
The manpage does not define what happens when there are no matching
exports. So a no error situation is one possible outcome.
Since json does not export anything, and presumably you want to have
the effect of an 'import', you can use an interp alias to achieve
"import like" semantics:
% interp alias {} json2dict {} ::json::json2dict
And you'll have a "json2dict" command that calls the namespaced
command.
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 716 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 49:10:14 |
| Calls: | 12,115 |
| Calls today: | 6 |
| Files: | 15,010 |
| Messages: | 6,518,535 |