smalltalk Flashcards
1
Q
what is Smalltalk?
A
- an object-oriented language
- no standard syntax for declaring methods
- first language packaged with its own IDE
- evolved from Simula 671 (for simulations)
2
Q
model of computation
A
- all computation done by sending messages to objects
- variables must be declared before use, but no type is given
- everything is an object (no type needed)
3
Q
objects in Smalltalk include:
A
- variables
- classes
- numbers
- code
4
Q
Smalltalk general syntax:
A
//idk why it keeps reverting back to this. this is incorrect. object/message/argument { [argument] }
s push: 10 s size
5
Q
Smalltalk class definitions
A
- can contain instance and class definitions
* common to all instances of the class
6
Q
Smalltalk messages
A
written to the right of the recipient
7
Q
Smalltalk class instances
A
- instance definitions are specific to each object
* instance variables are private to that object
8
Q
Smalltalk class methods
A
primarily used to create new instances
9
Q
unary
A
a message without an arg
10
Q
keyword
A
- a message with an arg
* end in a colon and may be made into a sequence
11
Q
expressions
A
- always evaluated from left to right
- a sequence of expressions is separated by .
- a value is returned using ^
12
Q
precedence
A
unary, binary, keyword messages, ^
13
Q
misc syntax
A
"..." is a comment /.../ is a string $a is the character a #a is the symbol a (don't evaluate) default value for all variables in Smalltalk is nil