keid-lang / keid

Central repository for the Keid programming language
0 stars 1 forks source link

Add support for nested fields #50

Closed lucasbaizer2 closed 1 year ago

lucasbaizer2 commented 1 year ago

Nested fields are fields declared as direct children of other fields. For example:

public struct Rect {
  pos: {
    x: float64
    y: float64
  }
  size: {
    w: float64
    h: float64
  }
}

function main() {
  let r = new Rect {
    pos: { x: 0.0, y: 0.0 },
    size: {
      w: 10.0,
      h: 20.0,
    }
  }
  r.pos.y = 5.0;
}

This functions as syntactical sugar for organizational purposes and to eliminate potential unnecessary usages of classes and structs.

lucasbaizer2 commented 1 year ago

Replaced by #51.