FAQ
Is there any difference between exported and unexported variables if they
are defined within a func?

Assuming the answer is no, does anyone use TitleCase variables within a
func for any semantic purpose?

--

Search Discussions

  • Scott Lawrence at Jan 26, 2013 at 4:30 pm

    On Sat, 26 Jan 2013, robfig wrote:

    Is there any difference between exported and unexported variables if they
    are defined within a func? Nope.
    Assuming the answer is no, does anyone use TitleCase variables within a
    func for any semantic purpose?
    I'm sure /somebody/ does, but I've never seen it.
    --

    --
    Scott Lawrence

    go version go1.0.3
    Linux baidar 3.7.4-1-ARCH #1 SMP PREEMPT Mon Jan 21 23:05:29 CET 2013 x86_64 GNU/Linux

    --
  • Jan Mercl at Jan 26, 2013 at 4:30 pm

    On Sat, Jan 26, 2013 at 5:23 PM, robfig wrote:
    Is there any difference between exported and unexported variables if they
    are defined within a func?
    Only top level (package scope) declarations starting with an upper
    case letter are exported.

    -j
  • Minux at Jan 26, 2013 at 4:30 pm

    On Sun, Jan 27, 2013 at 12:23 AM, robfig wrote:

    Is there any difference between exported and unexported variables if they
    are defined within a func? no
    Assuming the answer is no, does anyone use TitleCase variables within a
    func for any semantic purpose?
    i will always start local variable names with lower case letters.

    --
  • Sonia Keys at Jan 27, 2013 at 6:53 pm
    The only time I start a variable with an upper case letter within a
    function is when I am coding from some reference document that I will cite.
    In this case I try to stick as close as possible to the names in the
    reference document for the benefit of anyone that might want to check my
    code. Otherwise, I always start with lower case.

    But that's not quite what you asked. Camel case (which I assume you mean
    by title case) is a technique for multiword names. Generally functions are
    small enough that multiword local variables are not needed. I use one
    letter variable names as long as I can pick a letter that is possibly
    suggestive or at least not confusing. I'm happy with two or three letter
    names as well. For example I might name a variable mw rather than
    multiword. In rare cases where I think something really needs to be
    spelled out to keep the reader from getting lost or confused, I use camel
    case starting with lower case letter, like multiWord. I think that's
    preferable to reminding the reader with comments like

    mw = false // not multi word
    On Saturday, January 26, 2013 11:23:50 AM UTC-5, robfig wrote:

    Is there any difference between exported and unexported variables if they
    are defined within a func?

    Assuming the answer is no, does anyone use TitleCase variables within a
    func for any semantic purpose?
    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJan 26, '13 at 4:23p
activeJan 27, '13 at 6:53p
posts5
users5
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase