Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix namescape in policy.tcl #3

Open
Bogdan107 opened this issue Jan 6, 2023 · 0 comments
Open

fix namescape in policy.tcl #3

Bogdan107 opened this issue Jan 6, 2023 · 0 comments

Comments

@Bogdan107
Copy link
Contributor

Bogdan107 commented Jan 6, 2023

I have an error when load linenoise package:

package require linenoise
can't create procedure "::linenoise::history::TempFile": unknown namespace
while evaluating package require linenoise

This fix in policy.tcl resolve an error:

--- a/policy.tcl  2023-01-07 01:20:12.256624629 +0200
+++ b/policy.tcl  2023-01-07 01:16:46.820239749 +0200
@@ -10,7 +10,7 @@
 ## The saving and loading primitives are wrapped for proper
 ## integration of the exported commands within Tcl's VFS.
 
-namespace eval linenoise::history {}
+namespace eval ::linenoise::history {}
 
 if {[package vsatisfies [package present Tcl] 8.6]} {
     # Tcl 8.6, and higher. We have "file tempfile".
@@ -178,7 +178,7 @@
     return [::linenoise::history_getmax]
 }
 
-namespace eval linenoise::history {
+namespace eval ::linenoise::history {
     namespace ensemble create -map {
        add     ::linenoise::history_add
        clear   ::linenoise::history_clear
@@ -377,7 +377,7 @@
 
 # # ## ### ##### ######## ############# #####################
 
-namespace eval linenoise {
+namespace eval ::linenoise {
     # primitive commands:
     # - columns
     # - prompt (with completion) | wrapped

The fix is :: symbols in the name of the namespace string in the policy.tcl file.

Reason

This command at line 13:

namespace eval linenoise::history {}

create namespace with the implicit declared name [namespace current]::linenoise::history, where [namespace current] may have any other name, than the root namespace ::.

The next instruction at the line 18:

proc ::linenoise::history::TempFile {} {

use absolutely declared namespace name ::linenoise::history, not implicit declared namespace name [namespace current]::linenoise::history.

So, this two lines (13 and 18) use different namespaces.

I think, that name of declared namespace MUST be consistent with namespace in procedure names.

Please, fix the file.

@Bogdan107 Bogdan107 changed the title fix: policy.tcl fix namescape in policy.tcl Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant