Skip to content

Conversation

@kaidesu
Copy link
Member

@kaidesu kaidesu commented Oct 18, 2023

Properly evaluates class instance properties. You can now assign properties directly within the constructor:

class Circle {
  function constructor(area = 5) {
    this.area = area
  }

  function area() {
    return math.pi * this.area * this.area
  }
}

circle = Circle.new(10)

print(circle.area())

// 314.1592653589793

Closes #119

@kaidesu kaidesu merged commit ba16400 into 1.0 Oct 18, 2023
@kaidesu kaidesu deleted the bug/119 branch October 18, 2023 03:49
pairs := make(map[object.MapKey]object.MapPair)

fmt.Printf("self: %v\n", scope.Self)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably doesn't need to remain here..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this! This has been cleaned up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Class with constructor got issue

3 participants