22 lines
631 B
Plaintext
22 lines
631 B
Plaintext
#! @file negatable.sakura
|
|
#! @author John Christman (sorakatadzuma@gmail.com)
|
|
#! @copyright Malunal Studios, LLC.
|
|
#! @license MIT
|
|
#!
|
|
#! Contains the negatable trait, which asks for the method a prefix `-` calls.
|
|
|
|
module core;
|
|
|
|
|
|
#! A type whose values negate, giving another of the type.
|
|
#!
|
|
#! `-a` calls `negate`. A type has it by declaring the method. The trait is
|
|
#! what generic code asks for to negate a value. Numbers are negatable without
|
|
#! declaring anything.
|
|
pub trait negatable {
|
|
#! Negates this value, as `-x` does.
|
|
#! @param this The value to negate.
|
|
#! @returns The negated value.
|
|
def negate(&this): self;
|
|
}
|