Skip to content

Remove e2function preprocessing #1087

Description

@AbigailBuccaneer

Lua is good at domain-specific languages. There's no reason we should preprocess source code.

Instead of:

e2function number operator==(complex lhs, complex rhs)
    if abs(lhs[1] - rhs[1]) > delta then return 0 end
    if abs(lhs[2] - rhs[2]) > delta then return 0 end
    return 1
end

We could get away with:

e2function [[number operator==(complex, complex)]] ..
function(lhs, rhs)
    if abs(lhs[1] - rhs[1]) > delta then return 0 end
    if abs(lhs[2] - rhs[2]) > delta then return 0 end
    return 1
end

And that's valid pure Lua.

It's not quite as nice a syntax, I grant you that, but it would actually work correctly with code editors, and it would get rid of a significant amount of code. We could also use the same syntax for registerType / registerOperator, which currently use pure Lua to define their E2 names and types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E2This issue is related to E2

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions