Skip to content

Some thoughts on Casting #320

@muriloadriano

Description

@muriloadriano

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions