Skip to content

[Python] function method externs are generated with odd syntax #4853

Open
@lucasmcdonald3

Description

@lucasmcdonald3

Dafny version

4.3.0 (specifically after commit ba3bac3)

Code to produce this issue

module {:extern "AnyModule"} Any.Module {

    method {:extern "AnyModule", "anyMethod"} anyMethod() {
        print("Any method");
    }

    function method {:extern "AnyModule", "anyFunctionMethod"} anyFunctionMethod() : string {
        "s"
    }

    method callExterns() {
        anyMethod();
        var a := anyFunctionMethod();
    }
}

Command to run and resulting output

dafny AnyModule.dfy -compileTarget:py -functionSyntax:3

Resulting generated code snippet:

AnyModule.anyMethod()
d_0_a_: _dafny.Seq
d_0_a_ = AnyModule_anyFunctionMethod()

What happened?

The syntax AnyModule_anyFunctionMethod() is strange; I would expect AnyModule.anyFunctionMethod. That syntax is more idiomatic and the same as extern methods.

I'm wondering if this is a subtle unintended regression that was introduced in the linked commit, or is this an intentional change?

If it's a regression, it's easy to work around for now. The impact is that I have to write externs for function methods in non-idiomatic ways.

What type of operating system are you experiencing the problem on?

Mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: performancePerformance issueskind: enhancementEnhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafnylang: pythonDafny's Python transpiler and its runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions