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

A74 Add Type Casting #52

Merged
merged 2 commits into from
Dec 23, 2022
Merged

A74 Add Type Casting #52

merged 2 commits into from
Dec 23, 2022

Conversation

Ph0enixKM
Copy link
Member

@Ph0enixKM Ph0enixKM commented Dec 22, 2022

Add ability to cast types. Absurd casts should always be warned like:

  • Text -> Num
  • * <-> Array
  • * <-> Null

(* - means anything)

let is_done = true
let is_reserved = true
let is_all = is_done as Num + is_reserved as Num
if is_all == 2 => echo 'Done'

Silence warnings if user is doing absurd cast on purpose:

#[allow_absurd_cast]
pub fun parse(text: Text) {
  ret $parse {text} $? as Num
}

@Ph0enixKM Ph0enixKM merged commit 2fcaa46 into master Dec 23, 2022
@Ph0enixKM Ph0enixKM deleted the A74 branch December 23, 2022 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant