Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

Add constructors for generated types. #86

Open
jamiebrynes7 opened this issue Mar 21, 2019 · 2 comments
Open

Add constructors for generated types. #86

jamiebrynes7 opened this issue Mar 21, 2019 · 2 comments
Labels
✨ feature New feature or request

Comments

@jamiebrynes7
Copy link
Owner

Currently, the only way to create generated types is to use the object initializer syntax (or at least that's what its called in C#). Instead, we should provide a constructor as well to cut down the verbosity.

Currently we have:

improbable::Coordinates { 
	x: 0.0, 
	y: 0.0, 
	z: 0.0 
}

where we could have:

improbable::Coordinates::new(0.0, 0.0, 0.0)
@jamiebrynes7 jamiebrynes7 added the ✨ feature New feature or request label Mar 21, 2019
@jamiebrynes7 jamiebrynes7 added this to the v0.1.0 Release milestone Mar 21, 2019
@randomPoison
Copy link
Collaborator

There's a nifty crate for making this easy to do, would allow us to write less code generation on our end: https://github.com/nrc/derive-new

@jamiebrynes7
Copy link
Owner Author

Hmmm - I wonder if its worth pulling in (and likely re-exporting) a dependency when it should be fairly trivial codegen to write?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
✨ feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants