Examples from my Programming Language
Posted: Sun Aug 21, 2011 8:12 pm
I'm working on a purely-OO language inspired by self and Smalltalk. I'm writing it entirely within my OS, and I've recently implemented an interesting programming concept called worlds. Here is a working code example:
You can read more about worlds here: http://www.vpri.org/pdf/tr2011001_final_worlds.pdf
Code: Select all
| point, A |
point = Object new init:
{
| x, y |
set: _x and: _y
{
x = _x.
y = _y.
}
print
{
Console print: x.
Console print: " ".
Console print: y.
Console print: "\n".
}
}.
point set: 5 and: 6.
point print.
A = thisWorld spawn.
A eval: { point set: 8 and: 9. }.
point print.
A eval: { point print. }.
A commit.
point print.
// output:
5 6
5 6
8 9
8 9