Initial Commit
This commit is contained in:
706 files changed
+135430
No files matched your search
@@ -0,0 +1,32 @@
|
||||
#! @file signature.sakura
|
||||
#! @author John Christman (sorakatadzuma@gmail.com)
|
||||
#! @copyright Malunal Studios, LLC.
|
||||
#! @license MIT
|
||||
#!
|
||||
#! Contains the signature trait, which the compiler gives every function type,
|
||||
#! and which names what a function takes and what it gives.
|
||||
|
||||
module core;
|
||||
|
||||
#! A function type, as `def(i64, bool): u8`, a variadic one, as `def(i64...):
|
||||
#! i64`, or the address of a C function, as `cfn<def(i32): void>`.
|
||||
#!
|
||||
#! Generic code bounded by it names the parts of the type it is given: `F::result`
|
||||
#! is what a function of it gives, and `F::params` the types it takes, as a pack,
|
||||
#! so `args: F::params...` takes the arguments it does. A variadic function's
|
||||
#! pack ends in the type of the values its last parameter takes, so a parameter
|
||||
#! of the pack is variadic too.
|
||||
#!
|
||||
#! A pattern parameter, as `def(Ts...): R` of `invokable`, is given a signature
|
||||
#! whole: `invokable<F>` where `F: signature` names `F::params` and `F::result`
|
||||
#! as `Ts` and `R`.
|
||||
#!
|
||||
#! The compiler decides what is a signature, so no type implements it.
|
||||
pub trait signature {
|
||||
#! What a function of the type gives.
|
||||
type result;
|
||||
|
||||
#! The types a function of the type takes, as a pack, which only the compiler
|
||||
#! gives.
|
||||
type params...;
|
||||
}
|
||||
Reference in new issue
Block a user