39 lines
973 B
Core
39 lines
973 B
Core
// We can bind module to a name
|
|
M :: #import "Multimedia.core"
|
|
|
|
// We can bind a struct to a name
|
|
Mu :: M.Mu
|
|
|
|
// We can bind a lambda to a name
|
|
Start :: M.StartMultimedia
|
|
|
|
// Other example of binding a lambda to a name
|
|
SomeOtherLambda :: () ;; pass
|
|
AliasOf :: SomeOtherLambda
|
|
|
|
// We can bind a simple type to name, this type is
|
|
// exactly the same as int, typechecker doesn't complain
|
|
NewInt :: int
|
|
|
|
// We can force it to complain using a '#strict' directive
|
|
// this makes a new type that requires casting, good for ids
|
|
// and stuff like that, normal int operations still work!
|
|
StrictInt :: #strict int
|
|
|
|
SomeStruct :: struct ;; a: int
|
|
StructAlias :: SomeStruct
|
|
|
|
|
|
main :: (): int
|
|
some_struct: SomeStruct = {a = 10}
|
|
struct_alias: StructAlias = some_struct
|
|
Assert(struct_alias.a == 10)
|
|
|
|
#Assert(SomeStruct == StructAlias)
|
|
#Assert(NewInt == int)
|
|
#Assert(StrictInt != int)
|
|
|
|
mu: Mu = Start(x = 1280, y = 720)
|
|
Assert(mu.x == 1280 && mu.y == 720)
|
|
|
|
return 0 |