Skip to content
Snippets Groups Projects
Select Git revision
  • next default protected
  • release/2024.1 protected
  • release/2020.3 protected
  • cherry-pick-5bb02364-2
  • cherry-pick-5bb02364
  • hacking/ci-failure
  • topics/tessellation
  • hacking/property-const-name-index
  • hacking/shadervg-windows-glcore-linkage
  • feature/c-ares
  • MacFatHacking
  • PDBHacking
  • CI-hacking-4
  • ci-hacking-3
  • topics/shivavg_update
  • topics/zeroxml
  • topics/effect-relative-model-path
  • topics/cvcanvas
  • release/2020.2 protected
  • release/2018.3 protected
  • v2024.1.1
  • version/2020.3.20-rc1
  • v2024.1.1-rc4
  • v2024.1.1-rc3
  • v2024.1.1-rc2
  • version/2020.3.19
  • version/2020.3.18
  • version/2020.3.17
  • version/2020.3.16
  • version/2020.3.15
  • version/2020.3.14
  • version/2020.3.13
  • version/2020.3.12
  • version/2020.3.11
  • version/2020.3.10
  • version/2020.3.9
  • version/2020.3.8
  • version/2020.3.7
  • version/2020.3.6
  • version/2020.3.5
40 results

gc.c

  • andy's avatar
    dd1ea541
    Sync with Nasal upstream (Melchior already had a chance to test this, · dd1ea541
    andy authored
    so hopefully not too much breaks).  New syntax features:
    
    1. Call-by-name function arguments.  You can specify a hash literal in
    place of ordered function arguments, and it will become the local
    variable namespace for the called function, making functions with many
    arguments more readable.  Ex:
    
       view_manager.lookat(heading:180, pitch:20, roll:0, x:X0, y:Y0, z:Z0,
                           time:now, fov:55);
    
    Declared arguments are checked and defaulted as would be expected:
    it's an error if you fail to pass a value for an undefaulted argument,
    missing default arguments get assigned, and any rest parameter
    (e.g. "func(a,b=2,rest...){}") will be assigned with an empty vector.
    
    2. Vector slicing.  Vectors (lists) can now be created from others
    using an ordered list of indexes and ranges.  For example:
    
       var v1 = ["a","b","c","d","e"]
    
       var v2 = v1[3,2];   # == ["d","c"];
       var v3 = v1[1:3];   # i.e. range from 1 to 3: ["b","c","d"];
       var v4 = v1[1:];    # no value means "to the end": ["b","c","d","e"]
       var i = 2;
       var v5 = v1[i];     # runtime expressions are fine: ["c"]
       var v6 = v1[-2,-1]; # negative indexes are relative to end: ["d","e"]
    
    The range values can be computed at runtime (e.g. i=1; v5=v1[i:]).
    Negative indices work the same way the do with the vector functions
    (-1 is the last element, -2 is 2nd to last, etc...).
    
    3. Multi-assignment expressions.  You can assign more than one
    variable (or lvalue) at a time by putting them in a parenthesized
    list:
    
       (var a, var b) = (1, 2);
       var (a, b) = (1, 2);               # Shorthand for (var a, var b)
       (var a, v[0], obj.field) = (1,2,3) # Any assignable lvalue works
    
       var color = [1, 1, 0.5];
       var (r, g, b) = color;  # works with runtime vectors too
    dd1ea541
    History
    Sync with Nasal upstream (Melchior already had a chance to test this,
    andy authored
    so hopefully not too much breaks).  New syntax features:
    
    1. Call-by-name function arguments.  You can specify a hash literal in
    place of ordered function arguments, and it will become the local
    variable namespace for the called function, making functions with many
    arguments more readable.  Ex:
    
       view_manager.lookat(heading:180, pitch:20, roll:0, x:X0, y:Y0, z:Z0,
                           time:now, fov:55);
    
    Declared arguments are checked and defaulted as would be expected:
    it's an error if you fail to pass a value for an undefaulted argument,
    missing default arguments get assigned, and any rest parameter
    (e.g. "func(a,b=2,rest...){}") will be assigned with an empty vector.
    
    2. Vector slicing.  Vectors (lists) can now be created from others
    using an ordered list of indexes and ranges.  For example:
    
       var v1 = ["a","b","c","d","e"]
    
       var v2 = v1[3,2];   # == ["d","c"];
       var v3 = v1[1:3];   # i.e. range from 1 to 3: ["b","c","d"];
       var v4 = v1[1:];    # no value means "to the end": ["b","c","d","e"]
       var i = 2;
       var v5 = v1[i];     # runtime expressions are fine: ["c"]
       var v6 = v1[-2,-1]; # negative indexes are relative to end: ["d","e"]
    
    The range values can be computed at runtime (e.g. i=1; v5=v1[i:]).
    Negative indices work the same way the do with the vector functions
    (-1 is the last element, -2 is 2nd to last, etc...).
    
    3. Multi-assignment expressions.  You can assign more than one
    variable (or lvalue) at a time by putting them in a parenthesized
    list:
    
       (var a, var b) = (1, 2);
       var (a, b) = (1, 2);               # Shorthand for (var a, var b)
       (var a, v[0], obj.field) = (1,2,3) # Any assignable lvalue works
    
       var color = [1, 1, 0.5];
       var (r, g, b) = color;  # works with runtime vectors too
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
gc.c 7.93 KiB