Update 'Type Definitions'
parent
7228c0bf3d
commit
16c19b5a77
@ -1,19 +0,0 @@
|
|||||||
# Syntax
|
|
||||||
|
|
||||||
```
|
|
||||||
type ro Basic:Int
|
|
||||||
|
|
||||||
type ro BasicInit:Int 6
|
|
||||||
|
|
||||||
type ro IntArrayInit:{Int 3}
|
|
||||||
3298 923 92
|
|
||||||
```
|
|
||||||
|
|
||||||
Blind typedefs are very simple. They are composed of the inherited type, and an optional default value.
|
|
||||||
|
|
||||||
# Semantics
|
|
||||||
"Blind" type definitions are called that because they cannot do fancy things
|
|
||||||
like define new members on the type they inherit, but they can inherit from
|
|
||||||
primitive types, pointers, and arrays. This can be useful for adding extra
|
|
||||||
semantics to code, and for defining methods on things that don't need to be a
|
|
||||||
whole object.
|
|
39
Type-Definitions.md
Normal file
39
Type-Definitions.md
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# Syntax
|
||||||
|
|
||||||
|
```
|
||||||
|
type ro Name:Int
|
||||||
|
|
||||||
|
type ro Name:Int:<6>
|
||||||
|
|
||||||
|
type ro Name:{Int ..}
|
||||||
|
|
||||||
|
type ro Name:Obj:(
|
||||||
|
.ro that:Int
|
||||||
|
.ro this:Int)
|
||||||
|
|
||||||
|
type ro Name:Obj:(
|
||||||
|
.ro that:Int & 1
|
||||||
|
.ro this:Int:<298> & 24)
|
||||||
|
|
||||||
|
type ro Name:Obj:(
|
||||||
|
.ro that:String:<"hello world">
|
||||||
|
.ro this:Int:<23>)
|
||||||
|
|
||||||
|
type ro Name:aBasic:(
|
||||||
|
.that:<9384>
|
||||||
|
.this:<389>)
|
||||||
|
|
||||||
|
type ro Name:aBasic:(
|
||||||
|
.this:<389>
|
||||||
|
.ro these:aBasic:(
|
||||||
|
.ro born:Int:<4>
|
||||||
|
.ro in:Int
|
||||||
|
.ro the:Int:3:<9348 92384 92834>
|
||||||
|
.this:<98>)
|
||||||
|
.that:<9384>)
|
||||||
|
```
|
||||||
|
|
||||||
|
Typedefs are very simple. They are composed of the inherited type, and an optional default value.
|
||||||
|
|
||||||
|
# Semantics
|
||||||
|
A type section assigns a name to a type specifier, and gives it module scope. The type definition's name can be used in a type specifier. For example, if a type were to be defined called `Bird`, a new variable of that type could be defined with the syntax `varName:Bird`.
|
Reference in New Issue
Block a user