 |
[6 * 9 = 42] whileTrue: [World run]
Stopařův průvodce jedním převážně neškodným programovacím jazykem
|
 |
|
Marvin
Marvin is a new prototype-based programming language which combines characteristics of Self and Smalltalk-80. It is compiled directly to the native bytecodes of Squeak. Marvin requires special virtual mechine version enhanced with support of delegation and prototypes.

preview of Marvin outliner
Downloads
SqueakSource repository (latest versions)
MCHttpRepository
location: 'http://kilana.unibe.ch:8888/Marvin'
user: ''
password: ''
Discuss group
Documentation
Diploma thesis abstract
The goal of this diploma thesis is to implement a set of enhancements for the Squeak Smalltalk development environment which extends it with support of classless programming. It describes basic concepts of this modern object orientation, as realized in the Self programming language, and researches present attempts to bring a classless approach to Squeak Smalltalk.
This thesis compares every possible implementation and, by virtue of this comparison, designs a solution which is based on an extension of the possibilities of the Squeak virtual machine with support of delegation and prototypes. Then it designs a new programming language which combines characteristics of Self and Smalltalk-80 to use the current Squeak Smalltalk environment and new virtual machine modifications effectively. This thesis implements a functional compiler for this new language with support of translation to the native bytecodes of Squeak.
All results achieved, deficits and future development possibilities are summarized at the end.
Example (delegation)
(|
parent* = [ (|
a = [6]
|) ].
a = [3].
b = [4].
sum = ( ^ resend a + b)
|) sum
Self vs. Marvin syntax
Self:
( |
parent* = ( |
b = 4.
sum = (a+b).
ifTrue: b1 False: b2 = ( b1 value ) | ).
a = 3.
| )
Marvin:
( |
parent* = [( |
b = [4].
sum = (^ a+b).
ifTrue: b1 ifFalse: b2 = ( ^ b1 value ) | )].
a = [3].
| )
Advanced example (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.
Odkazy na tuto stránku
- Projekty, poslední úprava dne 2 Červen 2005 v 12:30:24 uživatelem dotnet
- Marvin FAQ, poslední úprava dne 8 Březen 2008 v 22:42:55 uživatelem localhost
|
|