Skip to content

Commit

Permalink
GrammaticalExpression shouldn't / can't be frozen
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Haberland authored and Christopher Haberland committed Dec 24, 2023
1 parent c46053e commit 19a8ee6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ultk/language/grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __str__(self) -> str:
return out_str


@dataclass(eq=True, frozen=True, kw_only=True)
@dataclass(eq=True, kw_only=True)
class GrammaticalExpression(Expression):
"""A GrammaticalExpression has been built up from a Grammar by applying a sequence of Rules.
Crucially, it is _callable_, using the functions corresponding to each rule.
Expand Down
8 changes: 4 additions & 4 deletions src/ultk/language/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
from dataclasses import dataclass
from typing import Callable, Iterable

@dataclass(frozen=True, kw_only=True)
@dataclass()
class Expression:

"""Minimally contains a form and a meaning."""

# gneric/dummy form and meaning if not specified
# useful for hashing in certain cases
# (e.g. a GrammaticalExpression which has not yet been evaluate()'d and so does not yet have a Meaning)
form: str = ""
meaning: Meaning = Meaning(tuple(), Universe(tuple()))
form: str | None = ""
meaning: Meaning | None = Meaning(tuple(list()), Universe(tuple(list())))

def can_express(self, referent: Referent) -> bool:
"""Return True if the expression can express the input single meaning point and false otherwise."""
Expand All @@ -48,7 +48,7 @@ def __lt__(self, other: object) -> bool:

def __bool__(self) -> bool:
return bool(self.form and self.meaning)


class Language:
"""Minimally contains Expression objects."""
Expand Down

0 comments on commit 19a8ee6

Please sign in to comment.