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

Unused variables? #2

Open
drewish opened this issue Aug 27, 2016 · 3 comments
Open

Unused variables? #2

drewish opened this issue Aug 27, 2016 · 3 comments

Comments

@drewish
Copy link

drewish commented Aug 27, 2016

In HTTPDigestAuth there's a _thread_local value that's assigned but then never used:

  constructor(username, password) {
    this.username = username
    this.password = password
    //# Keep state in per-thread local storage
    this._thread_local = {}
    this.init_state()
  }

I'm trying to decide if it's just left over from something or if it's there to trigger some behavior in paw.

I'm leaning towards just unused since there's also some other ones:

  init_state() {
    this.init = true
    this.last_nonce = ''
    this.nonce_count = 0
    this.chal = {}
    this.pos = null
    this.num_401_calls = null
  }

Has a init, pos, and num_401_calls and none of them seem to be read.

@drewish drewish changed the title Unused _thread_local variable Unused variables? Aug 27, 2016
@mittsh
Copy link
Contributor

mittsh commented Aug 30, 2016

@drewish _thread_local was just an experiment, and didn't go anywhere. Same for num_401_calls, init and pos, they are all unused. Sorry for the left dead code.

Unfortunately, for now there's no way to cache a value between evaluations of dynamic values. The Dynamic Value is instantiated and destroyed on each run, even the whole JS context is destroyed after a run. It was designed that way to keep the memory footprint low + make sure on each run we get a fresh state which is nicer for development and to make sure users don't get stuck on a broken state. This means dynamic values (and extensions in general) have no way to cache values.

We're working on a kind of "local storage" / "cache" mechanism for Paw extensions, which may be what you need.

I'm keeping the issue open so we remember to kill this dead code.

@JonathanMontane
Copy link
Contributor

@drewish @mittsh I'll do some code clean-up. Low priority though.

@drewish
Copy link
Author

drewish commented Aug 30, 2016

Yeah I was really hoping there was some magic variable that let me store data across requests ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants