Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs/reference/dom-specific: adding domain specific language features #206

Open
soypat opened this issue Jul 26, 2021 · 0 comments
Open

Comments

@soypat
Copy link
Contributor

soypat commented Jul 26, 2021

Create a new section under reference called Domain specific features to dump all technical details about features added to tinygo which are not present in Go or that function differently such as:

  • pragmas
  • Stdlib functionality (what does it mean to not have an OS?)
  • Memory addresses of microprocessor peripherals

I am available for starting work on this if I get a greenlight!

Below is data exchanged on slack channel.

Benjamin Gould:
function pragmas: https://github.com/tinygo-org/tinygo/blob/release/compiler/symbol.go#L245-L296
global pragmas: https://github.com/tinygo-org/tinygo/blob/release/compiler/symbol.go#L430-L453

Ayke:
The //go:inline pragma is only a hint. It will make it more likely that something is inlined, but it's no guarantee at all. In fact, I would very much recommend against using it unless you know what you're doing: the compiler usually knows better whether to inline a function or not.
The compiler will already inline many functions, the pragma only makes it somewhat more likely.

  • //go:inline and //go:noinline: only for very specific cases. Makes inlining more likely, does not have an effect on heap allocations.
  • //go:linkname: same as regular Go, don't use it unless you know what you're doing.
  • //go:align and //go:section: only for specific use cases like DMA.
  • //go:nobounds: unsafe, don't use unless you know what you're doing
  • //go:variadic: don't use (only for internal use)
  • //go:export: alias for //export, the only pragma that is meant for use in regular code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant