dqy27359 2014-05-15 13:58
浏览 46
已采纳

在goLang中,谁了解* var.Type

 11 func Map(value string) *list.List {
 12 }

for example as above. "list" is var name, List is goLang built-in type. how do I understand *list.List ?

Is it a List pointer that with name list?

Also, if my understanding is right, what is the element's type in this list? It is not defined.

Thanks,

  • 写回答

1条回答 默认 最新

  • doutu7123 2014-05-15 14:08
    关注

    The Go Programming Language Specification

    Function types

    A function type denotes the set of all functions with the same parameter and result types. The value of an uninitialized variable of function type is nil.

    FunctionType   = "func" Signature .
    Signature      = Parameters [ Result ] .
    Result         = Parameters | Type .
    Parameters     = "(" [ ParameterList [ "," ] ] ")" .
    ParameterList  = ParameterDecl { "," ParameterDecl } .
    ParameterDecl  = [ IdentifierList ] [ "..." ] Type .
    

    Within a list of parameters or results, the names (IdentifierList) must either all be present or all be absent. If present, each name stands for one item (parameter or result) of the specified type and all non-blank names in the signature must be unique. If absent, each type stands for one item of that type. Parameter and result lists are always parenthesized except that if there is exactly one unnamed result it may be written as an unparenthesized type.


    Package list

    import "container/list"
    

    Package list implements a doubly linked list.

    type Element

    type Element struct {
    
            // The value stored with this element.
            Value interface{}
            // contains filtered or unexported fields
    }
    

    Element is an element of a linked list.

    type List

    type List struct {
            // contains filtered or unexported fields
    }
    

    List represents a doubly linked list. The zero value for List is an empty list ready to use.


    list is a package name. The result type *list.List is a pointer to type list.List. The elements of type list.List are of type list.Element. For example,

    package main
    
    import "container/list"
    
    func Map(value string) *list.List { return nil }
    
    func main() {}
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Centos7 / PETGEM
  • ¥15 csmar数据进行spss描述性统计分析
  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗