Skip to content

Commit

Permalink
tweak: architype inheritance check
Browse files Browse the repository at this point in the history
  • Loading branch information
marsninja committed Jan 24, 2025
1 parent bdf9dc5 commit 4788666
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions jac/examples/reference/architypes.jac
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
can print_base_classes(cls: type) -> type {
print(f"Base classes of {cls.__name__}: {[c.__name__ for c in cls.__bases__]}");
print(
f"Base classes of {cls.__name__}: {[c.__name__ for c in cls.__bases__]}"
);
return cls;
}

obj Animal {}
class Animal {}

obj Domesticated {}

@print_base_classes
obj Pet :Animal, Domesticated: {}
node Pet :Animal, Domesticated: {}

obj Person :Animal: {}
walker Person :Animal: {}

obj Feeder :Person: {}
walker Feeder :Person: {}

@print_base_classes
obj Zoologist :Feeder: {}
walker Zoologist :Feeder: {}

0 comments on commit 4788666

Please sign in to comment.