Skip to content

Expand functionality for custom types #429

@gebv

Description

@gebv

I want to add support for binary\unary ops for custom value (implements starlark.Value)

func Binary(op syntax.Token, x, y Value) (Value, error) {

I want to add the ability to override starlark.Binary, starlark.Unary. Will you accept this PR?

PS How do I add a comparison for different types? Why can't it be done at the interface level?

pseudo code

// starlark/eval.go
var BinaryDefault = // exists function starlark.Binary
var Binary func(op syntax.Token, x, y Value) (Value, error) = BinaryDefault

// my code
func main() {

   starlark.Binary = // my custom logic for binary ops
} 

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