1 package DX::PropositionSequence;
3 use Types::Standard qw(ArrayRef HashRef);
6 has members => (is => 'ro', isa => ArrayRef[Proposition], required => 1);
8 has external_names => (is => 'ro', isa => HashRef, required => 1);
10 has internal_names => (is => 'ro', isa => HashRef, required => 1);
20 sub with_additional_proposition {
21 my ($self, $prop) = @_;
23 %{$self->external_names}, %{$self->internal_names}
27 my @missing = grep !$already_names{$_}, sort keys %{$prop->required_names}
30 " variables ".join(' ', @missing)." required but not in scope";
33 my @shadow = grep $already_names{$_}, keys %{$prop->introduced_names}
36 " new variables ".join(' ', @shadow)." are already in scope";
39 die join("\n", "Can't add call to ${\$prop->predicate}:", @fail, '');
42 members => [ @{$self->members}, $prop ],
43 internal_names => { %{$self->internal_names}, %{$prop->introduced_names} },