Self programming language members,
You can ask questions on Stanford Discussion Forum
http://tiofo.stanford.edu? it is recently cretated for Stanford
community where people can exchange information, or simply read what
other people talk at Stanford. It is a good way to get connected with
Stanford.
Just give a try at http://tiofo.stanford.edu, you many find someone in
Stanford is interested in the same topics as you are and can help you
somehow.
Scott
Slava Pestov got the error shown in the stack dump in the following page
when trying to run Self on Linux:
http://paste.lisp.org/display/11688
My impression is that "os nodename" is returning "emu e)" for him
instead of just "emu" as it should. Looking at the implementation for
'nodename' this could happen if the uname() system call doesn't clear
the buffer it returns the answer in and the documentation doesn't
mention whether it does or not. It is also pretty nasty that the Self
code supposes all strings are 65 characters in length when the system
call doesn't commit to that but I see no way around this. Slava's Linux
kernel is 2.6.8 while mine is 2.6.10 so it is likely that I am not
having this problem due to the longer host name of my machine rather
than any difference in the system call.
One possible solution would be to change the method in unixGlobals os
osVariants linux:
utsnameIfFail: fb = ( | buf <- '' |
buf: buf copySize: (sys_nmln * 5).
"uname(2) returns 0 for success and -1 for failure"
"sys call checks for -1"
syscall: sys_name With: buf And: 0
IfFail: [|:e| fb value: e].
0 to: 4 do: [ |:index. clear<-false|
index*sys_nmln to: (index succ*sys_nmln)-1 do: [ |:cp|
(buf at: cp) == '\0' ifTrue: [clear: true].
clear ifTrue: [buf at: cp Put: ' ']
]
]
)
But the use of "finger" to guess the host name and user name is a
problem in itself since that application is now considered a security
risk and is no longer found on most machines. On my new Linux (Fedora
Core 2) this combines with another security feature (not rejecting
connections to unmonitored ports in order to slow down port scanning) to
make it so that the GUI window comes up right after Self starts but
nothing happens until I hit control-C twice to kill the two finger
attempts. They would probably eventually time out but this seems to take
more than the five minutes which is the most I have waited so far.
On this new Linux I am also having font problems, so that the Demo
snapshot doesn't start at all and the Barebones snapshot works until I
click on the open stack triangle on a debugger:
Error: could not load substitute font:
-*-times-medium-r-normal--9-*-*-*-*-*-*-*.
Receiver is: a x11Globals fontDictionary.
I won't worry much about this, however, as this Linux has enough other
problems that I should replace it as soon as I have a little time (2013.
perhaps?).
-- Jecel
> Pavel,
>
>> you may be interested in my experimental project named Marvin.
>> http://www.comtalk.net/Squeak/95
>
> Yes, I did find it very interesting indeed. I hope you don't mind me
> sending a copy of this to the Self list so that other people who might
> be interested can learn about your project. Perhaps it would be a good
> idea to announce it in the Squeak list too.
>
There are several reasons why I didn't announce this project in
Squeak-dev.
1) I want to make some minor modifications in the bytecodes generator etc.
2) I still have no VM for Linux. My attempts to build and compile VM
for this platform failed.
3) I wish to introduce it with very simple outliner. We cannot fully
demonstrate the power of this solution without this stuff.
4) I have to translate the most important parts of documentation to
English
>> It's an attempt to create a Self dialect in Squeak which is
compiled directly to the native bytecodes of Squeak and uses some
little extensions of virtual machine like delegation support etc.
>>
>
> There were other projects that added a bytecode or two to support this
> kind of thing. It would be nice if this could be done in a fully
> compatible way so that all future VMs could support it even for people
> not interested in using it. The original "blue book" instruction set had
> a few spare opcodes but I would have to check to see if Squeak didn't
> use them all.
>
My solution adds no next bytecodes to VM specification. Now I only add
two primitives (definition of prototype class) and I modify the
sending and resending mechanism. If the receiver is instance of the
prototype class, VM uses another lookup algorithm based on delegation.
>> You are experienced Self programmer (unlike me) and you may see
some problematic aspects of my concept of Squeak and Self integration
which I haven't perceived. Your comments are welcome.
>>
>
> It looks great. I only didn't understand why you had to use a non local
> return in the ifTrue:ifFalse: definition in your examples.
>
Marvin uses the Smalltalk's conventions for methods and blocks. So
Methods return receiver if there's no explicit return command. Methods
in Self return result of the last expression.
> The use of [...] to explicitly control compile-time evaluation is a very
> good idea and something I had borrowed from Forth for a language I
> desiged a while ago. Agora has something similar.
>
In fact, the main reason why I use square brackets is unambiguous
grammar. The visual separation is important too, in particular if a
programmer uses something like slot = self and then he is surprised
why it contains lobby. However it makes the resultant code less readable.
> Earlier versions of Self were more similar to Marvin in some aspects.
> They had characters as different objects from strings, for example. And
> the slot lookup was closer to your depth first strategy. There were no
> annotations either.
>
I have never fully understand why Self uses so complicated lookup
mechanism. It prevents some ambiguities but Self then cannot work well
with redefinitions and it's slower. DFS also encapsulates the object
more rigorously because an object is then enclosed entity even for
lookup mechanism.
> I am not sure why you feel you need to add primitives in future versions
> since you seem to have full access to Squeak. While I find the Self
> syntax for primitives much nicer than the old Smalltalk one it seems a
> little odd that while they look exactly like message sends they are
> really subroutine calls since they ignore the receiver type. Something a
> little less global would be nicer.
>
You're right, Marvin doesn't need primitives. Standard Squeak
primitives and methods of prototype class can play this role as well.
Here's another (runable) expample. It's very simple implementation of
modules.
|
application = [(|
globals* = [(|
privateGlobals* = [(|
lobby <- [ nil ] |)] |)].
traits = [(|
privateTraits* = [()] |)].
kernel <- [ nil ].
initialize: aKernel = (
kernel: aKernel.
globals privateGlobals lobby: self.
kernel
loadModule: #morphicModule
lobby: lobby
user: #root).
main = (
| m |
m: morph copy.
m color: traits color red.
m openInHand )
|)].
kernel = [(|
loadModule: moduleName lobby: root user: user = (
| module |
(user == #root )
ifTrue: [
module: (modules at: moduleName).
root globals AddParentSlot: module globalsName
value: module globals veryDeepCopy.
root traits AddParentSlot: module traitsName
value: module traits veryDeepCopy.]
ifFalse: [ error: 'Unknown user, you cannot load
this module' ]).
modules = [
Dictionary newFrom: (Array with:
#morphicModule -> ( |
globalsName = [ #morphicGlobals ].
globals* = [(|
"" only for demonstration
morph = [ Morph new ].
color = [ Color white ] |)].
traitsName = [ #traitsGlobals ].
traits = [(|
"" only for demonstration
morph = [ Morph ].
color = [ Color ] |)] | ) ) ]
|)].
|
application initialize: kernel.
application main.
-- Pavel
On Wednesday 31 August 2005 09:00, Jecel Assumpcao Jr wrote:
> Pavel,
>
> > you may be interested in my experimental project named Marvin.
> >
> > http://www.comtalk.net/Squeak/95
>
> Yes, I did find it very interesting indeed. I hope you don't mind me
> sending a copy of this to the Self list so that other people who might
> be interested can learn about your project. Perhaps it would be a good
> idea to announce it in the Squeak list too.
Has anyone figured out how to make the VM and image? I'm not a Squeaker,
so I don't know what to do with the .cs files... Do I import them into a
running Squeak instance or something? The notes in the email said that
the VM is changed slightly.
I'm on Linux (Gentoo, fairly up to date).
Best,
Kyle