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

Comments: Learn Enhanced C# #28

Open
qwertie opened this issue Mar 30, 2016 · 2 comments
Open

Comments: Learn Enhanced C# #28

qwertie opened this issue Mar 30, 2016 · 2 comments
Labels

Comments

@qwertie
Copy link
Owner

@qwertie qwertie commented Mar 30, 2016

@qwertie qwertie added the comments label Jul 15, 2018
@qwertie qwertie closed this Jul 15, 2018
@gjroelofs
Copy link

@gjroelofs gjroelofs commented Jan 20, 2020

Thank you for your work @qwertie, and I am actually deciding whether to integrate this library into our project.
The two primary applications we're looking at are ADTs for Address Types on spatial datastructures and value types for the different types of coordinate systems. Would you have any tips on what might help us on the latter?

(I.e.: presumably wrapped float & int Vector3 with the option to preserve (or forward to) all API that exists on the wrapped types, but with type checking on conversion.)

@qwertie
Copy link
Owner Author

@qwertie qwertie commented Jan 20, 2020

Well, I should point out that the Loyc.Math library includes Vector3<T> and Point3<T> types, but that doesn't sound like what you're looking for.

As LeMP is just a preprocessor, it doesn't do semantic analysis, so it doesn't know anything about code located elsewhere, i.e. the wrapped type, so it doesn't include a feature to "forward to all APIs in a wrapped type". The ==> operator is helpful for setting up method forwarding quickly, as the article explains, but currently it doesn't support explicit type conversions. You could use implicit conversions, as in

class WrappedType { TypeX Value; }

class WrapperType {
    public WrapperType(private WrappedType _wrapper) {}
    TypeThatConvertsImplicitlyFromTypeX Value ==> _wrapper.#;
}

If that's not sufficient, let me know and I'll give it some thought.

@qwertie qwertie reopened this Jan 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.