Domanda

If Self is installed on Ubuntu using the file on http://selflanguage.org/, then we can use

$ Self
Self Virtual Machine Version 4.1.13, Sat 20 Feb 10 22:39:48 Linux
Copyright 1989-2003: The Self Group (type _Credits for credits)

for I386:  LogVMMessages = true
for I386:  PrintScriptName  = true
for I386:  Inline = true
for I386:  SICDeferUncommonBranches = false (not implemented)
for I386:  SICReplaceOnStack = false (not implemented)
for I386:  SaveOutgoingArgumentsOfPatchedFrames = true

However, some simple lines cannot be run:

VM# 'Hello, World!' print.
A lookup error happened while sending the message
    print
to
    'Hello, World!'.
Subsequently, the lookup error message
    undefinedSelector:Receiver:Type:Delegatee:MethodHolder:Arguments:
was sent to
    <0>,
and was also not understood, causing the process to be aborted by the Self VM.

#0 (<error>:1): print = ( | self* = 'Hello, World!'. delegatee = nil. selector = 'print'. | 
"undefined selector error;
this method was automatically generated by the VM."
 )


#1 (<stdin>:1): <top level expr> = ( | self* = lobby. | 'Hello, World!' print )

Or another one to try out the slots:

VM# _AddSlots: (| vehicle <- (|parent* = traits clonable|) |).
A lookup error happened while sending the message
    traits
to
    lobby.
Subsequently, the lookup error message
    undefinedSelector:Receiver:Type:Delegatee:MethodHolder:Arguments:
was sent to
    <0>,
and was also not understood, causing the process to be aborted by the Self VM.

#0 (<error>:1): traits = ( | self* = lobby. delegatee = nil. selector = 'traits'. | 
"undefined selector error;
this method was automatically generated by the VM."
 )


#1 (<stdin>:1): <top level expr> = ( | self* = lobby. | traits clonable )


                             ^
Self VM error: couldn't construct object literal on line 1, character 30
               ^
Self VM error: couldn't construct object literal on line 1, character 16
VM#

Does someone know how to make it work?

È stato utile?

Soluzione

What you encounter is the most basic form of self that is out there.

The VM by itself only knows very little messages. They include all primitives and a few messages such as bootstrap.

If you try it, things like _Quit or 'some/path/to/self/script' _RunScript will work, as these are primitives that are always available.

If you want an working environment, you have to either

  • load a snapshot by starting the VM with the -s option:

    Self -s mySnapshot.snap
    

    You can find a snapshot on the self homepage.

  • Run a world building script. For that, you need the objects directory that comes with self. If you can't find it, use the one from the github page. Then, change your working directory to the objects directory and run the world builder script.

    cd $PATH_TO_OBJECTS/objects
    Self -f worldBuilder.self
    

    Alternatively, point the SELF_WORKING_DIR environment variable to the directory containing the objects directory and run the sctipt.

    SELF_WORKING_DIR=$PATH_TO_OBJECTS Self -f s$PATH_TO_OBJECTS/worldBuilder.self
    

This bootstraps a self world, where every known message should be understood.

PS: Surely, you can also run the word builder script from within the running VM: '/path/to/dir/with/objects/worldBuilder.self' _RunScript'. But make sure that SELF_WORKING_DIR is set.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top