Skip to content

Operator overloading #218

@rexim

Description

@rexim

On some platforms (like 6502) it is difficult to implement some binary operations entirely by emitting assembly. It is much easier to implement them directly in B as functions. We should provide some mechanism to let the compiler know that for *this* specific binary operation call *that* function instead.

I'm not sure about exact syntax. Could be something like this to stay consistent with __asm__ and __variadic__:

__operator__(/, div);

...

div(lhs, rhs) { ... }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions