All pastes #34673 Raw Edit

Something

public text v1 · immutable
#34673 ·published 2005-12-23 06:33 UTC
rendered paste body
use encoding "utf-8"
# below should be parsed as utf-8 encoding
-- comment can start with "--" instead of "#" (really?)

# example of DBC
class value extends number has
    function this(value: integer = 0, min: integer = 0, max: integer = 42) do
        @min, @max, @value = min, max, value
    end

    function operator <=> (lhs: number): integer do
        @value <=> lhs
    end

    function invariant do
        @min <= @value <= @max
    end

    function operator += (lhs: value)
        require assert @value != 13 and lhs != 13
        ensure assert @value != 13
    do
        @value += integer.from(lhs)
        this
    end

    function operator + (lhs) do
        value = .clone
        value += lhs
        return value
    end
end

# and so on...