X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDX%2FUtils.pm;h=4c9f0b879f9d94a89117310e55a3b9ba998db6a1;hb=c25fbf056abf91b25ef365e9be2a84eb2b132dba;hp=a3384bf0b6a43377d06935c0a517d1020a433ad9;hpb=bcee3a691353e457e0b72580656c2448960bb1d7;p=scpubgit%2FDX.git diff --git a/lib/DX/Utils.pm b/lib/DX/Utils.pm index a3384bf..4c9f0b8 100644 --- a/lib/DX/Utils.pm +++ b/lib/DX/Utils.pm @@ -10,7 +10,7 @@ my @const = ( our @EXPORT_OK = ( @const, - (my @builders = qw(step string number dict proposition)), + (my @builders = qw(step rspace rstrat res string number dict proposition)), 'deparse', '*trace', ); @@ -44,9 +44,40 @@ our @VALUE_SET = (TYPE_OF(), INDICES_OF(), CONTENTS_OF()); sub trace { } +sub _expand_dep { + my ($type, @path) = @{$_[0]}; + my @expanded = map { + ref() ? @{$_->value_path or return ()} : $_ + } @path; + return [ $type, @expanded ]; +} + +sub _expand_deps { + [ map _expand_dep($_), @{$_[0]} ] +} + sub step { - require DX::Step::Normal; - DX::Step::Normal->new(@_); + require DX::Step::ResolveProposition; + my %args = @_; + DX::Step::ResolveProposition->new( + %args, + depends_on => _expand_deps($args{depends_on}), + ); +} + +sub rspace { + require DX::ResolutionSpace; + DX::ResolutionSpace->new(@_); +} + +sub rstrat { + require DX::ResolutionStrategy; + DX::ResolutionStrategy->new(@_); +} + +sub res { + require DX::Resolution; + DX::Resolution->new(@_); } sub string { @@ -84,7 +115,7 @@ sub proposition { DX::Deparse->new; }; my ($thing) = @_; - $dp->fmt($thing); + $dp->format($thing); } }