- Timestamp:
- 09/22/07 09:55:46 (16 months ago)
- Location:
- ext/Muldis-DB
- Files:
-
- 3 modified
-
Changes (modified) (2 diffs)
-
lib/Muldis/DB/Engine/Example/Operators.pm (modified) (7 diffs)
-
lib/Muldis/DB/Engine/Example/PhysType.pm (modified) (26 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ext/Muldis-DB/Changes
r18091 r18093 10 10 which sets its own less frequent release schedule. The rest of this 11 11 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. 12 21 13 22 * Removed the file Literal.pm; Muldis DB now uses Perl Hosted Abstract … … 74 83 75 84 * (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. 77 100 78 101 * (SeeAlso.pod) Updated the PROSPECTIVE MULDIS DB EXTENSIONS section -
ext/Muldis-DB/lib/Muldis/DB/Engine/Example/Operators.pm
r18088 r18093 15 15 ########################################################################### 16 16 17 ## sys. type.Bool ##17 ## sys.Core.Universal.Universal ## 18 18 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!) { 26 20 my ($v1, $v2) = $ro_args<v1 v2>; 27 21 return ptBool( :v($v1.equal( $v2 )) ); 28 22 }, 29 23 30 'sys. rtn.Int.not_equal' => sub ($dbms!, Hash $ro_args!) {24 'sys.Core.Universal.is_not_equal' => sub ($dbms!, Hash $ro_args!) { 31 25 my ($v1, $v2) = $ro_args<v1 v2>; 32 26 return ptBool( :v(!$v1.equal( $v2 )) ); 33 27 }, 34 28 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!) { 36 31 my ($target) = $upd_args<target>; 37 32 my ($v) = $ro_args<v>; … … 40 35 }, 41 36 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!) { 43 46 my ($addends) = $ro_args<addends>; 44 47 my Int $sum = 0; … … 49 52 }, 50 53 51 'sys. rtn.Int.difference' => sub ($dbms!, Hash $ro_args!) {54 'sys.Core.Int.difference' => sub ($dbms!, Hash $ro_args!) { 52 55 my ($minuend, $subtrahend) = $ro_args<minuend subtrahend>; 53 56 return ptInt( :v($minuend.v() - $subtrahend.v()) ); 54 57 }, 55 58 56 'sys. rtn.Int.product' => sub ($dbms!, Hash $ro_args!) {59 'sys.Core.Int.product' => sub ($dbms!, Hash $ro_args!) { 57 60 my ($factors) = $ro_args<factors>; 58 61 my Int $product = 1; … … 63 66 }, 64 67 65 'sys. rtn.Int.quotient' => sub ($dbms!, Hash $ro_args!) {68 'sys.Core.Int.quotient' => sub ($dbms!, Hash $ro_args!) { 66 69 my ($dividend, $divisor) = $ro_args<dividend divisor>; 67 70 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.} 69 72 if $divisor_v === 0; 70 73 # return ptInt( :v(floor ($dividend.v() div $divisor_v)) ); … … 72 75 }, 73 76 74 'sys. rtn.Int.remainder' => sub ($dbms!, Hash $ro_args!) {77 'sys.Core.Int.remainder' => sub ($dbms!, Hash $ro_args!) { 75 78 my ($dividend, $divisor) = $ro_args<dividend divisor>; 76 79 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.} 78 81 if $divisor_v === 0; 79 82 # return ptInt( :v($dividend.v() mod $divisor_v) ); … … 81 84 }, 82 85 83 'sys. rtn.Int.abs' => sub ($dbms!, Hash $ro_args!) {86 'sys.Core.Int.abs' => sub ($dbms!, Hash $ro_args!) { 84 87 my ($v) = $ro_args<v>; 85 88 return ptInt( :v(abs $v.v()) ); 86 89 }, 87 90 88 'sys. rtn.Int.power' => sub ($dbms!, Hash $ro_args!) {91 'sys.Core.Int.power' => sub ($dbms!, Hash $ro_args!) { 89 92 my ($radix, $exponent) = $ro_args<radix exponent>; 90 93 return ptInt( :v($radix.v() ** $exponent.v()) ); 91 94 }, 92 95 93 ## sys. type.Blob##96 ## sys.Core.Num.Num ## 94 97 95 98 96 ## sys. type.Text##99 ## sys.Core.Blob.Blob ## 97 100 98 101 99 ## sys. type.Tuple##102 ## sys.Core.Text.Text ## 100 103 101 104 102 ## sys.type.Relation ## 105 ## sys.Core.Tuple.Tuple ## 106 107 108 ## sys.Core.Relation.Relation ## 103 109 104 110 … … 142 148 all Muldis D implementations must have, which is the selectors for and 143 149 general purpose functions and update operators for these data types: Bool, 144 Text, Blob, Int, Num, Tuple, Relation, and the Cat.* types.150 Order, Int, Num, Text, Blob, Tuple, Relation, and the Cat.* types. 145 151 146 152 By contrast, the operators specific to the optional data types are -
ext/Muldis-DB/lib/Muldis/DB/Engine/Example/PhysType.pm
r18088 r18093 217 217 218 218 method root_type of Str () { 219 return 'sys. type.Bool';219 return 'sys.Core.Bool.Bool'; 220 220 } 221 221 … … 223 223 if (!$!which.defined) { 224 224 my Str $s = ~$!v; 225 $!which = "1 3 sys.type.Bool {$s.graphs} $s";225 $!which = "18 sys.Core.Bool.Bool {$s.graphs} $s"; 226 226 } 227 227 return $!which; … … 230 230 ########################################################################### 231 231 232 method as_ast of Muldis::DB::L iteral::Bool () {233 return ::Muldis::DB::L iteral::Bool.new( :v($!v) );232 method as_ast of Muldis::DB::LOSE::Bool () { 233 return ::Muldis::DB::LOSE::Bool.new( :v($!v) ); 234 234 } 235 235 … … 270 270 271 271 method root_type of Str () { 272 return 'sys. type.Order';272 return 'sys.Core.Order.Order'; 273 273 } 274 274 … … 276 276 if (!$!which.defined) { 277 277 my Str $s = ~$!v; 278 $!which = " 14 sys.type.Order {$s.graphs} $s";278 $!which = "20 sys.Core.Order.Order {$s.graphs} $s"; 279 279 } 280 280 return $!which; … … 283 283 ########################################################################### 284 284 285 method as_ast of Muldis::DB::L iteral::Order () {286 return ::Muldis::DB::L iteral::Order.new( :v($!v) );285 method as_ast of Muldis::DB::LOSE::Order () { 286 return ::Muldis::DB::LOSE::Order.new( :v($!v) ); 287 287 } 288 288 … … 323 323 324 324 method root_type of Str () { 325 return 'sys. type.Int';325 return 'sys.Core.Int.Int'; 326 326 } 327 327 … … 329 329 if (!$!which.defined) { 330 330 my Str $s = ~$!v; 331 $!which = "1 2 sys.type.Int {$s.graphs} $s";331 $!which = "16 sys.Core.Int.Int {$s.graphs} $s"; 332 332 } 333 333 return $!which; … … 336 336 ########################################################################### 337 337 338 method as_ast of Muldis::DB::L iteral::Int () {339 return ::Muldis::DB::L iteral::Int.new( :v($!v) );338 method as_ast of Muldis::DB::LOSE::Int () { 339 return ::Muldis::DB::LOSE::Int.new( :v($!v) ); 340 340 } 341 341 … … 376 376 377 377 method root_type of Str () { 378 return 'sys. type.Blob';378 return 'sys.Core.Blob.Blob'; 379 379 } 380 380 … … 382 382 if (!$!which.defined) { 383 383 my Str $s = ~$!v; 384 $!which = "1 3 sys.type.Blob {$s.graphs} $s";384 $!which = "18 sys.Core.Blob.Blob {$s.graphs} $s"; 385 385 } 386 386 return $!which; … … 389 389 ########################################################################### 390 390 391 method as_ast of Muldis::DB::L iteral::Blob () {392 return ::Muldis::DB::L iteral::Blob.new( :v($!v) );391 method as_ast of Muldis::DB::LOSE::Blob () { 392 return ::Muldis::DB::LOSE::Blob.new( :v($!v) ); 393 393 } 394 394 … … 429 429 430 430 method root_type of Str () { 431 return 'sys. type.Text';431 return 'sys.Core.Text.Text'; 432 432 } 433 433 … … 435 435 if (!$!which.defined) { 436 436 my Str $s = $!v; 437 $!which = "1 3 sys.type.Text {$s.graphs} $s";437 $!which = "18 sys.Core.Text.Text {$s.graphs} $s"; 438 438 } 439 439 return $!which; … … 442 442 ########################################################################### 443 443 444 method as_ast of Muldis::DB::L iteral::Text () {445 return ::Muldis::DB::L iteral::Text.new( :v($!v) );444 method as_ast of Muldis::DB::LOSE::Text () { 445 return ::Muldis::DB::LOSE::Text.new( :v($!v) ); 446 446 } 447 447 … … 486 486 487 487 method 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"; 489 490 } 490 491 491 492 method which of Str () { 492 493 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"; 495 496 my Str $tpwl = $root_type.graphs ~ q{ } ~ $root_type; 496 497 my Str $s = "H {$!heading.which()} B {$!body.which()}"; … … 502 503 ########################################################################### 503 504 504 method as_ast of Muldis::DB::L iteral::_Tuple () {505 method as_ast of Muldis::DB::LOSE::_Tuple () { 505 506 my $call_args = \( :heading($!heading.as_ast()), 506 507 :body($!body.as_ast()) ); 507 508 return self._allows_quasi() 508 ?? ::Muldis::DB::L iteral::QuasiTuple.new.callwith( |$call_args )509 !! ::Muldis::DB::L iteral::Tuple.new.callwith( |$call_args );509 ?? ::Muldis::DB::LOSE::QuasiTuple.new.callwith( |$call_args ) 510 !! ::Muldis::DB::LOSE::Tuple.new.callwith( |$call_args ); 510 511 } 511 512 … … 599 600 600 601 method root_type of Str () { 601 return602 'sys.type.' ~ (self._allows_quasi() ?? 'Quasi' !! '') ~ 'Relation';602 my $unqltp = ($self->_allows_quasi() ?? 'Quasi' !! '') ~ 'Relation'; 603 return "sys.Core.$unqltp.$unqltp"; 603 604 } 604 605 605 606 method which of Str () { 606 607 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"; 609 611 my Str $tpwl = $root_type.graphs ~ q{ } ~ $root_type; 610 612 my Str $s = "H {$!heading.which()} B " … … 617 619 ########################################################################### 618 620 619 method as_ast of Muldis::DB::L iteral::_Relation () {621 method as_ast of Muldis::DB::LOSE::_Relation () { 620 622 my $call_args = \( :heading($!heading.as_ast()), 621 623 :body([$!body.map:{ .as_ast() }]) ); 622 624 return self._allows_quasi() 623 ?? ::Muldis::DB::L iteral::QuasiRelation.new.callwith( |$call_args )624 !! ::Muldis::DB::L iteral::Relation.new.callwith( |$call_args );625 ?? ::Muldis::DB::LOSE::QuasiRelation.new.callwith( |$call_args ) 626 !! ::Muldis::DB::LOSE::Relation.new.callwith( |$call_args ); 625 627 } 626 628 … … 720 722 721 723 method root_type of Str () { 722 return 'sys. type._TypeInvo' ~ (self._allows_quasi() ?? 'AQ' !! 'NQ');724 return 'sys.LOSE._TypeInvo' ~ (self._allows_quasi() ?? 'AQ' !! 'NQ'); 723 725 } 724 726 725 727 method which of Str () { 726 728 if (!$!which.defined) { 727 my Str $tpwl = '20 sys. type._TypeInvo'729 my Str $tpwl = '20 sys.LOSE._TypeInvo' 728 730 ~ (self._allows_quasi() ?? 'AQ' !! 'NQ'); 729 731 my Str $sk = $!kind.graphs ~ q{ } ~ $!kind; … … 738 740 ########################################################################### 739 741 740 method as_ast of Muldis::DB::L iteral::_TypeInvo () {742 method as_ast of Muldis::DB::LOSE::_TypeInvo () { 741 743 my $call_args = \( :kind($!kind), 742 744 :spec($!kind === 'Any' ?? $!spec 743 !! $!kind === 'Scalar' ?? ::Muldis::DB::L iteral::EntityName.new( :text($!spec) )745 !! $!kind === 'Scalar' ?? ::Muldis::DB::LOSE::EntityName.new( :text($!spec) ) 744 746 !! $!spec.as_ast()) ); 745 747 return self._allows_quasi() 746 ?? ::Muldis::DB::L iteral::QuasiTypeInvo.new.callwith( |$call_args )747 !! ::Muldis::DB::L iteral::TypeInvo.new.callwith( |$call_args );748 ?? ::Muldis::DB::LOSE::QuasiTypeInvo.new.callwith( |$call_args ) 749 !! ::Muldis::DB::LOSE::TypeInvo.new.callwith( |$call_args ); 748 750 } 749 751 … … 812 814 813 815 method root_type of Str () { 814 return 'sys. type._TypeDict' ~ (self._allows_quasi() ?? 'AQ' !! 'NQ');816 return 'sys.LOSE._TypeDict' ~ (self._allows_quasi() ?? 'AQ' !! 'NQ'); 815 817 } 816 818 817 819 method which of Str () { 818 820 if (!$!which.defined) { 819 my Str $tpwl = '20 sys. type._TypeDict'821 my Str $tpwl = '20 sys.LOSE._TypeDict' 820 822 ~ (self._allows_quasi() ?? 'AQ' !! 'NQ'); 821 823 my Str $s = $!map.pairs.sort.map:{ … … 829 831 ########################################################################### 830 832 831 method as_ast of Muldis::DB::L iteral::_TypeDict () {833 method as_ast of Muldis::DB::LOSE::_TypeDict () { 832 834 my $call_args = \( :map([ $!map.pairs.map:{ 833 [::Muldis::DB::L iteral::EntityName.new( :text(.key) ), .value.as_ast()],835 [::Muldis::DB::LOSE::EntityName.new( :text(.key) ), .value.as_ast()], 834 836 } ]) ); 835 837 return self._allows_quasi() 836 ?? ::Muldis::DB::L iteral::QuasiTypeDict.new.callwith( |$call_args )837 !! ::Muldis::DB::L iteral::TypeDict.new.callwith( |$call_args );838 ?? ::Muldis::DB::LOSE::QuasiTypeDict.new.callwith( |$call_args ) 839 !! ::Muldis::DB::LOSE::TypeDict.new.callwith( |$call_args ); 838 840 } 839 841 … … 917 919 918 920 method root_type of Str () { 919 return 'sys. type._ValueDict' ~ (self._allows_quasi() ?? 'AQ' !! 'NQ');921 return 'sys.LOSE._ValueDict' ~ (self._allows_quasi() ?? 'AQ' !! 'NQ'); 920 922 } 921 923 922 924 method which of Str () { 923 925 if (!$!which.defined) { 924 my Str $tpwl = '20 sys. type._ValueDict'926 my Str $tpwl = '20 sys.LOSE._ValueDict' 925 927 ~ (self._allows_quasi() ?? 'AQ' !! 'NQ'); 926 928 my Str $s = $!map.pairs.sort.map:{ … … 934 936 ########################################################################### 935 937 936 method as_ast of Muldis::DB::L iteral::_ExprDict () {937 return ::Muldis::DB::L iteral::_ExprDict.new( :map([ $!map.pairs.map:{938 [::Muldis::DB::L iteral::EntityName.new( :text(.key) ), .value.as_ast()],938 method 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()], 939 941 } ]) ); 940 942 } … … 1029 1031 1030 1032 Specifically, this file represents the core system-defined data types that 1031 all Muldis D implementations must have, namely: Bool, Text, Blob, Int, Num,1032 T uple, Relation, and the Cat.* types.1033 all Muldis D implementations must have, namely: Bool, Order, Int, Num, 1034 Text, Blob, Tuple, Relation, and the Cat.* types. 1033 1035 1034 1036 By contrast, the optional data types are given physical representations by
