ControlSpec / Symbol::asWarp error

I’m getting a odd error with ControlSpec placed in the *initClass method of a class.
Here’s a minimal example. When I try adding this Class:

AAATestClass {

	classvar testSpec;

	*initClass {

		testSpec = ControlSpec(0, 1);  // error

		// ok if deferred:	
		// {
		// 	testSpec = ControlSpec(0, 1);
		// }.defer(0.1);
	}
}

If I compile I get this error during initClassTree, :

ERROR: Message 'at' not understood.
RECEIVER:
   nil
ARGS:
   Symbol 'lin'
CALL STACK:
	DoesNotUnderstandError:reportError
		arg this = <instance of DoesNotUnderstandError>
	Nil:handleError
		arg this = nil
		arg error = <instance of DoesNotUnderstandError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of DoesNotUnderstandError>
	Object:throw
		arg this = <instance of DoesNotUnderstandError>
	Object:doesNotUnderstand
		arg this = nil
		arg selector = 'at'
		arg args = [*1]
	Symbol:asWarp
		arg this = 'lin'
		arg spec = <instance of ControlSpec>
	ControlSpec:init
		arg this = <instance of ControlSpec>
	Meta_AAATestClass:initClass
		arg this = <instance of Meta_AAATestClass>
	Meta_Class:initClassTree
		arg this = <instance of Meta_Class>
		arg aClass = <instance of Meta_AAATestClass>
		var implementsInitClass = nil
	ArrayedCollection:do
		arg this = [*347]
		arg function = <instance of Function>
		var i = 83
	Meta_Class:initClassTree
		arg this = <instance of Meta_Class>
		arg aClass = <instance of Meta_Object>
		var implementsInitClass = nil
	Process:startup
		arg this = <instance of Main>
		var time = 2576.8247185
	Main:startup
		arg this = <instance of Main>
		var didWarnOverwrite = false
^^ ERROR: Message 'at' not understood.
RECEIVER: nil

If I defer the ControlSpec code (see commented out lines), there’s no error.
Can others confirm this?
Is it a bug?
Many thanks,
Paul

I fixed this error here by adding

Class.initClassTree(Warp);

to the top of your *initClass

Warp.initClass generates a dictionary of warp symbols which I think is what is missing here.

Many thanks. That fixes it.
Best,
Paul

Another recommended way to handle this case is:

AAATestClass {

	classvar testSpec;

	*initClass {
		StartUp.add {
			testSpec = ControlSpec(0, 1);  // error
		}
	}
}

hjh

1 Like

Thanks, James, that’s good to know.
Best,
Paul