articles/smalltalk.md: update

This commit is contained in:
tocariimaa 2025-03-08 19:50:10 -03:00
parent 1cf8c29c2d
commit ec1e691191

View file

@ -2,7 +2,7 @@
Smalltalk is a pure [object oriented](oop.md) (not the "modern" variant), [garbage collected](garbage_collection.md)
and highly dynamic [programming language](programming_language.md) created in Xerox PARC by a group of scientists, including Alan Kay.
Smalltalk has a [minimal](minimalism.md) [syntax](syntax.md) which is famously said to be able to "fit on a postcard";
building upon a minimal set of primitive objects.
building upon a minimal set of primitive objects. Everything is an object in this language.
Smalltalk is built upon the concept of message passing, where objects communicate between each other by sending messages, which
can optionally carry a value. Unlike most OOP languages, an object can receive any message and its up to it whether to reply it
@ -13,6 +13,8 @@ or return an error if it doesn't understand the received message.
anObject say: 'hi'
```
Objects from a hierarchy, where ultimately all objects descend from the same `Object` object.
Being a highly dynamic language, Smalltalk is usually used in an [IDE](ide.md) supporting this paradigm by using
[GUI](gui.md) to allow for easier inspection of the program, but "headless" implementations of Smalltalk exist.
@ -20,7 +22,11 @@ In Smalltalk implementations that provide with an interactive environment, Small
in a textual form like other programming languages; instead Smalltalk is more "image" oriented, with an image
being able to contain the code of a program and its live state (similar to how some [Lisps](lisp.md) work).
TODO
## Smalltalk revisions
- Smalltalk-71: prototype design by Alan Kay
- Smalltalk-72: first actual implementation, in [BASIC](basic.md).
- Smalltalk-80: most popular standard
- ANSI Smalltalk: released in 1998
## Implementations
- [Squeak](https://squeak.org/)
@ -46,13 +52,13 @@ gst hello.st
### Extending a class: `String`
We can also extend builtin classes such as `String` to add our own method:
```smalltalk
'smalltalk' removeVowels. "Error: `String` doesn't understand this message"
'smalltalk' removeVowels. "Error: `String` doesn't understand this message"
String extend [
removeVowels [
^(self reject: [:c | c isVowel])
^ self reject: [:c | c isVowel]
]
]
'smalltalk' removeVowels. "==> smlltlk"
].
Transcript show: 'smalltalk' removeVowels; cr. "==> smlltlk"
```
TODO
@ -61,5 +67,6 @@ TODO
- <https://learnxinyminutes.com/smalltalk>
- [Smalltalk Cheatsheet](https://angelfire.com/tx4/cus/notes/smalltalk.html)
- [GNU Smalltalk User's Guide](https://www.gnu.org/software/smalltalk/manual/)
- [GNU Smalltalk tutorial](https://www.gnu.org/software/smalltalk/manual/html_node/Tutorial.html)
- [*The Cuneiform Tablets of 2015*](https://tinlizzie.org/VPRIPapers/tr2015004_cuneiform.pdf):
paper describing how an Smalltalk-72 interpreter could be engraved in a rock for reliable future-proof preservation.