Changeset 18093 for ext

Show
Ignore:
Timestamp:
09/22/07 09:55:46 (16 months ago)
Author:
Darren_Duncan
Message:

ext/Muldis-DB/ : some minimal compatibility updates to PhysType?.pm and Operators.pm

Location:
ext/Muldis-DB
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • ext/Muldis-DB/Changes

    r18091 r18093  
    1010    which sets its own less frequent release schedule.  The rest of this 
    1111    Changes entry refers only to the Perl 5 version. 
     12 
     13    * This release is a snapshot to show a particular mid-way point in a 
     14    large sequence of changes.  To summarize, the public API of Muldis DB 
     15    has been rewritten, documentation for that API was added (including an 
     16    example), and both the Example Engine and the Validator suite were 
     17    (substantially) updated to conform to the new API.  However, the 
     18    Example Engine is still incapable of executing any tasks, so that 
     19    aspect is unchanged from before.  The next release should flesh out 
     20    Example so that it executes some tasks. 
    1221 
    1322    * Removed the file Literal.pm; Muldis DB now uses Perl Hosted Abstract 
     
    7483 
    7584    * (Example.pm)  Rewrote the Example.pm code to conform to the changed 
    76     API declared by Interface.pm.  TODO: FINISH THIS. 
     85    API declared by Interface.pm.  The new version implements the root 
     86    module, the ::DBMS and ::Var classes, but not the ::(Func|Proc)Binding 
     87    classes.  Also, the interface-role implementing classes were all 
     88    renamed aside from interface-conformity, specifically "::Public" was 
     89    added to all their names, that signifying that these are the only 
     90    classes that applications would directly invoke.  This file stands to 
     91    be substantially updated in the next releases, but for the most part 
     92    most Example code will be put in other files, with Example.pm limited 
     93    to providing just the public interface. 
     94 
     95    * (PhysType.pm, Operators.pm)  Made a minimal set of updates to these 
     96    files to bring them up to date with the current Muldis D type or 
     97    routine names for what they implement, and to remove any references to 
     98    Literal.pm.  These files stand to be substantially updated, or even 
     99    replaced in the next releases. 
    77100 
    78101    * (SeeAlso.pod)  Updated the PROSPECTIVE MULDIS DB EXTENSIONS section 
  • ext/Muldis-DB/lib/Muldis/DB/Engine/Example/Operators.pm

    r18088 r18093  
    1515########################################################################### 
    1616 
    17 ## sys.type.Bool ## 
     17## sys.Core.Universal.Universal ## 
    1818 
    19  
    20 ## sys.type.Order ## 
    21  
    22  
    23 ## sys.type.Int ## 
    24  
    25 'sys.rtn.Int.equal' => sub ($dbms!, Hash $ro_args!) { 
     19'sys.Core.Universal.is_equal' => sub ($dbms!, Hash $ro_args!) { 
    2620    my ($v1, $v2) = $ro_args<v1 v2>; 
    2721    return ptBool( :v($v1.equal( $v2 )) ); 
    2822}, 
    2923 
    30 'sys.rtn.Int.not_equal' => sub ($dbms!, Hash $ro_args!) { 
     24'sys.Core.Universal.is_not_equal' => sub ($dbms!, Hash $ro_args!) { 
    3125    my ($v1, $v2) = $ro_args<v1 v2>; 
    3226    return ptBool( :v(!$v1.equal( $v2 )) ); 
    3327}, 
    3428 
    35 'sys.rtn.Int.assign' => sub ($dbms!, Hash $upd_args!, Hash $ro_args!) { 
     29'sys.Core.Universal.assign' 
     30        => sub ($dbms!, Hash $upd_args!, Hash $ro_args!) { 
    3631    my ($target) = $upd_args<target>; 
    3732    my ($v) = $ro_args<v>; 
     
    4035}, 
    4136 
    42 'sys.rtn.Int.sum' => sub ($dbms!, Hash $ro_args!) { 
     37## sys.Core.Bool.Bool ## 
     38 
     39 
     40## sys.Core.Order.Order ## 
     41 
     42 
     43## sys.Core.Int.Int ## 
     44 
     45'sys.Core.Int.sum' => sub ($dbms!, Hash $ro_args!) { 
    4346    my ($addends) = $ro_args<addends>; 
    4447    my Int $sum = 0; 
     
    4952}, 
    5053 
    51 'sys.rtn.Int.difference' => sub ($dbms!, Hash $ro_args!) { 
     54'sys.Core.Int.difference' => sub ($dbms!, Hash $ro_args!) { 
    5255    my ($minuend, $subtrahend) = $ro_args<minuend subtrahend>; 
    5356    return ptInt( :v($minuend.v() - $subtrahend.v()) ); 
    5457}, 
    5558 
    56 'sys.rtn.Int.product' => sub ($dbms!, Hash $ro_args!) { 
     59'sys.Core.Int.product' => sub ($dbms!, Hash $ro_args!) { 
    5760    my ($factors) = $ro_args<factors>; 
    5861    my Int $product = 1; 
     
    6366}, 
    6467 
    65 'sys.rtn.Int.quotient' => sub ($dbms!, Hash $ro_args!) { 
     68'sys.Core.Int.quotient' => sub ($dbms!, Hash $ro_args!) { 
    6669    my ($dividend, $divisor) = $ro_args<dividend divisor>; 
    6770    my Int $divisor_v = $divisor.v(); 
    68     die q{sys.rtn.Int.quotient(): Arg :$divisor is zero.} 
     71    die q{sys.Core.Int.quotient(): Arg :$divisor is zero.} 
    6972        if $divisor_v === 0; 
    7073#    return ptInt( :v(floor ($dividend.v() div $divisor_v)) ); 
     
    7275}, 
    7376 
    74 'sys.rtn.Int.remainder' => sub ($dbms!, Hash $ro_args!) { 
     77'sys.Core.Int.remainder' => sub ($dbms!, Hash $ro_args!) { 
    7578    my ($dividend, $divisor) = $ro_args<dividend divisor>; 
    7679    my Int $divisor_v = $divisor.v(); 
    77     die q{sys.rtn.Int.remainder(): Arg :$divisor is zero.} 
     80    die q{sys.Core.Int.remainder(): Arg :$divisor is zero.} 
    7881        if $divisor_v === 0; 
    7982#    return ptInt( :v($dividend.v() mod $divisor_v) ); 
     
    8184}, 
    8285 
    83 'sys.rtn.Int.abs' => sub ($dbms!, Hash $ro_args!) { 
     86'sys.Core.Int.abs' => sub ($dbms!, Hash $ro_args!) { 
    8487    my ($v) = $ro_args<v>; 
    8588    return ptInt( :v(abs $v.v()) ); 
    8689}, 
    8790 
    88 'sys.rtn.Int.power' => sub ($dbms!, Hash $ro_args!) { 
     91'sys.Core.Int.power' => sub ($dbms!, Hash $ro_args!) { 
    8992    my ($radix, $exponent) = $ro_args<radix exponent>; 
    9093    return ptInt( :v($radix.v() ** $exponent.v()) ); 
    9194}, 
    9295 
    93 ## sys.type.Blob ## 
     96## sys.Core.Num.Num ## 
    9497 
    9598 
    96 ## sys.type.Text ## 
     99## sys.Core.Blob.Blob ## 
    97100 
    98101 
    99 ## sys.type.Tuple ## 
     102## sys.Core.Text.Text ## 
    100103 
    101104 
    102 ## sys.type.Relation ## 
     105## sys.Core.Tuple.Tuple ## 
     106 
     107 
     108## sys.Core.Relation.Relation ## 
    103109 
    104110 
     
    142148all Muldis D implementations must have, which is the selectors for and 
    143149general purpose functions and update operators for these data types: Bool, 
    144 Text, Blob, Int, Num, Tuple, Relation, and the Cat.* types. 
     150Order, Int, Num, Text, Blob, Tuple, Relation, and the Cat.* types. 
    145151 
    146152By contrast, the operators specific to the optional data types are 
  • ext/Muldis-DB/lib/Muldis/DB/Engine/Example/PhysType.pm

    r18088 r18093  
    217217 
    218218method root_type of Str () { 
    219     return 'sys.type.Bool'; 
     219    return 'sys.Core.Bool.Bool'; 
    220220} 
    221221 
     
    223223    if (!$!which.defined) { 
    224224        my Str $s = ~$!v; 
    225         $!which = "13 sys.type.Bool {$s.graphs} $s"; 
     225        $!which = "18 sys.Core.Bool.Bool {$s.graphs} $s"; 
    226226    } 
    227227    return $!which; 
     
    230230########################################################################### 
    231231 
    232 method as_ast of Muldis::DB::Literal::Bool () { 
    233     return ::Muldis::DB::Literal::Bool.new( :v($!v) ); 
     232method as_ast of Muldis::DB::LOSE::Bool () { 
     233    return ::Muldis::DB::LOSE::Bool.new( :v($!v) ); 
    234234} 
    235235 
     
    270270 
    271271method root_type of Str () { 
    272     return 'sys.type.Order'; 
     272    return 'sys.Core.Order.Order'; 
    273273} 
    274274 
     
    276276    if (!$!which.defined) { 
    277277        my Str $s = ~$!v; 
    278         $!which = "14 sys.type.Order {$s.graphs} $s"; 
     278        $!which = "20 sys.Core.Order.Order {$s.graphs} $s"; 
    279279    } 
    280280    return $!which; 
     
    283283########################################################################### 
    284284 
    285 method as_ast of Muldis::DB::Literal::Order () { 
    286     return ::Muldis::DB::Literal::Order.new( :v($!v) ); 
     285method as_ast of Muldis::DB::LOSE::Order () { 
     286    return ::Muldis::DB::LOSE::Order.new( :v($!v) ); 
    287287} 
    288288 
     
    323323 
    324324method root_type of Str () { 
    325     return 'sys.type.Int'; 
     325    return 'sys.Core.Int.Int'; 
    326326} 
    327327 
     
    329329    if (!$!which.defined) { 
    330330        my Str $s = ~$!v; 
    331         $!which = "12 sys.type.Int {$s.graphs} $s"; 
     331        $!which = "16 sys.Core.Int.Int {$s.graphs} $s"; 
    332332    } 
    333333    return $!which; 
     
    336336########################################################################### 
    337337 
    338 method as_ast of Muldis::DB::Literal::Int () { 
    339     return ::Muldis::DB::Literal::Int.new( :v($!v) ); 
     338method as_ast of Muldis::DB::LOSE::Int () { 
     339    return ::Muldis::DB::LOSE::Int.new( :v($!v) ); 
    340340} 
    341341 
     
    376376 
    377377method root_type of Str () { 
    378     return 'sys.type.Blob'; 
     378    return 'sys.Core.Blob.Blob'; 
    379379} 
    380380 
     
    382382    if (!$!which.defined) { 
    383383        my Str $s = ~$!v; 
    384         $!which = "13 sys.type.Blob {$s.graphs} $s"; 
     384        $!which = "18 sys.Core.Blob.Blob {$s.graphs} $s"; 
    385385    } 
    386386    return $!which; 
     
    389389########################################################################### 
    390390 
    391 method as_ast of Muldis::DB::Literal::Blob () { 
    392     return ::Muldis::DB::Literal::Blob.new( :v($!v) ); 
     391method as_ast of Muldis::DB::LOSE::Blob () { 
     392    return ::Muldis::DB::LOSE::Blob.new( :v($!v) ); 
    393393} 
    394394 
     
    429429 
    430430method root_type of Str () { 
    431     return 'sys.type.Text'; 
     431    return 'sys.Core.Text.Text'; 
    432432} 
    433433 
     
    435435    if (!$!which.defined) { 
    436436        my Str $s = $!v; 
    437         $!which = "13 sys.type.Text {$s.graphs} $s"; 
     437        $!which = "18 sys.Core.Text.Text {$s.graphs} $s"; 
    438438    } 
    439439    return $!which; 
     
    442442########################################################################### 
    443443 
    444 method as_ast of Muldis::DB::Literal::Text () { 
    445     return ::Muldis::DB::Literal::Text.new( :v($!v) ); 
     444method as_ast of Muldis::DB::LOSE::Text () { 
     445    return ::Muldis::DB::LOSE::Text.new( :v($!v) ); 
    446446} 
    447447 
     
    486486 
    487487method root_type of Str () { 
    488     return 'sys.type.' ~ (self._allows_quasi() ?? 'Quasi' !! '') ~ 'Tuple'; 
     488    my $unqltp = ($self->_allows_quasi() ?? 'Quasi' !! '') ~ 'Tuple'; 
     489    return "sys.Core.$unqltp.$unqltp"; 
    489490} 
    490491 
    491492method which of Str () { 
    492493    if (!$!which.defined) { 
    493         my Str $root_type = 'sys.type.' 
    494             ~ (self._allows_quasi() ?? 'Quasi' !! '') ~ 'Tuple'; 
     494        my $unqltp = ($self->_allows_quasi() ?? 'Quasi' !! '') ~ 'Tuple'; 
     495        my Str $root_type = "sys.Core.$unqltp.$unqltp"; 
    495496        my Str $tpwl = $root_type.graphs ~ q{ } ~ $root_type; 
    496497        my Str $s = "H {$!heading.which()} B {$!body.which()}"; 
     
    502503########################################################################### 
    503504 
    504 method as_ast of Muldis::DB::Literal::_Tuple () { 
     505method as_ast of Muldis::DB::LOSE::_Tuple () { 
    505506    my $call_args = \( :heading($!heading.as_ast()), 
    506507        :body($!body.as_ast()) ); 
    507508    return self._allows_quasi() 
    508         ?? ::Muldis::DB::Literal::QuasiTuple.new.callwith( |$call_args ) 
    509         !! ::Muldis::DB::Literal::Tuple.new.callwith( |$call_args ); 
     509        ?? ::Muldis::DB::LOSE::QuasiTuple.new.callwith( |$call_args ) 
     510        !! ::Muldis::DB::LOSE::Tuple.new.callwith( |$call_args ); 
    510511} 
    511512 
     
    599600 
    600601method root_type of Str () { 
    601     return 
    602         'sys.type.' ~ (self._allows_quasi() ?? 'Quasi' !! '') ~ 'Relation'; 
     602    my $unqltp = ($self->_allows_quasi() ?? 'Quasi' !! '') ~ 'Relation'; 
     603    return "sys.Core.$unqltp.$unqltp"; 
    603604} 
    604605 
    605606method which of Str () { 
    606607    if (!$!which.defined) { 
    607         my Str $root_type = 'sys.type.' 
    608             ~ (self._allows_quasi() ?? 'Quasi' !! '') ~ 'Relation'; 
     608        my $unqltp 
     609            = ($self->_allows_quasi() ?? 'Quasi' !! '') ~ 'Relation'; 
     610        my Str $root_type = "sys.Core.$unqltp.$unqltp"; 
    609611        my Str $tpwl = $root_type.graphs ~ q{ } ~ $root_type; 
    610612        my Str $s = "H {$!heading.which()} B " 
     
    617619########################################################################### 
    618620 
    619 method as_ast of Muldis::DB::Literal::_Relation () { 
     621method as_ast of Muldis::DB::LOSE::_Relation () { 
    620622    my $call_args = \( :heading($!heading.as_ast()), 
    621623        :body([$!body.map:{ .as_ast() }]) ); 
    622624    return self._allows_quasi() 
    623         ?? ::Muldis::DB::Literal::QuasiRelation.new.callwith( |$call_args ) 
    624         !! ::Muldis::DB::Literal::Relation.new.callwith( |$call_args ); 
     625        ?? ::Muldis::DB::LOSE::QuasiRelation.new.callwith( |$call_args ) 
     626        !! ::Muldis::DB::LOSE::Relation.new.callwith( |$call_args ); 
    625627} 
    626628 
     
    720722 
    721723method root_type of Str () { 
    722     return 'sys.type._TypeInvo' ~ (self._allows_quasi() ?? 'AQ' !! 'NQ'); 
     724    return 'sys.LOSE._TypeInvo' ~ (self._allows_quasi() ?? 'AQ' !! 'NQ'); 
    723725} 
    724726 
    725727method which of Str () { 
    726728    if (!$!which.defined) { 
    727         my Str $tpwl = '20 sys.type._TypeInvo' 
     729        my Str $tpwl = '20 sys.LOSE._TypeInvo' 
    728730            ~ (self._allows_quasi() ?? 'AQ' !! 'NQ'); 
    729731        my Str $sk = $!kind.graphs ~ q{ } ~ $!kind; 
     
    738740########################################################################### 
    739741 
    740 method as_ast of Muldis::DB::Literal::_TypeInvo () { 
     742method as_ast of Muldis::DB::LOSE::_TypeInvo () { 
    741743    my $call_args = \( :kind($!kind), 
    742744        :spec($!kind === 'Any' ?? $!spec 
    743             !! $!kind === 'Scalar' ?? ::Muldis::DB::Literal::EntityName.new( :text($!spec) ) 
     745            !! $!kind === 'Scalar' ?? ::Muldis::DB::LOSE::EntityName.new( :text($!spec) ) 
    744746            !! $!spec.as_ast()) ); 
    745747    return self._allows_quasi() 
    746         ?? ::Muldis::DB::Literal::QuasiTypeInvo.new.callwith( |$call_args ) 
    747         !! ::Muldis::DB::Literal::TypeInvo.new.callwith( |$call_args ); 
     748        ?? ::Muldis::DB::LOSE::QuasiTypeInvo.new.callwith( |$call_args ) 
     749        !! ::Muldis::DB::LOSE::TypeInvo.new.callwith( |$call_args ); 
    748750} 
    749751 
     
    812814 
    813815method root_type of Str () { 
    814     return 'sys.type._TypeDict' ~ (self._allows_quasi() ?? 'AQ' !! 'NQ'); 
     816    return 'sys.LOSE._TypeDict' ~ (self._allows_quasi() ?? 'AQ' !! 'NQ'); 
    815817} 
    816818 
    817819method which of Str () { 
    818820    if (!$!which.defined) { 
    819         my Str $tpwl = '20 sys.type._TypeDict' 
     821        my Str $tpwl = '20 sys.LOSE._TypeDict' 
    820822            ~ (self._allows_quasi() ?? 'AQ' !! 'NQ'); 
    821823        my Str $s = $!map.pairs.sort.map:{ 
     
    829831########################################################################### 
    830832 
    831 method as_ast of Muldis::DB::Literal::_TypeDict () { 
     833method as_ast of Muldis::DB::LOSE::_TypeDict () { 
    832834    my $call_args = \( :map([ $!map.pairs.map:{ 
    833             [::Muldis::DB::Literal::EntityName.new( :text(.key) ), .value.as_ast()], 
     835            [::Muldis::DB::LOSE::EntityName.new( :text(.key) ), .value.as_ast()], 
    834836        } ]) ); 
    835837    return self._allows_quasi() 
    836         ?? ::Muldis::DB::Literal::QuasiTypeDict.new.callwith( |$call_args ) 
    837         !! ::Muldis::DB::Literal::TypeDict.new.callwith( |$call_args ); 
     838        ?? ::Muldis::DB::LOSE::QuasiTypeDict.new.callwith( |$call_args ) 
     839        !! ::Muldis::DB::LOSE::TypeDict.new.callwith( |$call_args ); 
    838840} 
    839841 
     
    917919 
    918920method root_type of Str () { 
    919     return 'sys.type._ValueDict' ~ (self._allows_quasi() ?? 'AQ' !! 'NQ'); 
     921    return 'sys.LOSE._ValueDict' ~ (self._allows_quasi() ?? 'AQ' !! 'NQ'); 
    920922} 
    921923 
    922924method which of Str () { 
    923925    if (!$!which.defined) { 
    924         my Str $tpwl = '20 sys.type._ValueDict' 
     926        my Str $tpwl = '20 sys.LOSE._ValueDict' 
    925927            ~ (self._allows_quasi() ?? 'AQ' !! 'NQ'); 
    926928        my Str $s = $!map.pairs.sort.map:{ 
     
    934936########################################################################### 
    935937 
    936 method as_ast of Muldis::DB::Literal::_ExprDict () { 
    937     return ::Muldis::DB::Literal::_ExprDict.new( :map([ $!map.pairs.map:{ 
    938             [::Muldis::DB::Literal::EntityName.new( :text(.key) ), .value.as_ast()], 
     938method as_ast of Muldis::DB::LOSE::_ExprDict () { 
     939    return ::Muldis::DB::LOSE::_ExprDict.new( :map([ $!map.pairs.map:{ 
     940            [::Muldis::DB::LOSE::EntityName.new( :text(.key) ), .value.as_ast()], 
    939941        } ]) ); 
    940942} 
     
    10291031 
    10301032Specifically, this file represents the core system-defined data types that 
    1031 all Muldis D implementations must have, namely: Bool, Text, Blob, Int, Num, 
    1032 Tuple, Relation, and the Cat.* types. 
     1033all Muldis D implementations must have, namely: Bool, Order, Int, Num, 
     1034Text, Blob, Tuple, Relation, and the Cat.* types. 
    10331035 
    10341036By contrast, the optional data types are given physical representations by