User:Dan Bron/Temp/StateInJ

From J Wiki
Jump to: navigation, search

How does state accumulate in a J session? How does it effect execution? How can we query it, reset it, and carry selected parts forward to a fresh J session?

interpreter

vocabulary

  • s: state
  • ? state
  • M. state? Does this persist across independent invocations of memoized names?

names & locales

  • retain names
  • retain locales
  • retain locale paths

NB. Perhaps only retain named locales, and let scripts create numberd locales? NB. but then there's no guaruntee the same objects will be represented by the NB. same numbers

files

  • mapped files

NB. (see also file names and numbers, and file locks, in the !: section)

foreigns (not wd)

files

  • 1!:20 Open names+numbers
  • 1!:31 File locks
  • 1!:43 Query Working Dir
  • 1!:45 Reload profile

host

  • 2!:5 Getenv.

NB. Set Env? Maybe this inherets automatically from parent J to child J?

names

  • 4!:1
  • 4!:3

NB. Reload scripts, in order? Use LOADED_j_ to determine which were loaded "by hand"? NB. LOADED_j_ is a front end issue

global parameters

  • 9!:2
  • 9!:6
  • 9!:8
  • 9!:10
  • 9!:16
  • 9!:18
  • 9!:20
  • 9!:24
  • 9!:26
  • 9!:28
  • 9!:32
  • 9!:34
  • 9!:36 NB. See if this sort of thing is the same in the default profile (ie. invoke with the same command line, and only set the 9!:x that are different)
  • 9!:38
  • 9!:40
  • 9!:42
  • 9!:44
  • 9!:46
  • 9!:48

debug state

  • 13!:0 NB. 13!:17
  • 13!:2
  • 13!:11 NB. Reset errorno and errmsg
  • 13!:12 NB. using assert?
  • 13!:14

dll

  • 15!:0 NB. Way to figure out which DLLs are currently loaded into memory?
  • 15!:6 NB. Way to restore mapped names?

locales

  • 18!:0
  • 18!:1
  • 18!:2
  • 18!:3
  • 18!:5 NB. 18!:4

warm ups

Certain state in J is completely hidden from the user, and is neither queriable nor set-able. This is the effect of "warming up" a J session. See Roger's example of this in the closing the .ijx window thread in the Forums.

front end

invocation

  • invocation command line NB. [: 15!:1@:,&0 _1@:> ('kernel32 GetCommandLineA *c'"_) 15!:0 ''"_

session manager

  • IJX window
      • contents (history) NB. Motivation to restart J: too much data in wd
      • location
      • size
      • state (max, min, normal)
      • sminputlog
  • script windows:
      • contents (scripts)
      • locations
      • sizes
      • state (max, min, normal)
      • visible sections (scroll cursor)
      • selected text

wd

  • 11!:0 NB. Restore forms & such?

NB. What about gl and isi and all that stuff?

warm ups

The J session manager also accumulates "hidden" state, e.g. LOADED_j_, but all this state is represented by names in locales controlled by the standard library. So persisting those locales is a comprehensive way to persist this "hidden" state.