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

[ideas] a clear marker for %identity #1587

Closed
bobzhang opened this issue May 7, 2017 · 1 comment
Closed

[ideas] a clear marker for %identity #1587

bobzhang opened this issue May 7, 2017 · 1 comment

Comments

@bobzhang
Copy link
Member

bobzhang commented May 7, 2017

following #1581, it is not good practice to encourage people to use %identity everywhere, or at least we should provide a more obvious syntax:

[%bs.cast: 'a -> 'b] (* similar to (Obj.magic (x : 'a) : 'b )* )

[%%bs.cast.xx : 'a -> 'b] (* similar to external xx : 'a -> 'b = "%identity" *)

The reason is that bs.cast is not first class, while Obj.magic or external would be first class and can be aliased, with this addition, we can ask users to cast types explicitly

@OvermindDL1
Copy link
Contributor

I'm not really a fan of bs.cast because Obj.magic already does it, and such calls should absolutely be minimized as it is and magic makes it very obvious to "Be Careful For Here Be Dragons"...

@bobzhang bobzhang closed this as completed Mar 1, 2018
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

2 participants