Skip to content

Commit e0b08a9

Browse files
aykevldeadprogram
authored andcommitted
lang-support: update for TinyGo 0.15
1 parent c659748 commit e0b08a9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

content/lang-support/_index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Here is a list of features that are supported:
1111
* Slices are well supported.
1212
* Interfaces are quite stable and should work well in almost all cases. Type switches and type asserts are also supported, as well as calling methods on interfaces. The only exception is comparing two interface values (but comparing against `nil` works).
1313
* Closures and bound methods are supported, for example inline anonymous (lambda-like) functions.
14-
* The `defer` keyword is supported, with the exception of a deferred call on an interface. This happens very infrequently in practice.
14+
* The `defer` keyword is almost entirely supported, with the exception of deferring some builtin functions.
1515

1616
## Concurrency
1717

@@ -33,18 +33,18 @@ Types supported as map keys include strings, integers, pointers, and structs/arr
3333

3434
## Standard library
3535

36-
Due to the above missing pieces and because parts of the standard library depend on the particular compiler/runtime in use, many packages do not yet compile. See the [list of compiling packages here]({{<ref "stdlib.md">}}).
36+
Due to the above missing pieces and because parts of the standard library depend on the particular compiler/runtime in use, many packages do not yet compile. See the [list of compiling packages here]({{<ref "stdlib.md">}}) (but note that "compiling" does not imply that works entirely).
3737

3838
## Garbage collection
3939

4040
While not directly a language feature (the Go spec doesn't mention it), garbage collection is important for most Go programs to make sure their memory usage stays in reasonable bounds.
4141

42-
Garbage collection is currently supported on all platforms except AVR. A simple conservative mark-sweep collector is used that will trigger a collection cycle when the heap runs out (that is fixed at compile time) or when requested manually using `runtime.GC()`.
42+
Garbage collection is currently supported on all platforms, although it works best on 32-bit chips. A simple conservative mark-sweep collector is used that will trigger a collection cycle when the heap runs out (that is fixed at compile time) or when requested manually using `runtime.GC()`. Some other collector designs are used for other targets, TinyGo will automatically pick a good GC for a given target.
4343

4444
Careful design may avoid memory allocations in main loops. You may want to compile with `-gc=none` and look at link errors to find out where allocations happen: the compiler inserts calls to `runtime.alloc` to allocate memory. For more information, see [heap allocation]({{<ref "heap-allocation.md">}}).
4545

46-
## Little used features
46+
## A note on the `recover` builtin
4747

48-
Some features are little used and there hasn't been a real need to implement them yet. These include:
48+
The `recover` builtin is not yet supported. Instead, a `panic` will always terminate a program and `recover` simply returns nil.
4949

50-
* `recover()`: this can be useful sometimes but in general most programs work just fine with a `panic()` that simply aborts. Supporting `recover()` will also likely increase code size so it has also been left out at the moment for that reason. When `recover()` gets implemented, it will likely be disabled by default and can be enabled with a compiler flag.
50+
This is a deviation from the Go spec but so far works well in practice. While there are no immediate plans to implement `recover`, if it can be shown to be necessary for compatibility it will be implemented. Please note that this comes at a cost: it means that every `defer` call will need some extra memory (both code and stack), so this feature is not free. It might also be architecture dependent. If it gets implemented, it will likely be opt-in to not increase code size for existing projects.

0 commit comments

Comments
 (0)