Skip to content
This repository was archived by the owner on Aug 2, 2024. It is now read-only.
This repository was archived by the owner on Aug 2, 2024. It is now read-only.

Types #193

Description

@thevirtuoso1973

Two main things to decide on: the types available in our language and our type checking approach.

For types, maybe:

  • String
  • VecString or just Vec if we do not anticipate Vec<T> being needed.
    (I just realized that fixed size array types might not be not very useful.)

Possible dynamic type checking approach: during SLD resolution, whenever we resolve and see a type mismatch with the expected signature we throw a ResolutionError (I may rename this error type in this case) that's labelled as an exception. The caller(s) should be able to see it's an exception and just pass it up without further exploring the SLD tree.
This assumes that we should never encounter type errors during SLD resolution. Specifically, given some selected goal goal_pred/n if we find a rule with a matching head goal_pred/n then it must match the associated types.

Type definitions could be something like:

goal_pred(X: String, Y: VecString) :- [body].

If the body contains variables not present in the head literal, their types would still be defined since there is some associated head literal (or builtin) that would define that variable type.
(Notably DDlog uses some other way to define types that seems unnecessary for our purposes.)


Related literature:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions