Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Rename Vector3Int to Vector3i

Discussion in '2017.2 Beta' started by Deni35, Jul 12, 2017.

  1. Deni35

    Deni35

    Joined:
    Jul 10, 2012
    Posts:
    43
    Look at this:


    I'm sure the Vector3i looks much better.
     
    MrEsquire likes this.
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I don't think it looks better but it does not look worse.

    Also, saving two characters while making it more obscure to read isn't something I can get behind, so the verbose version is superior.

    I wasn't even aware there was an int version. It must be unique to 2017.2.
     
    DMeville and pahe like this.
  3. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Already use a Vector3Int as part of a voxel framework, so this new then.. maybe they should have gone with Vector3i :)
     
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    The .NET Framework Class Naming Guidelines includes the following point:
    In this case, it seems Vector3Int is more compliant to the Naming Guidelines than Vector3i, according to the document at least.
    https://msdn.microsoft.com/en-us/library/4xhs4564(v=vs.71).aspx
     
  5. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    295
    If Vector3 were Vector3f (as it is in some other frameworks, such as LWJGL and Ogre), Vector3i would make sense. But as things are, Vector3Int is the better name IMO.
     
  6. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    970
    I'm not. ;-)
     
  7. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    825
    Verbose is always better IMHO. In today's realm of autocomplete editors, verbose naming is preferred in most cases. It requires no more typing, and is clear and unambiguous.
     
  8. Muuuuo

    Muuuuo

    Joined:
    Apr 16, 2015
    Posts:
    57
    Don't tell me there's a Vector3Double too.
     
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Vector3Long come back, all is forgiven.
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Personally I prefer using the internal Type first, as that maps to how the rest of the syntax of C# works in my head:

    Code (CSharp):
    1. IntVector3 foo = new IntVector3(0,0,0);
    2.  
     
    alexzzzz, jwvanderbeck and hippocoder like this.
  11. EnokV

    EnokV

    Joined:
    Apr 14, 2016
    Posts:
    56
    While I usually agree with the microsoft guidelines, especially regarding abbreviations, one must note that "sparingly" != "never", and you always declare floats with a suffix "f".
    Code (CSharp):
    1. float someFloat = 0.5f;
    With that in mind, I think it makes perfect sense to suffix a class/struct with "f" or "i" if it deals primarily with floats or integers, etc. However, with that logic, one would think Unity's Vector3 struct deals primarily with doubles(or ints) since it's NOT suffixed.

    It doesn't really matter how you twist and turn this, there will be inconsistencies so it doesn't really matter.
     
  12. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,498
    I think this is something that will be adapted so quickly and easily that no one will really care in the long run.
     
    EnokV likes this.
  13. OswaldHurlem

    OswaldHurlem

    Joined:
    Jan 6, 2017
    Posts:
    40
    I would very strongly prefer that Int/I/i be placed either before "3" or before "Vector." I'm making a library to mirror Unity's vector types in C and for conversions I need to have the input and output types to be separated in some way (each function must have a unique name in C). For example, a function converting a float vector to an int vector might have the signature:
    Code (C):
    1. VectorI3 MkVectorI3F(Vector3 vector)
    If the vector's component type is used as a suffix this becomes
    Code (C):
    1. Vector3i MkVector3if(Vector3 vector)
    Which blows because the separation between the input/output types is less clear, and also, it looks like "if."

    Some other opinions:
    • Using "Int" I think is kind of dumb. If any code uses Vector3Int it will use it a lot and you'll spend a lot more time typing it than figuring out what it means.
    • A trailing "i" isn't great because it looks quite a bit like a semicolon.