Skip to content

Inconsistent precedence of user-defined functions #210

@cardillan

Description

@cardillan

When a user-defined functions shadows a built-in one, the built-in one is chosen in compile-time expression evaluation, while a user-defined one is chosen to compile non-constant expressions:

param a = 90; // Prevents compile-time evaluation

def sin(x)
    x * x;
end;

begin
    println(sin(90));
    println(sin(a));        
    printflush(message1);
end;

produces

1
8100

The issue won't be fixed until modules and namespaces are introduced, at which time some mechanism for accessing shadowed built-in functions gets implemented.

The workaround is to avoid functions that shadow existing built-in functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compilerRelated to the code generator

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions