Poslin0.3.0rc5-0.1.6 is up.
The exceptions thrown by the primary operations now contain all the necessary information. Before for some operations arguments were lost.
The standard library has grown again.
`even?` and `odd?` have been added. They've got the obvious meaning.
`&|` is to `|`what `&[` is to `[`. That is, it closes the current stack and then opens a new one with `&[`.
`top-or-self` returns the top of a given stack or, if the given object is not a non-empty stack, the object itself.
`exception-type` returns the `top-or-self` of the `exception-data` of an exception.
`exception-type?` checks whether an exception is of a given type.
> 0 / ! ;[ this does not pop bottom because `/` tries to make the reciprocal of 0 before an attempt is made to pop the next argument ];
Division by zero
[ [[EXCEPTION ZERO-DIVISION-ERROR {P{reciprocal} P{*}}+0 "Division by zero"]] ]
> ZERO-DIVISION-ERROR exception-type? !
[ <TRUE> ]
`to-bottom` sends an object to the bottom of the current stack.
[ 1 2 3 ]
> a to-bottom !
[ a 1 2 3 ]
`]catch` is an immediate operation and allows you to catch errors of a specific type with their correct handler.
[ body &
| ZERO-DIVISION-ERROR
[ zero-devision-handle & ]
TYPE-ERROR
[ type-error-handle & ]
]catch
In the latter part (where all the handlers are defined) a local variable `exception` is defined which contains the caught exception.
[ do & some stuff &
| MY-EXCEPTION
[ exception get exception-data &
do & stuff with & data &
]
]catch
Of course this means that any variables named `exception` in the surrounding scope are shadowed.
Exception types which are not caught are just rethrown.
There's a challenge on codegolf.stackexchange.com:
Showcase your language one vote at a time. It allows to show code snippets of length 1-
number of votes. So, if any of you are on there I'd be happy if you gave me a vote.
It's easier to do that than trying to write a tutorial – a tutorial requires way better structure.