Tcl Source Code

View Ticket
Login
Ticket UUID: 6d2f249a015a3beafd79c175890b710334c56dec
Title: info class subcommands break if passed through variables
Type: Bug Version: 8.6.1
Submitter: apnadkarni Created on: 2014-02-21 04:10:00
Subsystem: 47. Bytecode Compiler Assigned To: dkf
Priority: 8 Severity: Severe
Status: Closed Last Modified: 2014-05-11 10:40:40
Resolution: Fixed Closed By: dkf
    Closed on: 2014-05-11 10:40:40
Description:
See the following session. Somehow, passing the info class subcommand through a variable confuses info class. As kap points out on the chat, the error message indicates it is looking for an info subcommand as opposed to a info class subcommand. 8.6.0 does not have this problem.

(ruff) 18 % oo::class create C
::C
(ruff) 27 % info class constructor C
(ruff) 28 % set v constructor
constructor
(ruff) 29 % info class $v C
unknown or ambiguous subcommand "constructor": must be args, body, class, cmdcount, commands, complete, coroutine, default, errorstack, exists, frame, functions, globals, hostname, level, library, loaded, locals, nameofexecutable, object, patchlevel, procs, script, sharedlibextension, tclversion, or vars

/Ashok
User Comments: dkf added on 2014-05-11 10:40:40:

Handled by making this case be less aggressively compiled. Shouldn't affect most code (and certainly shouldn't affect high-performance code).


dkf added on 2014-04-21 06:08:17:

The actual bug itself was in 8.6.0 I think, but you need a compiled ensemble inside a compiled ensemble to trigger it (which I didn't start defining until 8.6.1).


dkf added on 2014-02-21 10:40:15:

(disas is a local alias of mine for tcl::unsupported::disassemble)


dkf added on 2014-02-21 10:38:38:

Reproduced. This is a problem with compilation into nested ensembles.

% disas s {info class constructor c}
ByteCode 0x0x10094d710, refCt 1, epoch 95, interp 0x0x100829a10 (epoch 95)
  Source "info class constructor c"
  Cmds 1, src 24, inst 7, litObjs 2, aux 0, stkDepth 2, code/src 0.00
  Commands 1:
      1: pc 0-5, src 0-23
  Command 1: "info class constructor c"
    (0) push1 0 	# "::oo::InfoClass::constructor"
    (2) push1 1 	# "c"
    (4) invokeStk1 2 
    (6) done 

% set v constructor
constructor
% disas s {info class $v c}
ByteCode 0x0x1009c9410, refCt 1, epoch 95, interp 0x0x100829a10 (epoch 95)
  Source "info class $v c"
  Cmds 1, src 15, inst 18, litObjs 5, aux 0, stkDepth 5, code/src 0.00
  Commands 1:
      1: pc 0-16, src 0-14
  Command 1: "info class $v c"
    (0) push1 0 	# "info"
    (2) push1 1 	# "class"
    (4) push1 2 	# "v"
    (6) loadStk 
    (7) push1 3 	# "c"
    (9) push1 4 	# "::info"
    (11) invokeReplace 4 2 
    (17) done