Last active
November 16, 2016 02:09
-
-
Save edcrypt/962c83a559566b9bcb7ec794205119bd to your computer and use it in GitHub Desktop.
A simple bank account prototype.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ( | | |
| parent* = traits clonable. | |
| balance<-0. | |
| {'Category: transfer' | |
| deposit: amount = ( balance: balance + amount ). | |
| withdraw: = ( | :amount | balance: 0 max: balance - amount ). | |
| } | |
| | ) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A Self language example to demonstrate:
Insert into a shell and press "get it".
Then you can go further and enter () on another evaluator and get a new object, attribute it to a 'traits bankAccount' slot, set the creator path on annotations to this path, and refactor our bank account, moving methods to this "traits" object and resetting the parents of both objects.