Skip to content

Static typing? #27

@JeffreyBenjaminBrown

Description

@JeffreyBenjaminBrown

(Most of this duplicates a question on Stackoverflow. )

For instance[1], using the mypy library, one can specify that a function inputs a string and outputs a string, like this:

    def greeting(name: str) -> str:
        return 'Hello, {}'.format(name)

In pyDatalog, one can define (say) a unary function a single value at a time, like this:

    +(favoriteWords[0] == "cats")

Nothing prevents someone else from defining a totally-differently-typed value of favoriteWords. Is there some way to specify that the argument to favoriteWords must be a single integer, and the output must be a string?

[1] (In addition to mypy there are a number of other ways to attach type signatures; some of them are even built into later versions of Python 3.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions