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

Some thoughts on Casting #320

Open
muriloadriano opened this issue Mar 13, 2013 · 0 comments
Open

Some thoughts on Casting #320

muriloadriano opened this issue Mar 13, 2013 · 0 comments

Comments

@muriloadriano
Copy link
Member

We should implement casting operations. The suggested syntax is:

x = Type(value);

There are some ideas of implementations of that:

  • Internally on init() (where we have addMethod()) we could have:
addCast(CLEVER_INT, method_int_cast_name); // Method that casts an Int to the current type
addCast(CLEVER_STR, method_str_cast_name); // Same with String
...
  • User classes (we could replace @ with cast):
class Foo {

function @Int(x) {

}

// ... or
cast std:collection:Set(x) {

}

}

What do you think?

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

1 participant