Skip to content

Commit d4b4fd1

Browse files
committed
Fix docs about casting FFI types
The section about casting FFI types started off with a somewhat nonsensical sentence. Changelog: other
1 parent 1dcb60e commit d4b4fd1

File tree

1 file changed

+10
-8
lines changed
  • docs/source/getting-started

1 file changed

+10
-8
lines changed

docs/source/getting-started/ffi.md

+10-8
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,19 @@ structs (which we'll discuss later).
102102

103103
### Type casting
104104

105-
These types can be passed to/from Inko types:
106-
107-
```inko
108-
let a = 42 as Int32 # => Int32
109-
let b = a as Int # => Int
110-
```
111-
112105
Inko doesn't perform implicit type casts, so passing an `Int32` when a `Int64`
113106
is expected will result in a compile-time error. Similarly, pointers of type
114107
`Pointer[A]` aren't implicitly compatible with pointers of type `Pointer[B]`,
115-
and instead require an explicit type cast.
108+
and instead require an explicit type cast, e.g:
109+
110+
```inko
111+
fn example(pointer: Pointer[Cat]) {}
112+
113+
let a = 0x123 as Pointer[Dog]
114+
115+
example(a) # => invalid
116+
example(a as Pointer[Cat]) # => valid
117+
```
116118

117119
## Importing libraries
118120

0 commit comments

Comments
 (0)