Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ximp
- ====
- The following code shows the Ximp language output for some specific input, showing some of the benefits from using such a nice language.
- Defining something
- ------------------
- an Account
- is positive? { @amount >= 0 }
- withdraw { (amount is (@amount - value)) }
- my_account is Account (amount is 1000)
- my_account is positive?
- new_account is (withdraw from my_account (value is 300))
- new_account is my_account after withdraw (value is 300)
- Another type:
- a Manager
- Ximping a type
- --------------
- ximp my Account
- with a Manager
- Creating something
- ------------------
- my_account is Account(owner is "guilherme", amount is 50)
- paulo is Manager(name is "Paulo Silveira")
- my_account's manager is paulo
- Output
- ------
- print my_account's manager's name
- Paulo Silveira
- Easy to extend
- --------------
- The following examples show how it is easy to define new macros.
- Input
- -----
- yo, tell me my_account's manager's name
- Carlos
- State
- -----
- my_account, sup dawg?
- my owner is guilherme, amount is 50, manager's name is Carlos
- Comments
- --------
- Hmmm "if you want to contribute, just fork me!"
- whatever
Add Comment
Please, Sign In to add comment