Interlisp / medley

The main repo for the Medley Interlisp project. Wiki, Issues are here. Other repositories include maiko (the VM implementation) and Interlisp.github.io (web site sources)
https://Interlisp.org
MIT License
369 stars 19 forks source link

LOOPS is not creating a New Class #1750

Open skaisler opened 3 months ago

skaisler commented 3 months ago

(SETQ State (DefineClass 'State '(Class))) (SEND ($ State) SetName 'State) (PutCIVHere ($ State) 'Description "A component of the United States" ) (PutCIVHere ($ State) 'StateCapital NIL) (PutCIVHere ($ State) 'PartOf NIL) (PutCIVHere ($ State) 'Population NIL) (PutCIVHere ($ State) 'DateOfPopulation) (PutCIVHere ($ State) 'Cities NIL) (PutCIVHere ($ State) 'Counties NIL)

This is a definition for a class called State. We can see it is a class via SEDIT

(SEND ($ State) Edit) ?? Can't attach the image here?? See File1.tif GitHub can't see .tif files in directory

File1 File1

?? Can't attach file1.jpg files either. File1 File1

Given State, create the state of Maryland as a class (SETQ Maryland (SEND ($ State) New 'Maryland))

I get ARG Not Class

,($& State) and some other stuff.

which I assume refers to ($ State)

($ State) returns #,($C State)

This worked properly until the last two updates to Medley. A version of where it worked is included inthe book Medley Loops: The Basic System.

But now it does not. Steve Kaisler

masinter commented 3 months ago

I've been walking through the code for creating new insances of a previously declared class. What follows are stream-of-consciousness notes

skaisler commented 3 months ago

Larry et al:

I'll try to take a look as soon as I finish my paper for the HICSS Conference this weekend.

Let me note that this code worked perfectly just two weeks ago with an older version of Medley Interlisp because I used the code indicated in the LOOPS book to demonstrate some of the methods. I am continuing to generate some examples for use in the Basic Systems book.

I am wondering if some of the changes to maiko or Interlisp are affecting calls in LOOPS. Perhaps LOOPS should be recompiled (Gauges also, and Truckin) to see if that fixes the problem.

Steve K.

On Fri, Jun 14, 2024 at 1:31 PM Larry Masinter @.***> wrote:

I've been walking through the code for creating new insances of a previously declared class. What follows are stream-of-consciousness notes

  • the behavior is different than any of @skaisler https://github.com/skaisler reports. ARG NOT CLASS is one error..\
  • There's a variable ErrorOnNameConflict which controls whether you get an error break for redefining an instance name. It's initially NIL
  • The break happens in PutObjectName.
  • TruckIn fails for not setting the names of players.
  • I'm.a little confused about the object creation protocol. It creates a blank object from State class and set the instance name to Maryland (or whatever), but it seems like the atom State is being initially assigned instead of Maryland.
  • break PutObjectName CreateEntity Object.SetName NameEntity
  • trace (PUTHASH in PutObjectName)
  • suspicioun of Class.SetName -- why is it messing with the file package? Class.New is what is called when you want to create a new instance of a class. That calles Class.CreateInstance with makes the thing, and then sends the SetName message to the new instance. But that instance (a State) shoudln't call Class.SetName which SetName/s the State class.... State already has a name. So I suspect the FetchMethodOrHelp function is getting the wrong entry.
  • There's a thing in the file LOOPSSPEEDUP that defines things in terms of \LOLOC...

— Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/1750#issuecomment-2168471532, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARRPGX4GVIVEDQDOMB2URH3ZHMSHTAVCNFSM6AAAAABI3LOEV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRYGQ3TCNJTGI . You are receiving this because you were mentioned.Message ID: @.***>

masinter commented 3 months ago

there's a possibility that the problem is in the LOOPSSPEEDUP which uses low-level primatives \LOLOC and PUTBASEPTR to optimize the caching of method lookup. There are some things that work when the number of symobls is less than 2^16 and/or the used address space is less than 64mb that will stop working. These were changes that were introduced after the increase in symbols and address space.

I've noticed when pursing this that the SYSOUT size for LIsp.sysout and full.sysout etc. have gotten bigger -- it used to be that. full.sysout ws 4% and now it's close to 8% (need to confirm).

skaisler commented 3 months ago

Update o6/17/2024 w/ Medley release 0610 An error window pops up w/ title "Interlisp Error" and contents In Error: ARG Not Class

,($ Annapolis)

Here is the code for creating Annapolis: (SETQ Annapolis (SEND ($ City) New 'Annapolis)) (SEND ($ Annapolis) SetName 'Annapolis) (PutValue Annapolis 'Population 40812 ) (PutValue Annapolis 'DateOfPopulation 2020 ) (PutCIVHere 'Annapolis 'PartOf 'Maryland) (AddCity 'Maryland 'Annapolis) (PP Annapolis)

The code for City and Maryland is:

(SETQ City (DefineClass 'City '(Class))) (SEND ($ City) SetName 'City) (PutCIVHere ($ City) 'Description "A component of a State/County of the United States" )

(* ; "Maryland - Home State of Steve Kaisler") (SETQ Maryland (SEND ($ State) New 'Maryland)) (SEND ($ Maryland) SetName 'Maryland) (PutValue ($ Maryland) 'Description "An Eastern State of the United States" ) (PutValue Maryland 'PartOf 'UnitedStates) (PutValue ($ Maryland) 'StateCapital 'Annapolis )

Creating Maryland works OK, but Annapolis fails, yet the calls loo the same.

SEND is defined in LOOPSMETHODS as a macro, which then accesses another macro "_":

(DEFMACRO  (self selector &REST args) `(! ,self ',selector ,@args))

(DEFMACRO SEND (self selector &REST args) `(_ ,self ,selector ,@args))

(DEFMACRO _! (self selector &REST args) [Once-Only (self) `(APPLY* (FetchMethodOrHelp ,self ,selector) ,self ,@args])

As I noted previously, the code to create Annapolis worked very for Medley about two release ago, but does not now work. The LOOPS code has not changed. I must be missing something, but I don't see what it is. Steve K.

masinter commented 2 months ago

I had a breakthrough under the assumption that this never worked correctly.

The root problem is the '(Class) passed as the "supers" argument to DefineClass:

(SETQ State (DefineClass 'State '(Class)))

should just be

(DefineClass 'State)

State is not a meta-class. It is a Class, but the instances of the State class are Object. The default supers is '(Object) unless you are defining a meta-class in which case it is `(Class).

This error should be caught earlier and somehow repaired or at least a more informative and useful error message should be supplied.

The variable State in (SETQ State ...) is useless and confusing. ($ State) will find the class named State, no need to set another variable.

If there is a release where the Loops code given in the issue works, I will investigate further, but otherwise we should close this issue ;erhaps raising a new issue to fix the anomolies found while tracking this down.

skaisler commented 2 months ago

Larry:

Thanks very much for your efforts. I am trying to generate a few additional examples for Volume I: The Basic System

The reason I set the variable State in (SETQ State (SEND ($ State) SetName 'State)) is due to the fact that State was not recognized as the name of an object when (DefineClass 'State) worked earlier.

I have pored over the LOOPS source code which is almost unreadable at times dues to SEDIT formatting.

Steve K.

On Sun, Jun 23, 2024 at 9:58 PM Larry Masinter @.***> wrote:

I had a breakthrough under the assumption that this never worked correctly.

The root problem is the '(Class) passed as the "supers" argument to DefineClass:

(SETQ State (DefineClass 'State '(Class)))

should just be

(DefineClass 'State)

State is not a meta-class. It is a Class, but the instances of the State class are Object. The default supers is '(Object) unless you are defining a meta-class in which case it is `(Class).

This error should be caught earlier and somehow repaired or at least a more informative and useful error message should be supplied.

The variable State in (SETQ State ...) is useless and confusing. ($ State) will find the class named State, no need to set another variable.

If there is a release where the Loops code given in the issue works, I will investigate further, but otherwise we should close this issue ;erhaps raising a new issue to fix the anomolies found while tracking this down.

— Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/1750#issuecomment-2185446980, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARRPGXZ6FQLPBIXSJFYEFULZI54LDAVCNFSM6AAAAABI3LOEV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBVGQ2DMOJYGA . You are receiving this because you were mentioned.Message ID: @.***>

MattHeffron commented 2 months ago

Attached are the scans of some of the Truckin documents/files from the July 1983 Loops course. I hope they're useful.

Truckin.pdf Truckin MANUAL.pdf Truckin Query Functions.pdf TRUCKINV source.pdf

masinter commented 2 months ago

These (all Truckin) documents (scanned, compressed, OCRd) are now in the loops repository doc/truckin folder:

https://files.interlisp.org/medley/loops/doc/truckin/