It's documented. From lang spec
https://golang.org/ref/spec#Function_declarations
        "A function declaration may omit the body. Such a declaration
        provides the signature for a function implemented outside Go,
        such as an assembly routine."

On Thu, 9 Feb 2017 04:15:00 -0800
(PST) Sina Siadat <sia...@gmail.com> wrote:

> Hi! In $GOROOT/src/sync/mutex.go:19 there is a function declaration
> like this:
> 
>     func throw(string) // provided by runtime
> 
> The function body is missing. I was wondering what is meant by
> "provided by runtime" and how it is done.
> I am guessing this is the same as the throw func defined in 
> src/runtime/panic.go:589. But can't find how the compiler connects
> the two. I thought maybe a body is assigned to this function later
> like this:
> 
>     throw = func(s string) { }
> 
> But this fails to compile with "cannot assign to throw" probably
> because throw is not a variable.
> 
> Thanks!
> 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to