Files
sakurac/core/traits/negatable.sakura
T

21 lines
631 B
Plaintext
Raw Normal View History

2026-10-26 10:14:11 -05:00
#! @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;
}