It’s Alive! (Sort of)

There was meant to be a third article in the Native Objects series that would discuss the Actions (“methods”) supported by the native Models (“classes”). But I’ve only begun to define those things. For now, suffice to say that typical data types (integers, floats, strings, etc.) have the methods you’d expect. Assignment for all, basic math for the numeric types, stringy stuff for the string; you get the idea.

I’ve reached another major milestone, but I’m also about to begin another design phase as I figure out exactly how to implement the native Models. And I may be taking a break from this blog to give BOOL a rest and to deal more with other matters.

The milestone is that I was able to execute the compiled BOOL/M code all the way up to the point where the RTE needed the *int Model’s Action implementing the set: Message. Since there is no such implementation (yet), the engine throws a graceful exception, exactly as it should. (The classical Smalltalk “Not Implemented” error.)

Here’s the code that ran:

@@add
>>  *int a
>>  *int b
<<  *int c
.   set:c add:a b;;

@@test_add
<<  *int x = @add 21 42

@@main
.   @test_add

What’s big about this is that my test wrapper generated a call to @main, and things worked all the way to the set: Message in the @add Action!

That means the engine:

  1. Successfully fielded the call to @main.
  2. Invoked the @main Action, which
  3. Ran its execution List, which
  4. Executed the single item on that List, an Actor that
  5. Invoked the @test_add Action, which
  6. (has no execution List, but does have an initialization List on its return parameter (x), so it)
  7. Initialized the *int Instance (x), which
  8. Evaluated the initialization List, which
  9. Evaluated the single item, an Actor that
  10. Invoked the @add Action, which
  11. Initialized its parameters (a, b & c), and
  12. Ran its execution List, which
  13. Executed the single item on that List, a set: Message that
  14. Pushed its parameter (the add: Message) and
  15. Sent the set: Message to its target object (c), which
  16. Passed the Message to its Model (*int), which
  17. Searched for the Action that implements set:

And didn’t find it.

[ERROR|Test/RTE ] Message "set" not implemented!

But the parts that worked all worked great (after a couple hours of debugging, anyway)! Now I have one of the final big run-time pieces to solve: exactly how Models are implemented and behave. (There’s actually a fair bit more with Actions. Currently they are not re-enterable, but one step at a time!)

For posterity, here’s the listing of that historic run:

Caller: [global:0006] ('TOR', 'main', [['main']])
PStak::push: [global:0006]
RTE::SendMessage: invoke: [global:0005]
RTE::SendMessage: obj=(ACT @main  inits=0 exits=0 args=1 cs=2 ds=0)

Action.MSG invoke: [global:0005] (ACT @main  inits=0 exits=0 args=1 cs=2 ds=0)
PStak::pop: [global:0006]
Action::Calling Actor: &[global:0006] (TOR @main  params=1)

Action::Do clause: ['main']
Action::Execute: main [main:0001]
RTE::SendMessage: x: [main:0001]
RTE::SendMessage: obj=(LST items=1 ...)

List.MSG x: [main:0001] (LST items=1 ...)
RTE::SendMessage: x: [main:0000]
RTE::SendMessage: obj=(TOR @test_add  params=1)

Actor.MSG x: [main:0000] (TOR @test_add  params=1)
PStak::push: [main:0000]
RTE::SendMessage: invoke: [global:0004]
RTE::SendMessage: obj=(ACT @test_add  inits=1 exits=1 args=1 cs=3 ds=1)

Action.MSG invoke: [global:0004] (ACT @test_add  inits=1 exits=1 args=1 cs=3 ds=1)
PStak::pop: [main:0000]
Action::Calling Actor: &[main:0000] (TOR @test_add  params=1)

Action::Initialize Param: [test_add:0002]
RTE::SendMessage: x: [test_add:0002]
RTE::SendMessage: obj=(OBJ *int #0 =[test_add:0001])
Instance.MSG x: [test_add:0002] (OBJ *int #0 =[test_add:0001])

RTE::SendMessage: q: [test_add:0001]
RTE::SendMessage: obj=(LST items=1 ...)

List.MSG q: [test_add:0001] (LST items=1 ...)
RTE::SendMessage: q: [test_add:0000]
RTE::SendMessage: obj=(TOR @add  params=1)

Actor.MSG q: [test_add:0000] (TOR @add  params=1)
PStak::push: [test_add:0000]
RTE::SendMessage: invoke: [global:0003]
RTE::SendMessage: obj=(ACT @add  inits=3 exits=1 args=1 cs=6 ds=3)

Action.MSG invoke: [global:0003] (ACT @add  inits=3 exits=1 args=1 cs=6 ds=3)
PStak::pop: [test_add:0000]
Action::Calling Actor: &[test_add:0000] (TOR @add  params=1)

Action::Initialize Param: [add:0000]
RTE::SendMessage: x: [add:0000]
RTE::SendMessage: obj=(REF *int #0)
Reference.MSG x: [add:0000] (REF *int #0)

Action::Initialize Param: [add:0001]
RTE::SendMessage: x: [add:0001]
RTE::SendMessage: obj=(REF *int #1)
Reference.MSG x: [add:0001] (REF *int #1)

Action::Initialize Param: [add:0002]
RTE::SendMessage: x: [add:0002]
RTE::SendMessage: obj=(OBJ *int #2 =None)
Instance.MSG x: [add:0002] (OBJ *int #2 =None)

Action::Do clause: ['add', ('global', 3), ('system', 11)]
Action::Param[0]: [add:0000] = (REF *int #0)
Action::Argument: [global:0003] = (ACT @add  inits=3 exits=1 args=1 cs=6 ds=3)
Action::Param[1]: [add:0001] = (REF *int #1)
Action::Argument: [system:0011] = (OBJ *int #8 =None)

Action::Execute: add [add:0005]
RTE::SendMessage: x: [add:0005]
RTE::SendMessage: obj=(LST items=1 ...)

List.MSG x: [add:0005] (LST items=1 ...)
RTE::SendMessage: x: [add:0004]
RTE::SendMessage: obj=(MSG set: [add:0002] =[add:0003])

Message.MSG x: [add:0004] (MSG set: [add:0002] =[add:0003])
PStak::push: [add:0003]
RTE::SendMessage: set: [add:0002]
RTE::SendMessage: obj=(OBJ *int #2 =None)

Instance.MSG set: [add:0002] (OBJ *int #2 =None)
PStak::push: [add:0002]
RTE::findModel: int
RTE::SendMessage: set: [system:0018]
RTE::SendMessage: obj=(MOD *int  template=0 actions=0)

PStak::pop: [add:0002]
Model.MSG set: [add:0002] (MOD *int  template=0 actions=0)
Message "set" not implemented!
Advertisements
%d bloggers like this: