Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISupportsConstructorChain #3

Closed
viluon opened this issue Feb 16, 2016 · 1 comment
Closed

ISupportsConstructorChain #3

viluon opened this issue Feb 16, 2016 · 1 comment

Comments

@viluon
Copy link
Owner

viluon commented Feb 16, 2016

An interface for method chaining of constructors. ISupportsConstructorChain would set the __call metamethod to the constructor of the implementing class, which would allow constructs like

local a, b, c = Point3D ( 1, 2, 3 ) ( 2, 3, 4 ) ( 3, 4, 5 )

This issue has been derived from #1

@viluon viluon self-assigned this Feb 16, 2016
@viluon viluon added this to the Pre-release 0.1 milestone Feb 16, 2016
@viluon
Copy link
Owner Author

viluon commented Feb 16, 2016

Wait, brain fart! Simply setting __call to the constructor wouldn't work, since we need to return all 3 Point3Ds, not just the last one (referring to the example). We need to store the points that are being constructed in an array somewhere, and unpack them on every __call. That will give the result we wanted!

@viluon viluon closed this as completed in 177fdac Feb 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant