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

Casting of primitive types #147

Open
baszalmstra opened this issue May 1, 2020 · 0 comments
Open

Casting of primitive types #147

baszalmstra opened this issue May 1, 2020 · 0 comments
Labels
tracking Tracking issue for an epic

Comments

@baszalmstra
Copy link
Collaborator

baszalmstra commented May 1, 2020

We want to add the functionality to be able to cast from primitive types to other primitives through the use of the as keyword.

This should world:

pub fn test(a:i32) -> i64 {
    a as i64
}

[Discussion] as performs a bitcast, which avoids any security checks. Is this desirable or should we make it more difficult to write a bitcast?

[Discussion] Should we only allow as conversion if they are guaranteed to succeed? If not, a compile error will occur.

[Discussion] Should we allow fallible conversions and panic! if they fail (e.g. due to wrapping)?

@baszalmstra baszalmstra changed the title Casting of primitive types Casting of primitive types with as keyword May 1, 2020
@Wodann Wodann modified the milestone: Mun v0.3 May 1, 2020
@Wodann Wodann added the tracking Tracking issue for an epic label May 22, 2020
@Wodann Wodann changed the title Casting of primitive types with as keyword [Tracking] Casting of primitive types with as keyword May 22, 2020
@Wodann Wodann changed the title [Tracking] Casting of primitive types with as keyword Casting of primitive types May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracking Tracking issue for an epic
Projects
None yet
Development

No branches or pull requests

2 participants