On Thu, Feb 15, 2018 at 8:41 AM, junije wen <junjiew...@gmail.com> wrote:
> I'm reading the source code of Iris and trying to reimplement it.
> There is a line I can't understand.
>
> if p, is := e.Engine.(EngineRawExecutor); is {
>    return p.ExecuteRaw(src, wr, binding)
> }
>
> The define of EngineRawExecutor is
>
> EngineRawExecutor interface {
>    // ExecuteRaw is super-simple function without options and funcs, it's
> not used widely
>    ExecuteRaw(src string, wr io.Writer, binding interface{}) error
>
> }
>
> I'm pretty curious about how e.Engine.(EngineRawExecutor) works, what is the
> parentheses means there.

It is a type assertion: https://tour.golang.org/methods/15

p, is:=e.Engine.(EngineRawExecutor)

'is' will be true if e.Engine can be converted to an
EngineRawExecutor, and p will be a variable of type EngineRawExecutor.


>
> why this line return two return value p, and is
>
> I'm confused, any help will be great to me.
>
> 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.

-- 
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