<<

Index

! (cut)operation (in ), 662, < (strictlyless) comparison, 55, 830 666, 669 <= (optional method argument) oper- ! (escaped variable marker), 500, 509 ator, 500 !! (read-only) operation, 206, 799 > (strictly greater) comparison, 55 " (double quote), 53, 821 >= (greater or equal) comparison, 55 $ (nesting marker), 53, 83, 355, 365 \ (backslash), 821 ´ (single quote), 35, 52, 821, 824 \ (backslash) notation (in Haskell), ’ (single quote) operation (in Lisp), 311 39 \= (inequality) comparison, 55 * (multiplication) operation, 54, 821 \=: (inequality) constraint, 756 */ (comment end), 841 ˜ (tilde) minus sign, 820 + (addition) operation, 54, 821 ` (backquote), 50, 821, 841 - (subtraction) operation, 54, 821 ‘ (backquote) operation (in Lisp), 39 . (field selector) operation, 54, 826 | (list pairing) constructor, 52 .:= (dictionary/array assignment) Abelson, Harold, 42 statement, 436, 437, 838 absolute error, 120 .:= (dictionary/array exchange) ex- abstract data type (ADT), 195–210, pression, 838 419 / (floating ) operation, 54, abstract machine, 41, 56–78, 92–94, 821 239–241, 282–283, 348–349, /* (comment start), 841 416–417 :: (membership) constraint, 751 relation to semantic rules, 786 := (state assignment) statement, 494, substitution-based, 126–127 497 abstract syntax tree, 163 := (state exchange) expression, 497 abstraction, xviii, see control abstrac- = (binding) operation, 44, 45, 47, 99 tion, see data abstraction =: (equality) constraint, 751 active object, 556 =<: (less or equal) constraint, 753 class, 492 == (equality) comparison, 55 collection, 435 =< (less or equal) comparison, 55 collector, 189, 325, 435, 484 ? (output argument), 57, 841 connector, 326 @ (state access) operation, 494, 497 database, 654 # (tupling) constructor, 140, 826, 831 encapsulated search, 625 % (comment to end of line), 841 hierarchy in object-oriented pro- % () operation (in Java), 617 gramming, 546 & (inlinecharacter) operator, 820 iteration, 122 864 Index

life cycle, 40 IP, 207 Linda (tuple space), 586 URL, 211 linguistic, see linguistic abstrac- adjacency list, 464 tion Adjoin operation, 161, 437, 438, 533, list comprehension, 301 550, 695, 826 lock, 582, 598 AdjoinAt operation, 378, 437, 438, loop, 181, 258 826 mailbox, 391 adjunction (environment), 62 monitor, 592 ADT (abstract data type), 420 pipe of stream objects, 561 advanced exercise, xxiv port object, 350 adversary, 208 procedural, 178 agent, 350 protector, 325 concurrent component, 362 replicator, 326 message-passing approach, 576 software component, 220 Alarm operation, 304, 393 specialization hierarchy, xviii alarm clock, xv stream object, 265 algebra, xxiii, 113 termination detection, 382 algorithm transaction, 600 breadth-first traversal, 156 tuple space, 586 compression, 177 access (cell operation), 17, 414 concurrent composition, 276 ACCLAIM project, xxvi copying dual-space garbage col- accumulator, 138–141 lection, 78 breadth-first traversal, 156 Dekker’s algorithm for mutual declarative state, 408 exclusion, 570 depth-first traversal, 155 depth-first traversal, 155 for loop, 189 distributed, see distributed algo- limit of declarative model, 315 rithm loop abstraction, 185, 258 elevator, 376 parser, 161 Flavius Josephus problem, 558 Prolog, 140 Floyd-Warshall, 470 relation to difference lists, 142 garbage collection, 76 relation to fold operation, 185 Hamming problem, 293 tree traversal, 192 linear congruential generator, ACID properties, 600 474 action (in GUI), 683 mergesort, 137, 166 active memory, 74 mergesort (generic), 181 size, 172, 314 Newton’s method for square roots, ActiveX, 462 119 actor model, 345 nonalgorithmic programming, 622 adder parallel transitive closure, 469 n-bit, 341 Pascal’s triangle, 10 full, 268 queue, 145 address persistent, 297 Index 865

priority, 614 array, 436 quicksort, 232, 524 extensible, 440 random number generation, 472 usage trade-offs, 438 simulation, 476 ASCII (American Standard Code for termination detection, 382 Information Interchange), thread scheduling, 240 219, 458, 459, 715 transaction manager, 605 Ask operation, 768 transitive closure, 464 ask operation, 782, 790 tree, 151 assert/1 operation (in Prolog), 656, tree-drawing, 158, 273 662 unification, 101 assertion, 444 word frequency, 198 assignment alias (in QTk), 680 axiomatic semantics, 446 aliasing, 418, 449 cell operation, 17, 414 allocation, 75 in-place, 314 always true (in temporal logic), 603 Java, 552 Anderson, Ross J., 744, 843 monotonic, 849 Andrews, Gregory, 582 multiple, 849 andthen operator, 83 single, 42, 849 Append operation, 829 to iteration variable, 189 apple, 489 association, 531 Apple Corporation, xxvi association list, 486 applet, 718 asynchronous communication, 332 application active object, 558 FlexClock example, 698 component interaction, 456 ping-pong example, 305 distributed object, 726 standalone, 222 distributed port, 713 Java, 555 distributed semantics, 383 video display, 321 Erlang, 386 applicative order reduction, 330 error reporting, 359 arbitrary precision , 3 failure detection, 739 arbitrary precision arithmetic, GUI, 685 821 message passing, 345 arch, xviii port, 347 arithmetic, 54 receive, 332 Arity operation, 54, 826 relation with dataflow, 726 arity, 826 RMI, 356 case semantics, 67 send, 332, 719 method head, 499 slow network, 578 Prolog, 661 trade-off with fault detection, record memory consumption, 174 745 record performance, 438 ATM(Asynchronous Transfer Mode), Armstrong, Joe, 582 387 Arnold, Ken, 537 atom, 52, 824 866 Index

defining scope, 508 blank space (in Oz), 841 predicate calculus, 633 Blasband, Darius, 642 propositional logic, 632 block atomic action, 579–615 file, 292 approaches to concurrency, 573 imperative language, 486 reasoning, 581 memory, 74, 76 when to use, 576 , 543 atomicity, 21, 600 blocking operation, 239 AtomToString operation, 824 blue cut (in Prolog), 666, 668 attribute book final(in Java), 544, 551 Component Software: Beyond initialization, 498 Object-Oriented Program- object, 497 ming, 462 availability, 711 Concurrent Programming in Er- AXD 301 ATM switch, 387 lang, 582 axiom Concurrent Programming in Java, axiomatic semantics, 441 581 Horn clause (Prolog), 635 Concurrent Programming: Prin- logic programming, 406, 634 ciples and Practice, 582 predicate calculus, 633 Object-Oriented Software Con- axiomatic semantics, 38, 440–450, struction, 491 632 Software Fundamentals, 462 Structure and Interpretation of Backus, John, 32 Computer Programs,xix backward chaining, 662 The Art of Prolog, 666 bagof/3 operation (in Prolog), 626, The Mythical Man-Month, 462 670 Transaction Processing: Concepts Bal, Henri E., 334 and Techniques, 582 constraint, 759 boolean, 52 batching Borges, Jorge Luis, 621, 707 distributed stream, 719, 724 bottom-up software development, 451 object invocations, 540, 565 bound identifier occurrence, 64 Baum, L. Frank, 1 bounded buffer, 263 Bernstein, Philip A., 600 data-driven concurrent version, billion dollar budget, 521 263 binary integer, 819 lazy version, 290 binding monitor version, 593 basic and nonbasic, 788 brand, 498 dynamic, 506 Brand, Per, xxvi static, 506 breadth-first traversal, 156 variable, 787 break (in for loop), 190 variable-variable, 47 break statement, 486 binomial theorem, 4 bridge building, xvi, xvii bistable circuit (digital logic), 270 Brinch Hansen, Per, 592 Index 867

Brooks, Jr., Frederick P., 462 forward, 674 Browser tool, see Mozart Program- channel ming System asynchronous, 348, 385 bundling, 420 component interface, 456 by-need execution, 281–284, 795 dataflow variable, 332 Multilisp, 337 many-shot, 363 Oz 3, 809 one-shot, 363, 368 WaitNeeded operation, 795 port, 347 WaitQuiet operation, 798 synchronous, 619 ByNeed operation, 282 character, 820 definition using WaitNeeded, 795 alphanumeric, 50, 841 byte (in Java), 553 Java, 553 bytestring, 831 China, 707 choice statement, 623, 772 calculator, 1 choice point, 623, 767 calculus binary, 654, 762 analysis, 170 constraint programming, 755 first-order predicate, 633 dynamic, 654 foundational, xvii implementation, 772 λ, xvii, 41, 97, 331, 344, 792, 805, memory leak, 668 811, 846 Choose operation, 654, 767 π, xvii, 41, 54, 805 chunk, 828 calendar widget, 691–693 use in object reflection, 517 call/1 operation (in Prolog), 661, Church-Rosser theorem, 331 662 Churchill, Winston, 450 call by ..., see parameter passing Clarke, Arthur . call graph, 318 second law, 104 capability, 208 third law, 314 declarative, 210 class, 413, 491, 496, 546 method label, 510 abstract, 523, 546 revocable, 434, 483 active object, 558 Cardelli, Luca, 722 common limitations, 539 cascading abort, 604 complete definition, 492 case statement, 67, 790 concrete, 523, 525, 546 catch clause (in try), 94 delegation, 511 causality diagram, 528, 534 concurrency, 238 encapsulation control, 506 message-passing events, 353 event manager example, 563 Ceil operation, 822 final, 492, 497, 543 cell (explicit state), 409, 414–417, forwarding, 511 794, 848 generic, 524 cellular phone, xv, xviii higher-order programming, 525 chaining implementation, 548 backward, 662 incremental definition, 502 868 Index

inheritance, 502 comics, 482 inner(in Java), 540, 552 comment (in Oz), 841 introduction, 18 Commit operation, 769 member, 497 common self, 511 metaclass, 547 compaction, 76 mixin, 566 comparison, 55 parameterized, 524 compilation patching, 521 separate, 105 programming techniques, 518 standalone, 228 reflection of object state, 517 ping-pong example, 305 structure view, 519 unit, 221, 412, 454, 816 substitution property, 518, 521, compiler, 162, 661 523 extensible, 542 type view, 519 Prolog, 664 clause smart-aleck, 314 case statement, 82 unification operation, 99 definite, 650 Compiler Panel tool, see Mozart Pro- Erlang, 388 gramming System Horn, xxi, 635, 640, 650, 663 compiler window (in OPI), 815 clock complete list, 53, 829 context-sensitive, 698 complete value, 46 digital circuit, 271 completeness digital logic, 267 software development, 219 synchronization, 308 theorem prover, 634 clone Turing, 846 array, 436 complexity computation space, 769 amortized, 146, 174, 437 dictionary, 437 asymptotic, 167 object, 517 banker’s method, 175 Clone operation, 769 big-oh notation, 167 closed distribution, 732 introduction, 10–11 closure, see procedure value physicist’s method, 175 cluster, 711 space, 172 code generator, 162 time, 11, 166 coherence worst-case, 167, 172 between graphical views, 696 component, 112, 183, 220 cache, 460, 733 abstraction, 458 network transparency, 720 avoiding dependencies, 459 collector, 189, 325, 435, 484 diagram, 351 COM (Component Object Model), encapsulates a design decision, 462 458 combinational logic, 267 functor, 412 combinations, 4 further reading, 462 combinator, 278 future role, 461 Index 869

graph, 461 lazy concurrent, 235, 281 implementation, 221 maximally concurrent, 577, 618, interface, 221 766 module, 412 constraint programming, 766 software, 221 message-passing concurrent, 347 compositionality, 411, 620 nondeterministic concurrent, 394, class, 501 641 encapsulated search, 626 object-based, 538 exception handling, 90 order-determining concurrent, 273 Solve operation, 626 relational, 623 compound secure declarative, 203 ADT, 435 shared-state concurrent, 573 component, 363 stateful concurrent, 569, 575, data structure, 19, 52 576, 807 graphic figure, 535 stateful, 413 nonterminal, 645 strict functional, 97 statement, 117 atomic action, 579 statement (in Java), 552 closed, 326 value, 43 concurrent constraint, 808 computation, 61 concurrent logic programming, blocked, 241 287, 394, 811 iterative, 118 design principles, xix, 843 recursive, 124 determinate concurrent constraint secure, 208 programming, 338 terminated, 241 determinate parallel program- computation model, xiii, 29 ming, 337 active object, 556 deterministic logic programming, constraint-based, 627, 641, 758 635 data-driven concurrent, 235 Erlang, 386 declarative concurrent with ex- Haskell, 309 ceptions, 326 insecure, 325 declarative concurrent, 235 Java, 551, 615 declarative with exceptions, 92 nondeterministic logic program- declarative, 49 ming, 638 demand-driven concurrent with open, 326 exceptions, 328 partial failure, 326, 739 demand-driven concurrent, 235, Prolog, 662 281 secure, 325 descriptive declarative, 115 semantics, 779 distributed, 712 using models together, xx, 324 graph notation, 735 computation space, 654, 753, 761 extended relational, 660 blocked, 767 general, 782, 843 clone, 769 job-based concurrent, 618 distributable, 768 870 Index

failed, 768 cons cell (list pair), 5, 52, 828 merged, 768 consistency (in transaction), 600 runnable, 767 consistency protocol, 712 stable, 755, 766, 768 constraint, 244 succeeded, 768 absolute distance, 774 suspended, 768 basic, 759 computer engineering, xxi equality, 751 computer science, xxi finite domain, 760 , see informatics inequality, 756 conc statement, 278 less or equal, 753 concurrency, 322 membership, 751 competitive, 254 pairwise distinctness, 756 cooperative, 254 rational tree, 760 dataflow, 15 scalar product, 775 declarative, 233, 242, 804 tree-drawing, 158 difference with parallelism, 322 constraint programming, 44, 274, 663 Erlang, 386 computation space, 627 further reading, 581 partial information, 751 importance for programming, xvi threads, 254, 577 interactive interface, 89 constructor, 554 interleaving, 21 consumer, 257 introduction, 14 content edge, 733 Java, 615 context, 91 monitor safety, 593 context-sensitive nondeterminism, 20 grammar, 33 order-determining, 273 GUI design, 698 practical approaches, 573 continuation, 378 queue, 583 procedure, 359 rules of thumb, 576 record, 358 teaching, xxii continue (in for loop), 190 transaction, 602 contract, 410, 520 concurrency control, 567, 602, 746 contrapositive law, 632 concurrency-oriented programming control abstraction (COP), xvi, xxii, 573 break, 486 concurrent composition, 276, 385 concurrent composition, 278 condition variable, 599 CSP communication, 619 conditional critical section, 595 Erlang mailbox, 402 configuration, 784 higher-order programming, 177 confinement iteration, 122 failure in declarative model, 245 loops, 184 partial failure, 709 need for higher-order, 180 transaction, 601 Smalltalk block, 543 confluence, 331, 806 try–finally, 343 connector, 326 convolution (symbolic), 232 Index 871

coordination model, 456, 586 infinite, 11 CORBA (Common Object Request list, 52, 129 Broker Architecture), 356, long-lived, 78 462 partial, 46 coroutine, 274, 456 persistent, 297 relation to laziness, 285, 287, 574 protected, 203, 421 correctness, 410, 520, 632 queue, 145 introduction, 9–10 record, 52 Cray-1 computer, 175 recursive, 130 critical region, 582 size, 173 cryptarithmetic, 755, 776 stack, 195 cryptography store, 75 unique name generation, 207 tree, 150 CSP (Communicating Sequential Pro- tuple, 52 cesses), 619 data type, see type curriculum (informatics), xxii data-driven execution, see eager exe- currying, xxi, 194, 232 cution Haskell, 311 database, 654 cyclic structures, 102 deductive, 655 distributed, 615 dangling reference, 65, 75, 180, 459, in-memory, 173 552 Mnesia (in Erlang), 387 Danvy, Olivier, 232 persistence, 654 Darwin, Charles, 451 query, 655 data abstraction, 18, 419–435 relational, 655 abstract data type (ADT), 195– 210 shared-state concurrency, 576 concurrent, 578 transaction, 600 object, 420 update, 655 object-oriented programming (OOP), dataflow, 60 489 channel, 332 procedural (PDA), 420 declarative model, 16 data structure error, 89 active, 77 examples, 248 class, 496 I-structure, 337 compound, 19, 52 introduction, 15 cyclic, 101 lazy execution, 285 dictionary, 196 parallel transitive closure, 469 difference list, 141 rubber band, 251 difference structure, 141 variable, 42, 47, 48 ephemeral, 146 Date, C.J., 655 external, 77 Dawkins, Richard, 410 graph, 464 DBMS (Database Management Sys- higher order, 183 tem), 655 872 Index

DCOM (Distributed Component Ob- inheritance, 413 ject Model), 462 order-determining concurrency, deadlock, 605 273 avoidance, 605 removal of sequential, 385 callback, 357 sequential model, 411 concurrency control, 605 word frequency application, 225 detection, 605 depth-first traversal, 155 digital logic simulation, 270 dereferencing, 45 lazy execution, 287 design by contract, 521 prevention, 605 design methodology resolution, 605 compositional, 461 deallocation, 75 concurrent program, 364 debugging, 516 language, 40, 329, 543, 811, 850 dangling reference, 75, 180 large program, 450 declarative component, 313 noncompositional, 461 distributed application, 745 small program, 218 erroneous suspension, 48, 90 design patterns, xxi, 413, 489, 534– inspecting object attributes, 501 537 declarative, 111, 406 Composite pattern, 535 declarative concurrency, see concur- declarative concurrency, 365 rency, declarative destructive assignment, see state declarative program, 244 determinism (declarative program- declare statement, 2, 87 ming), 111 syntax convention of book, xxix, DHCP (Dynamic Host Connection 87 Protocol), 207 define clause (in functor), 221 diagnostics, 621 Definite Clause Grammar (DCG), dialog model (in GUI), 695 140, 650 dictionary, 196, 437 Delay operation, 304 declarative, 196 delay gate (digital logic), 270 efficiency, 201 delay operation (in Multilisp), 337 internal structure, 201 delay point, 580 list-based implementation, 197 delegation, 512–515 relation implementation, 659 otherwise method, 501 relation to record, 438 Dell Corporation, xxvi, 201, 471 relation to stream, 440 demand-driven execution, see lazy ex- secure declarative, 207 ecution standalone, 225 De Morgan’s law, 632 stateful, 198 denotational semantics, 38 tree-based implementation, 198 dependency tuple space implementation, 588 component, 224 usage trade-offs, 439 dataflow, 335 word frequency implementation, declarative component, 313, 323 471 grammar context, 33 word-of-mouth simulation, 477 Index 873

difference list, 141 eager execution difference structure, 141 declarative model, 98 digital logic, 266 distributed producer/consumer, satisfiability problem, 176 719 Dijkstra, Edsger Wybe, 441 introduction, 11 directed graph, 463 producer/consumer stream, 257 disconnected operation, 741 relation to synchronization, 334 discriminant, 179 strictness, 331 disentailment, 103–104, 781 eager failure detection, 739 distributed algorithm EBNF (Extended Backus-Naur Form), cached state, 733 32, 650, 651, 671 garbage collection, 734 Eco, Umberto, 90 locking, 721 Einstein, Albert, 278 mobile state, 733 Elcock, E.W.,621 tokenpassing, 721 elephant, xiii unification, 733 elevator, see lift distributed lexical scoping, 722 Emacs text editor, 815 distributed system, 345, 707 embedding, 183 closed, 714, 732 emulator window (in OPI), 815 open, 508, 709, 711, 714 encapsulation, 18, 411 partial failure, 326 communication from inside en- port semantics, 384 capsulated search, 673 resource, 729 data abstraction, 420 Distribution Panel tool, see Mozart search, 625 Programming System Encyclopaedia Britannica (11th edi- distribution strategy, 755, 761, 766 tion), 489 div (integer division) operation, 54, Ende, Michael, 345 821 entailment, 99, 103–104, 781 divide-and-conquer, 137 Enterprise Java Beans, 461 domain (inconstraint programming), entry point (in block), 486 760 environment, 44, 61 domain model (in GUI), 695 adjunction, 62 domain of discourse, 633 calculating with, 62 dotted pair, 5, 828 contextual, 65 Duchier, Denys, xxvi, 382 interactive interface, 87 Dudeney, Henry Ernest, 774 restriction, 62 durability, 600 ephemeral data structure, 146, 297 dynamic equality binding, 506 structure, 103, 418, 723 linking, 222, 284 token, 418, 714, 723 record creation, 165, 549, 695 Ericsson (Telefonaktiebolaget LM Er- scope, see scope, dynamic icsson), 326, 386 typing, 104–106 Erlang, 386–394 Dynamic HTML, 682 error, 90 874 Index

absolute, 120 error, 96, 802 “arity mismatch”, 500 failure, 96, 801 asynchronous reporting, 359 system,96 compile-time detection, 105 uncaught, 93, 801 concurrent programming, 21 Exchange operation, 416 confinement, 90 exchange operation dangling reference, 75 on cells, 416 domain, 96 on object attributes, 497 erroneous suspension, 48, 89, 449 exclusive-or operation, 14 if statement, 66 execution state, 61 incompatible binding, 44, 96 exit point (in block), 486 infinite loop, 449 explicit state, see state memory leak, 75 Explorer tool, see Mozart Program- memory reclaiming, 75 ming System Mozart run-time, 815 exponential distribution, 475 procedure application, 67 export clause (in functor), 221 relative, 120 expression, 81 run-time detection, 105, 503 andthen operator, 83 starvation, 275 basic operation, 54 type incorrect, 50, 96, 449, 450 basic value, 49 “uncaught exception”, 93, 801 ill-formed, 92 unification failure, 96 λ notation, 97, 311 variable declaration, xxix nesting marker ($), 83 “variable not introduced”, 834 normal order reduction, 330 “variable used before binding”, orelse operator, 83 48 procedure value, 65 error logging, 563 receive (Erlang), 391 Escher, Maurits Cornelis, 679 external resource, 77 Euclid, 1 extreme programming, 452 event (in GUI), 682 event handler, 563 factorial function, 2–23, 124–127, 230, event manager 618 active objects, 563 fail statement, 623 adding functionality with inheri- FailedValue operation, 328 tance, 564 failure, 410 eventually true (in temporal logic), declarative concurrency, 245 603 detection, 709, 739 evolution exception, 96 Darwinian, 451, 462 failed value, 328 Internet, 412 finite, 662 software development, 451 heartbeat mechanism, 739 example programs (how to run), xxix negation as failure, 662 exception, 90–96, 543, 848 partial, 326 distribution fault, 743 software project, 521, 643 Index 875

transaction, 601 Flavius Josephus problem, 558–561 unification, 102 FlexClock utility, 698 fairness flip-flop, 270 stream merger, 398 floating point thread scheduling, 239, 240, 252, arithmetic, 821 333 number, 820 false, 824 FloatToInt operation, 822 fault, 601 Floor operation, 822 confinement, 202, 601, 709, 745 flow control, 98, 261 fault model, 739 lazy execution, 261 fault tolerance, 601 thread priority, 265 active, 743 Floyd, Robert W., 441, 621 Erlang, 387 fold operation, 185 lift control system, 377 FoldL, 187, 465, 829 FCFS (first-come, first-served), 366 FoldR, 187 FD.distance (propagator), 774 stream objects, 258 FD.distinct (propagator), 756, 774 for statement, 188 FD.distribute (distribution strat- for loop, 447 egy), 754, 766 ForAll operation, 829 FD.sumC (propagator), 775 formal language, 33 feature (record field name), 825 forward chaining, 674 feed a text (in OPI), 815 forwarding, 512 FGCS (Fifth Generation Computer foundational calculus, xvii System), Japanese project, framework 397 computation model, 844 Fibonacci function, 249 software reuse, 492 FIFO (first-in, first-out), 145, 232, France, 411 337, 366, 379, 456, 719, 724 free identifier occurrence, 58, 64, 633 Erlang, 386 free memory, 75 port, 347 freeze/2 operation (in Prolog), 662 file, 210 French, Michael, 569 Filter operation, 191, 829 fresh finalization, 78, 481 name, 203 lazy execution, 481 variable, 787 finally clause (in try), 94 full adder, 268 finite domain, 760 fun statement, 84 finite failure, 662 function, 84 finite state machine generating, 170 event manager, 563 incremental, 296 finite tree, 150 introduction, 2 firewall, 326 lazy, 797 first-argument indexing, 656 monolithic, 296 fixpoint, 766 monotonic, 849 Flatten operation, 143, 232, 296 partially applied, 194 876 Index

state transition, 351 G¨odel’s incompleteness theorem, 634 functional decomposition, 135, 542 G¨odel, Kurt, 634 functional look, 196 Goodman, Nathan, 600 functor, 221, 454 Gosling, James, 537 distributed resource, 709, 730 grammar, 31–36 interactive use, 816 ambiguous, 34, 166 main, 222 context-free, 33 Oz 3, 809 context-sensitive, 33 functor statement, 223 definite clause (DCG), 140, 650 future, 336 disambiguation, 34 future operation (in Multilisp), 336 EBNF (Extended Backus-Naur Form), 32, 671 Gamma, Erich, 534 left-recursive, 644 garbage collection, 74, 75 natural language, 643 copying dual-space, 78 nonterminal symbol, 32, 163 distributed, 734 terminal symbol, 32, 163 external references, 480 unification, 649–650 finalization, 481 graph generational, 78 bushy, 461 lease-based, 734, 738 component, 461 program pause, 76, 308 distribution model, 735 real-time, 76 Haskell expression, 310 root set, 76 hierarchical, 461 weighted reference counting, 734 implementation, 464 Gardner, Martin, 774 inheritance, 502 gate statement, 272 nonlocal, 461 gate (digital logic), 267 path, 463, 658 Gaussian distribution, 476, 477 small world, 461 Gelernter, David, 586 Gray,Jim, 582, 600 generalization, 568 green cut (in Prolog), 669 generate-and-test, 629, 758 Gregorian calendar, 693 generating function, 170 Grolaux, Donatien, 689, 691 genericity, 180–182 grue cut (in Prolog), 669 object-oriented programming, 524 guard static and dynamic, 526 ask operation, 782 global condition concurrent logic programming, ordered binary tree, 154 397 producer/consumer throughput, CSP, 619 261 Erlang, 388 reachability, 75 Haskell, 309 GlobalStore, 743 list comprehension, 302 glue (in GUI), 687 monitor, 595 Glynn, Kevin, 308 Prolog, 669 G¨odel’s completeness theorem, 634 quiet (in Prolog), 669 Index 877

receive expression (in Erlang), library operations, 830 391, 402 relation to OOP, 538 guarded method, 595 history guardian, 481 ADTlanguage, 420 GUI (Graphical User Interface) computer technology, 176 AWT(Abstract Window Toolkit) concurrent constraint program- package, 679 ming, 663, 808 component-based programming, dangers of concurrency, 21 461 declarative concurrency, 337 design, 679 functional programming, 96 Haskell fudgets, 679 incremental development, 451 model-based, 695 object-oriented programming, 489 Prototyper tool, 689 Oz, xxiv, 809 QTk, 213, 680, 729 programming languages, 406 interactive use, 214, 684 Prolog, 661 use in application, 225 remote invocation, 709 read-only view, 695 Hoare, Charles Antony Richard, 232, Swing components, xxi, 679 441, 592 text input/output, 213 Horn clause, xxi, 635, 640, 650, 663 Visual Studio, 679 hot spot, 177 HTML (Hypertext Markup Language), Hadzilacos, Vassos, 600 115, 679 haltingproblem, 209, 681 Hudak, Paul, 96, 314 Hamming problem, 293, 342 Hamming, Richard, 293 IBMCorporation, 41 handler IDE (Interactive Development Envi- event, 563 ronment), xxix exception, 90, 91 IDE (interactive development envi- finalization, 481 ronment), 815 GUIdesign, 213, 683, 682–688 identifier, 2, 44 HasFeature operation, 826 bound occurrence, 64 , 438, 439 escaped, 509 Haskell, 308–313 free occurrence, 58, 64, 633 Helm, Richard, 534 IEEE floating point standard, 544, Herbert, Frank, 749 820 heuristic if statement, 66, 790 best first, 672 IID(Iterative and Incremental) soft- distribution strategy, 755, 766 ware development, 451 Hewitt, Carl, 345 ILOG Solver, 663 hexadecimal integer, 820 impedance matching, 324 higher-order programming, 113, 177– concurrency, 576 194 event manager example, 567 introduction, 13 imperative, 406 iteration abstraction, 123 implementation, 410 878 Index

import clause (in functor), 221 event manager, 564 inactive memory, 75 factoring, 492 incompleteness, 634 generalization, 568 inconsistency, 787 graph, 502 incremental function, 295 implementation, 550 incremental software development, implementation-sharing problem, 451 533 independence Java, 551 components, 363, 455 multiple, 503, 527 compositional design, 461 rules of thumb, 533 concepts, xvii simple, 503 concurrency, 14, 20, 89, 233 single, 503, 531 declarative loop, 189 software reuse, 492 declarative programming, 111 static and dynamic binding, 504 Erlang processes, 386 structure view, 519 garbage collection, 76 thread priority, 253 message passing, 387 type view, 518 modularity, 319 upward, 568 multiple inheritance, 533 inherited argument, 161 open programming, 105, 326, 714 Inject operation, 772 polymorphism, 429 instantiation, 182–183, 411 principle, 457 integer put and get (in queue), 381 arbitrary precision, 3, 821 reasoning with invariant asser- arithmetic, 821 tions, 441 number, 819 search and distribution strate- tilde ˜ as minus sign, 820 gies, 761 interactive interface, 87 software deployment, 221 interactive system India, xiii GUI design, 213 infinite precision arithmetic, 3 Mozart IDE, 815 infinity (floating point), 822 pedagogical use, xix informatics, xxi reaction time guarantees, 174 curriculum, xxii interface, 419 success of object-oriented pro- general concept, 221 gramming, 489 inheritance, 492 usefulness of computation mod- Java, 551 els, xiv Runnable (in Java), 616 Information Cities project, 412 interface builder, 679 information systems, xxi interleaving semantics, 237, 780 inheritance, 19, 413, 420, 491 Internet, 207, 345, 353, 707, 711, 717 avoiding method conflicts, 511 simulation of Web use, 476 cautionary tale, 521 interoperability, 106 design patterns, 534 interpreter, 42 directed and acyclic, 503 approach to define semantics, 41 Index 879

generic parser, 650 Label operation, 54, 826 GUIdescription, 703 label(record identification), 19, 52 meta, 654, 676 λ calculus, xvii, 41, 97, 331, 344, 792, metacircular, 42 805, 811, 846 original Erlang, 388 LAN (local area network), 353, 717, Prolog arithmetic, 664 739 QTk module, 703 language intractable problems, 176 AKL, xxvi, 661, 809 IntToFloat operation, 822 Absys, 406, 621 invariant, 134, 382, 412, 441 Ada, 432, 619 IP (Internet Protocol), 206 Algol, 406, 432, 489 IsAtom operation, 824 declarative concurrent, 337 IsChar operation, 823 nondeterministic, 622 IsDet operation, 319, 321, 333, 394, Alice, 106 660, 803, 849 C++, 43, 48, 75, 180, 334, 445, IsFailed operation, 803 486, 489, 504, 508–510, 535, IsLock operation, 583 540, 545, 551, 663, 761 ISO 8859-1 character code, 820, 824 C-Linda, 586 isolation, 600 CLOS ( Object IsProcedure function, 55 System), 516 IsRecord operation, 826 CLU, 420 I-structure, 336, 469, 811 CSP(Communicating Sequential IsTuple operation, 827 Processes), 619 iterative software development, 451 Clean, 313 Cobol, 544 Janson, Sverker, xxvi, 663 Common Lisp, 59, 190 Japan, 397 Concurrent Haskell,xx Java, 551–556, 615–617 Concurrent ML, xx, 851 monitor semantics, 592 Concurrent Prolog, 397 JavaBeans, 462 C, 75, 179, 661 Jefferson, Thomas, 9 Eiffel, 519, 521, 850 Johnson, Ralph, 534 Erlang, 75, 98, 326, 345, 386–394, journaling, 532 429, 456, 545, 563, 582, 807, Kahn, Gilles, 337 851 kernel language, see computation E, 208 model FCP (Flat Concurrent Prolog), kernel language approach, xvi, 36–42 397, 807 choice of formalism, xix FP, 329 keywords (table of), 839 Flat GHC, 397 Knuth, Donald Ervin, 170, 472 , 406, 642 Kowalski, Robert A., 406 parsing problem, 642 Kurzweil, Raymond, 176 GHC (Guarded Horn Clauses), KWIC (keyword in context) index, 397 666 Haskell,xiv, xvi, 43, 75, 98, 116, 880 Index

137, 194, 272, 279, 286, 308– 98, 116, 137, 194, 286, 313, 313, 329, 331, 334, 337, 342, 330, 807 457, 545, 679, 807 , 461 IC-Prolog, 397 pH (parallel Haskell), 337, 811 Id, 337, 811 tcl/tk, 679, 680, 703 Java,xiv, xvi, 41, 43, 48, 75, 180, assembly, 209, 313, 406, 551, 622 334, 356, 428, 430, 445, 462, coordination, 586 486, 489, 504, 508–510, 535, first-order, 177 540, 543–545, 551–556, 567, formal, 33 581, 592, 615–617, 679, 807, higher-order, 177 850 multiparadigm, xvii monitor, 592 natural, xiii, 31, 38, 641 Leda, xvii nonstrict, 331 Linda extension, 586, 619, 808 popular computation models, 807 Lisp,xiv,5,39, 59, 75, 76, 129, practical, 31 406, 544, 650, 664, 828 secure, 208 ML, see Standard ML, Concur- specification, 116 rent ML, Objective Caml symbolic, 53, 545 Mercury,xiv, 116, 313, 663, 807 language design Miranda, 279, 342 abstraction life cycle, 40 Multilisp, 336, 811 declarative, 329 Objective Caml, 543 golden age, 406 Obliq, 722 layered, 850 Oz 1, Oz 2, Oz 3, 809 lazy execution, 329 Oz,xix, xxvi, 313, 507, 545, 663, object properties, 543 807, 844, 851 trade-offs, 811 PL/I, 642 Lao-tzu, 278 parsing problem, 642 last call optimization, 72 Parlog, 397 latch (digitallogic), 270 Pascal, 161, 179, 430, 807 late error detection (at run time), 503 Prolog,xiv,xvi, xxi, 5, 29, 48, 75, latency, 263 116, 140, 142, 272, 287, 329, tolerance, 335 A 334, 388, 397, 406, 545, 621– LTEX2ε typesetting system, 459 623, 635, 640, 642, 649, 654, Latin-1, 458 656–660, 660–671, 807, 851 law pure, 640 Clarke’s second, 104 SICStus, 190, 663 Clarke’s third, 314 Scheme,xiv, xvi, xvii, xx, 29, 43, contrapositive, 632 59, 97, 98, 286, 545, 807 De Morgan’s, 632 Simula, 406, 489 Moore’s, 176, 622 Smalltalk,xiv, 43, 75, 334, 489, stack ADT, 195 507, 509, 510, 516, 540, 543, layered language design, 850 544, 850 lazy evaluation, 98 Standard ML,xiv,xx, 29, 43, 97, coroutining, 574 Index 881

explicit, 183 booleans to streams, 271 Haskell, 310 serializability, 600 relation to call by need, 433, 485 synchronization, 358 relation to nonstrict evaluation, lightweight transaction, 601 331 Linda (tuple space), 586 schedule, 343 linguistic abstraction, 38–39, 124 strictness analysis, 289, 310, 342 case (pattern matching), 790 lazy execution, 278 class, 548 bounded buffer, 263 conc (concurrent composition), flow control, 261 278 Hamming problem, 293 delegation, 514 higher-order programming, 193 for loop, 188, 447 incremental, 295 fun (function), 84 introduction, 11 functor (software component), monolithic, 296, 342 223 needs finalization, 481 gate (logic gate), 271 relation to synchronization, 334 local vs. global translation, 844 lazy failure detection, 739 macro (in Lisp), 39 Lea, Doug, 581 monitor, 593 legal program, 31 parameter passing, 434 Length operation, 829 protected scope (Java), 567 lex/yacc parsing, 642 while loop, 447 lexical analyzer, 32 linking, 211, 222, 224, 229, 455, 817 lexical scope, see scope, lexical component, 223, 459 lexical syntax (of Oz), 839 dynamic, 284 lexically scoped closure, see proce- failure detection in Erlang, 387 dure value Linux operating system, xxvi, 201, lexicographic order (of atoms), 55, 471, 499 824 Liskov, Barbara, 420 Ley, Willy, 621 list, 52, 128, 828 library, 229 circular, 829 MOGUL (Mozart Global User complete, 53, 829 Library), 222 difference, 141 Mozart Base and System mod- advantage, 145 ules, 229 flattening, 143 Mozart Standard Library, 214, incomplete, 440 225, 685, 690 introduction, 4 universal, 621 nested, 135 life cycle partial, 440, 829 abstraction, 40 usage trade-offs, 439 memory block, 75 list comprehension, 301 LIFO (last-in, first-out), 491 list pair, 52, 828 lift control system, 365 literal, 824 lifting liveness, 602 882 Index

local statement, 56, 63, 786 Lisp, 39, 544 lock, 579, 582–583 loop (in Common Lisp), 190 distributed, 721 Maher, Michael, 662, 808 get-release, 598 mailbox, 456 implementation, 590 Erlang, 386 introduction, 21 implementation, 391 Java, 616 maintainability, 458 read, 620 inheritance, 492 simple, 591 polymorphism, 425 thread-reentrant, 591 MakeRecord operation, 165, 549, 695, transaction, 602 826 write, 620 MakeTuple operation, 373, 827 lock statement, 22, 583 Manchester Mark I, 36 locus of control, 274 Manna, Zohar, 441 logic many-to-one communication, 351 combinational, 267 Map operation, 190, 466, 829 gate, 267 Mariner I (software error), 643 predicate calculus, 633 marshaling, 709 propositional, 632 master-slave, 732 sequential, 269 mathematical induction, 9 temporal, 603 matrix logic program, 634 graph representation, 464 logic programming, 44, 406, 632 list of lists implementation, 232 difference list, 142 Max operation, 194 process model, 395, 807 McCloud, Scott, 482 unification, 101 Member operation, 829 logical equivalence, 243, 785 memoization, 417, 457 configuration, 805 calendar example, 694 logical formula, 633 call by need, 434 logical semantics, 38, 631–641 declarative programming, 315 logical sentence, 633 explicit state, 25, 694 assertion, 441 unification, 102 invariant, 441 memory Louis XIV, 405, 410 address in abstract machine, 56 Loyd, Sam, 774 consumption, 172 Lully, Raymond (Llull, Ram´on), 621 content-addressable, 587 Lynch, Nancy, 353 leak, 75 choice point, 668 Mac OS X operating system, xxiv, Prolog, 668 xxvi, 254 life cycle, 75 Macintosh computer, xxvi memory management, 72–78, 480– MacQueen, David, 337 482 macro C, 180 alias (in QTk), 680 garbage collection, 75 Index 883

Pascal, 180 reengineering, 522 Merge operation, 771 relation to concurrency, 239, 252, message, 499 319 message-passing concurrency, see ob- relation to explicit state, 315 ject, active, see object, port relational model, 660 meta-interpreter, 654, 676 system decomposition, 457 meta-object protocol, see protocol, module, 183, 220, 454 meta-object Array, 436 method Atom, 824 object, 19, 497 Browser, 224 wrapping, 516 Char, 821, 823 methodology, see software develop- Compiler, 690, 815 ment Connection, 715, 732 Meyer, Bertrand, 450, 491, 521, 527 Dictionary, 437 Microsoft Corporation, 462, 679 Distribution (supplement), 718 middle-out software development, 451 FD, 775 mind of programmer Fault, 739, 743 capabilities (atoms vs. names), File (supplement), 211, 292, 564 510 Finalize, 481 difference list, 145 Float, 821 enforcing encapsulation, 420 Int, 821 language design trade-offs, 811 List, 258, 385, 829 order-determining concurrency, Module, 224, 413, 455, 730, 817 273 MyList (example), 222 state (implicit vs. explicit), 408 Number, 14, 54, 182, 821 use of constraints, 274 OS, 371, 609, 692, 699, 730 minus sign (use of tilde ˜), 820 ObjectSupport, 517 Mnesia (Erlang database), 387 Open, 564, 729 mod (integer modulo) operation, 54, Pickle, 216, 223, 717 821 Port, 673 model Property, 93, 253, 255 computation, 29, see computa- QTk, 213, 680, 729 tion model interactive use, 214, 684 dialog (in GUI), 695 use in application, 225 domain (in GUI), 695 Record, 826 GUI formalism, 695 Remote, 255, 732 logical semantics, 633 Search, 776 presentation (in GUI), 695 Space, 654, 763 programming, 29 String, 824 model-based GUI design, 695 Thread, 255, 276 modularity, xxi, 315, 409, 458 Time, 304 encapsulated search, 625 Tk, 703 inadequacy of declarative model, Tuple, 827 315 Value, 328, 830 884 Index

Base, 222, 229, 729 Compiler Panel tool, 815 compilation unit, 454 Distribution Panel tool, 815 dynamic linking, 285 Explorer tool, 757, 815 failure, 329 garbage collection, 78 dynamic typing, 105 GlobalStore, 743 Erlang, 389 interactive interface, 1, 87, 815 importing, 224 kernel languages, 844 interface, 455 library modules, 229 library, 229 limited role of the compiler, 504 resource, 729, 746 memory consumption, 174 specification, 221 Open Source license, xxiv System, 222, 229, 729 overview, xxiv MOGUL (Mozart Global User Li- Panel tool, 815 brary), 222 performance, 201, 379 monad, xxi, 309, 332 Prototyper tool, 689 monitor, 579, 592–600 separate compilation, 457 condition variable, 598 Standard Library, 214, 225, 230, guarded method, 595 685, 690 implementation, 597 System modules, 229, 729 Java language, 616 thread scheduler, 253 Java semantics, 592 uncaught exception, 93, 801 monolithic multi-agent systems (MAS), xxiii, function, 296 345, 362, 576 stateful programming, 471 multimedia, 176 monotonicity, 849 multiprocessor constraint programming, 766 cluster, 711 dataflow variable, 336, 570 shared-memory, 710 need (x)predicate,796 multiset, 240 need property, 283 mutable store (for cells), 794 store, 781 Myriorama, 273 thread reduction, 239, 781, 782 Moore’s law, 176, 622 n-queens problem, 629 Moore, Gordon, 176 name, 203, 714, 791, 824, 847 Morrison, J. Paul, 257 defining scope, 508 Mozart Consortium, xxiv, xxvi, 106 distributed computing, 711 Mozart Programming System, 254 fresh, 203 Base modules, 229, 729 generation, 206 Browser tool, 1, 88 impure, 715 displaying cyclic structures, pure, 715 102 name server, 403, 711 displaying strings, 716 natural design, 461, 569 WaitQuiet operation, 798 natural language, xiii, 31, 38, 641 cheap concurrency, 252 natural selection, 451, 462 command line interface, 817 Naur, Peter, 32 Index 885

needed variable, 283, 796 bounded buffer, 595 negation as failure, 662, 674 Filter operation, 386 nesting marker, 53, 83, 355, 365 lack of in Flavius Josephus Netherlands, 819 problem, 561 network awareness, 387, 723 relation to exceptions, 327 network transparency, 255, 387, 708 relation to coroutines, 275 neutral element, 187 thread scheduler, 253 New operation, 495, 549 nonstrict evaluation, 331 NewActive operation, 558 Haskell, 310 NewActiveExc operation, 562, 728 nonvar operation (in Prolog), 660, NewArray operation, 436 662 NewCell operation, 416 normal distribution, 476 NewDictionary operation, 437 normal order reduction, 330 NewLock operation, 22, 583 Haskell, 309 NewName operation, 203, 792, 824 notify operation (in monitor), 592 NewPort operation, 349 notifyAll operation (in monitor), NewSpace operation, 764 593 NewStat operation, 725 NP-complete problems, 176 resilient, 742 NUL character, 841 Newton’s method for square roots, number, 52, 819 119 Newton, Isaac, 278 O’Keefe, Richard, 111, 407, 668 nil, 828 object, 413, 420, 542, 546 node (in Erlang), 387 declarative, 423, 483, 568 noise (electronic), 473 introduction, 17 nonblocking operation, 333 Java, 551, 807 receive (in Erlang), 394 passive, 556, 575, 576 delete (in queue), 598 strong, 542 read (in tuple space), 586 object code, 221 receive, 333 object graph, 553 send, 333 object, active, 350, 556–567 stack, 578 comparison with passive object, noncompositional design, 461 556 nondeterminism defining behavior with a class, choice statement, 621, 623, 772 558 declarative concurrent model, polymorphism, 429 575 object, port, 346, 350, 413 don’tknow, 324, 621 approaches to concurrency, 573 introduction, 20 Erlang, 563 limitation of declarative model, further reading, 582 319 many-to-one communication, 351 logic programming, 638 polymorphism, 429 observable, 20, 234, 319, 570, reactive, 351 573, 575, 576 reasoning, 352 886 Index

sharing one thread, 378 optimization, 177 when to use, 576 avoid during development, 452 object, stream, 256, 265–266, 411, combinatoric, 661 413, 574 compiler, 162 comparison with port object, 351 eager execution, 302 Flavius Josephus problem, 561 early error detection, 504 higher-order iteration, 258 first-argument indexing, 659 polymorphism, 429 memoization, 694 producer/consumer, 257 monitor performance, 597 transducer, 259 object system, 545 Ockham, William of, 29 relational programming, 622 octal integer, 819 short-circuit protocol, 559 Okasaki, Chris, 175, 330 standard computer, 314 OLE(Object Linking and Embed- thread priorities, 265 ding), 462 order-independence, 49 OMG (Object Management Group), unification, 110, 232 462 orelse operator, 83 open distribution, 709, 711, 714 otherwise method, 500 open program, 202 OTP (Ericsson Open Telecom Plat- Open Source software, xxiv form), 386 operating system, 208 overloading, 313, 429 Linux, xxvi, 201, 471, 499 overriding relation, 502 Mac OS X, xxiv, xxvi, 254 Oz, Wizard of, 1 Solaris, xxvi, xxix ozc command, 228, 817 Unix, xxiv, 254, 305, 459, 553, 642 pairwise distinct, 756, 774, 782 VM (Virtual Machine), 41 palindrome, 628 Windows, xxiv, 254 palindrome product problem, 628, operation (in data abstraction), 420 757 operational semantics, 38, 60, 635, Panangaden, Prakash, 338 779–811 Panel tool, see Mozart Programming operator System associativity, 34, 837 Papert,Seymour, xiii, 233 binary, 34, 836 paradigm, xiii, xvi, see computation infix, 52, 83, 185, 793, 826, 828, model 830, 836 declarative, 29 mixfix, 826, 837 school of thought, xvi postfix, 837 paragraph (in OPI), 815 precedence, 34, 836 parallelism, 237, 322 prefix, 836 difference with concurrency, 322 ternary, 838 importance of nonstrictness, 331 unary, 836 importance of worst-case com- OPI (Oz programming interface), 815 plexity, 174 optimistic scheduling, 603 parameter passing, 430–434 Index 887

call by name, 432 lazy language, 289, 342 exercise, 484 measuring, 167 call by need, 433 memoization, 25, 315 exercise, 485 mobile object, 724 lazy evaluation, 433 monitor, 597 call by reference, 57, 430 Mozart Programming System, Java, 555 201, 379 call by value, 431 personal computer, 175 Java, 555 priceofconcurrency, 339 call by value-result, 431 record field access, 438 call by variable, 430 role of optimization, 177, 265, parity, 14 302 Parnas,David Lorge, xxii, 462 role of parallelism, 237, 322 parser, 32, 161–166 transitive closure, 471 generic, 650 word-of-mouth simulation, 486 gump tool, 39 permanent failure, 739 natural language, 641 permutations, 2 partial failure, 326 persistence partial list, 440, 829 data structure, 149, 297 partial order, 238 database, 654 partial termination, 243, 338, 804 Erlang, 387 partial value, 46 transaction, 600 Pascal’s triangle, 4 personal computer, 3, 252, 254, 289, Pascal, Blaise, 5 304 pass by ..., see parameter passing low-cost, 74, 175 pattern matching pessimistic scheduling, 603 case statement, 6, 67 Phidani Software, 642 function (inErlang), 388 π calculus, xvii, 41, 54, 805 Haskell, 309 pipeline, 259 receive expression (in Erlang), pixel, 556 391 placeholder reduction rule semantics, 784 dataflow variable, 86 PDA(procedural data abstraction), future (in Multilisp), 336 420 GUIdesign, 686, 703 pencil, xviii planning Pentium III processor, 201, 471 flight, 671 performance WARPLAN, 621 cluster computing, 711 Plotkin, Gordon, 779 competitive concurrency, 254 point constraint programming, 758 resting, 338 Cray-1 supercomputer, 175 synchronization, 333 declarative programming, 313 two-dimensional space, 554 dictionary, 201 pointer, 76 distributed stream, 724 content edge, 733 888 Index

dependency, 459 745 dynamic typing, 106 class is final by default, 492 garbage collection, 76 compartmentalize responsibility, memory block, 480 425, 451 resource, 480 concentrate explicit state, 412 state, 733 creative extension, xiv, 844 POLA (Principle of Least Authority), decisions at right level, 460 209 declarative concurrency, 242, 281 polymorphism, 18, 106, 425, 462, 493 document component interfaces, active objects, 429 451 ad-hoc, 429 documented violations, 460 apportioning responsibility, 425 eager default, lazy declared, 330 example, 530 encapsulate design decisions, 458 Haskell, 312 enriching control (in logic pro- object-oriented programming, 490 gramming), 640 port objects, 429 error confinement, 90 stream objects, 429 “everything should be an ob- universal, 429 ject”, 542 Ponsard, Christophe, 545 exploit data abstraction unifor- port (explicit state), 349, 719, 848 mity, 543 communication from inside en- form mirrors content, 544 capsulated search, 673 freely exchange knowledge, 451 distributed semantics, 383 function structure follows type Port.sendRecv operation, 673 structure, 135 portal, 476 functional abstraction, 4 postcondition, 441, 521 last call optimization, 72 potential function, 175 layered language design, 850 precondition, 441, 521 least authority (POLA), 209 predicate calculus, 633 least expressiveness, 323 preemption, 252 least privilege, 209 preprocessor, 318 minimize dependencies, 387, 459 DCG(in Prolog), 649 minimize indirections, 459 design patterns, 536 model independence, 457 extended DCG (in Prolog), 140 more is not better or worse, just fallacy of, 318 different, xx presentation model (in GUI), 695 Mozart design rules, xxvi principle natural selection, 451, 462 abstraction, 410 need to know, 209 avoid changing interfaces, 458 objects over ADTs, 490 avoidpremature optimization, pay only on use, 620 177, 452 predictable dependencies, 460 balance planning and refactor- runtime is all there is, 504, 690 ing, 452 separation of concerns, 567 centralized first, distributed later, stateful component with declara- Index 889

tive behavior, 417 procedure value (closure), 65, 178, substitution property, 518, 521, 792 523 anonymous, 53 syntax stability, 643 common limitation, 179, 552 system decomposition, 210 distributed lexical scoping, 722 type first, 137 encoding as an object, 540 usedata abstraction everywhere, higher-order programming, 177 489, 543 relation to inner class, 552 working software keeps working, process 59, 459, 722 concurrent calculus, 54 private scope, 507, 508 concurrent program design, 364 C++ and Java sense, 508 CSP, 619 Smalltalk and Oz sense, 507 distributed system, 707 probability Erlang, 350, 386, 389 exponential distribution, 475 large program design, 450 Gaussian distribution, 476 operating system, 255 normal distribution, 476 producer and consumer, 724 uniform distribution, 474 run-time error, 96 unique name generation, 207 small program design, 218 problem processor, 237 cryptarithmetic, 755, 776 cluster computing, 711 digital logic satisfiability, 176 dataflowmachine, 337, 469 Flavius Josephus, 558–561 parallel functional programming, flight planning, 671 331 grocery puzzle, 774 shared-memory multiprocessor, halting, 209, 681 710 Hamming, 293, 342 producer, 257 intractable, 176 profiling, 177, 452 library scheduler, 672 program design, see software develop- making change, 775 ment n-queens, 629 program point, 444, 606 NP-complete, 176 programming, xv,1 palindrome product, 628, 757 accumulator, 139 Send-More-Money, 755, 776 component-based, 412 undecidable, 209 concurrent, 573 zebra puzzle, 774 constraint, 44, 274, 577, 663 proc statement, 65, 792 data-centered, 576 procedure declarative, 29, 406 as component, 412 descriptive, 115 basic operations, 55 need for algorithms, 116 external reference, 65 programmable, 115 importance, 54 Erlang, 388 order, 177 flow-based, 257 tail-recursive, 72 functional, 406 890 Index

future developments, 461 protection boundary, 202 good style, xxi protector, 325 Haskell, 309 protocol, 353 higher-order, 113, 123, 177–194 by-need, 282 introduction, 13 communication, 715 relation to object-oriented, 538 consistency, 712 imperative, 29, 406 DHCP (Dynamic Host Connec- Java, 552, 615 tion Protocol), 207 kernel language approach, xvi distributed binding, 733 logic, 44, 101, 142, 406, 632 distributed unification, 733 multi-agent, 412, 576 eager copy, 734 multiparadigm, xiv, xxvi eager immediate copy, 734 event manager, 566 interaction (in GUI), 682 nonalgorithmic, 622 invalidation, 733 object-based, 19, 538 IP (Internet Protocol), 206 object-oriented (OOP), 19, 413, lazy copy, 733 489 meta-object, 516 open, 105, 202 mobile state, 733 paradigm, xiii, xvi, 29, see com- negotiation, 376 putation model short-circuit, 559 Prolog, 663 stationary state, 733 real-time, 304 TCP (Transmission Control Pro- relational, 621 tocol), 712, 740 stateful, 29 timer, 368 stateless, 29 Prototyper tool, 689 synchronous, 266 pseudorandom numbers, 473 programming model, xiii, 29 Psion Series 3 palmtop computer, 378 Prolog, 660–671 public scope, 507 Aquarius, 140, 661 pureobject-oriented language, 543 Parma, 661 SICStus, 190, 663 QTk, 213, 680, 729 state threads package, 190 interactive use, 214, 684 proofengineering, 117 Prototyper, 689 proof rule, 444 use in application, 225 propagate-and-search, 629, 750 quadratic equation, 179 propagator, 752, 760 quantifier, 441, 445, 633, 645 property existential (in Prolog), 671 liveness, 602 quantum (in thread scheduling), 252 object, 497 query safety, 602 database, 655 propositional logic, 632 logic programming, 634 protected scope, 508 queue, 145 C++ sense, 509 amortized ephemeral, 147 Java sense, 567 amortized persistent, 298 Index 891

breadth-first traversal, 156 direct, 113 concurrent, 379, 583 indirect, 113 nonblocking delete, 598 mutual, 110 priority, 605, 614 polymorphic, 309 worst-case ephemeral, 147 programming with, 127 worst-case persistent, 299 Prototyper tool, 690 tail recursion optimization, 72 race condition, 20, 234 red cut (in Prolog), 670 raise statement, 93, 801 RedHat Corporation, xxvi, 201, 471 random number generation, 472 reduction order, 330–332 rational tree, 760 applicative, 330 Raymond, Eric, 462 normal, 330 reachable memory, 74 reduction rule, 784 ReadOnly operation, 799 reengineering, 522 real-time computing refactoring, 452 garbage collection, 76 reference, 714 hard, 174, 253, 254, 304 referential transparency, 113 soft, 304 reflection, 515 reasoning region (in OPI), 815 algebraic, 111, 116, 323 register atomic action, 581 abstract machine, 56 causal, 353, 575 forwarding, 621 lift control system, 375 memory management, 74 logical, xix, 111, 632 registration message-passing concurrent model, action procedures (in GUI), 683 352 display refresh (FlexClock), 700 shared-shate concurrent model, distributed binding, 737 324 finalization, 481 stateful model, 324, 440 relation, 655 receive relative error, 120 asynchronous, 332 reliability, 711 nonblocking, 333 rendezvous, 619 synchronous, 332 replicator, 326 receive expression (in Erlang), 391 research project, xxiv recomputation, 761, 776 resolution record, 19, 52, 825 deadlock, 605 adjoin, 827 logic programming, 635, 640, 662 basic operations, 54, 826 SLDNF, 662 dynamiccreation, 165, 549, 695 video display, 321 importance, 53 resource type, 438 distributed component, 746 usage trade-offs, 438 distributed system, 729 recurrence equation, 167 external, 77, 480 recursion, 3, 113, 124 file descriptor, 293 892 Index

localized, 709 scalability producer/consumer pipeline, 261 compilation, 458 useoflaziness, 289 multiprocessor, 710 responsibility program development, 105 atomicity and consistency (in weighted reference counting, 737 transaction), 600 scalar product (constraint), 775 compartmentalize (in a team), scheduler 451 Delay operation, 304 coroutine (avoiding starvation), deterministic, 253 275 lift control system, 366 design by contract, 521 nondeterministic, 253 distributed memory management, randomness, 473 738 resource allocation, 672 dynamic typing, 493 round-robin, 252, 256 failure confinement, 245 thread, 239, 252 memory management, 76 transaction, 603 role of polymorphism, 425 Schulte, Christian, xxvi type inference, 137 science, xv, xviii resting point, 338 scientific method, xvii restriction (environment), 62 scope, 56, 507 retract/1 operation (in Prolog), 662 attribute, 510 return (in for loop), 190 dynamic, 59 Reuter, Andreas, 582, 600 lexical, 57, 59, 64, 508, 539 Reynolds, John C., 419 absence in Prolog, 661 right, see name distributed, 722 Rinard, Martin C., 338 hiding, 221, 411, 423, 442, 483, RISC (Reduced Instruction Set Com- 495, 549 puter) microprocessor, 621 substitution, 803 RMI (remote method invocation), private, 507, 508 354, 709, 724, 725 protected, 508 root variable, 763 public, 507 Round operation, 822 static, see lexical RPC(remote procedure call), 354, user-defined, 508 709 search rubber band, 251 aggregate, 670 runic inscription, 779 all-solutions, 626 Runnable interface (in Java), 616 binary, 151 branch-and-bound, 772 s-expression, 650 breadth-first, 644 Sacks, Oliver, 405 communication from inside en- safety, 602 capsulated search, 673 Saint-Exup´ery, Antoine de, 111 constraint programming, 274 Santayana, George, 694 contribution of AKL, 809 Saraswat, Vijay A., 338, 662, 808 danger, 639 Index 893

database query, 657 dynamic binding, 505 depth-first, 622, 644 forwarding, 511 deterministic, 621 Java, 553 encapsulated, 625 this notation, 551 generate-and-test, 629, 758 self (in Erlang), 390 iterative deepening, 644 semantic stack, 62 linear, 197 runnable, 62 logic programming, 661 suspended, 62 n-queens problem, 629 terminated, 62 one-solution, 626 semantics, 31 overuse, xxi abstract machine, 56–78, 92–94, propagate-and-search, 629, 750 239–241, 282–283, 348–349, pruning, 662 416–417 relational computation model, axiomatic, 38, 440–450, 632 623 by-need trigger, 282 relational programming, 621 cell, 416 saturation, 772 common abstractions, 808 search space, 622 denotational, 38 search strategy, 761 exceptions, 92 search tree, 624 interleaving, 780 security kernel language, see abstract ma- abstract data type, 201–210 chine application, 744 kernel language approach, 38 atom vs. name, 508 logical, 38, 631–641 capability, 208 monitor (in Java), 592 data abstraction, 419–435 operational, 38, 60, 635, 779–811 distributed resources, 731 port, 348, 383 distributed system, 743 secure types, 203 engineering, 744 semanticstatement, 61 hardware, 744 SOS(structural operational se- human society, 208 mantics), 779 implementation, 744 thread, 239 kernel language concepts, 847 Send operation, 349 language, 208, 744 slot-reserving semantics, 384 linguistic abstraction, 39 send mechanism, 208 asynchronous, 332 open distribution, 711 latency, 263 policy, 208 nonblocking, 333 right, 791, 847 synchronous, 332 static typing, 106 Send-More-Money problem, 755, 776 threat model, 744 separation of concerns, 567 self sequential logic, 269 clone, 517 serializability, 600 delegation, 511 serialization, 709 894 Index

serializer, 325 simulation, 486 set comprehension, 301 Smolka, Gert, xxvi setof/3 operation (in Prolog), 626, snapshot (of state), 437, 718 666, 670 software design, see design methodol- Shakespeare, William, 815 ogy, see language design shared-state concurrency, see atomic software development, 218, 450 action, see lock, see moni- bottom-up, 451 tor, see transaction compositional, 453 sharing, 418 concurrent components, 362 Browser tool, 102, 829 distributed programming, 745 distributed state, 720 evolutionary, 451 distributed value, 716 extreme programming, 452 thread, 378 framework, 492 short-circuit IID(Iterative and Incremental), concurrent composition, 277 451 Flavius Josephus problem, 559 importance of names, 508 transitive closure, 464 in thelarge, 450 Show operation, 340 in the small, 218 side effect, 411 incremental, 451 declarative, 288 interactive interface, 87 signal operation (in monitor), 592 iterative, 451 signature (of procedure), 129 middle-out, 451 simulation stepwise refinement, 465, 604 components, 412 test-driven, 452 digital logic, 266–272 top-down, 8, 451 inadequacy of declarative model, software engineering, 450 173 component as unit of deploy- Internet, 412 ment, 221 multi-agent, 412 concurrency, 233 slow network, 578 distributed lexical scoping, 722 small world, 486 further reading, 462 word-of-mouth, 476 informatics curriculum, xxii Simurgh, 707 lexical scoping, 59 single-assignment store, 42–49, 60, software rot, 459 781 Solaris operating system, xxvi, xxix importance, 43 Solve operation, 626, 773 singularity, 176 SolveAll operation, 626 sink (consumer), 259 SolveOne operation, 626 64-bit address, 78 Sort operation, 670, 829 64-bit word, 74, 175, 820 SOS(structural operational seman- skip statement, 62, 785 tics), 779 SLDNF resolution, 662 source (producer), 259 small world source code, 221 graph, 461 interactive, 815 Index 895

million line, xvi, 36, 387, 457, 458 modularity property, 315 nonexistent, 492 nonstrictlanguage, 331 preprocessor input, 318 port (communication channel), reengineering, 522 347 set of functors, 285 reasoning with, 38, 440 textual scope, 64 revocable capability, 434 variable name, 44 threading, 139 space, see computation space, see transformation, 133 memory state transition diagram, 353, 368 space leak, see memory leak component design, 364 specification, 410 floor component, 369 component, 461 lift component, 371 specification language, 116 lift controller component, 369 speculative execution (in nonstrict transaction, 607 language), 331 stateless (declarative programming), stack 111 declarative object, 423 statement depth-first traversal, 156 case, 67, 790 memory management, 74 catch (clause in try), 94 open declarative, 195, 421 choice, 623, 772 proving it correct, 442 conc, 278 secure declarative bundled, 423 declare,2,87 secure declarative unbundled, fail, 623 205, 422 finally (clause in try), 94 secure stateful bundled, 424 for, 188 secure stateful unbundled, 424 fun, 84 semantic, 61 functor, 223 stateful concurrent, 578 gate, 272 standalone application, 222 if, 66, 790 declare not allowed, 87 local, 56, 63, 786 Java, 555 lock, 22, 583 uncaught exception, 93 proc, 65, 792 starvation, 275 raise, 93, 801 wait set implementation, 597 skip, 62, 785 state thread, 241, 785 cell (mutable variable), 414 try, 92, 799 declarative, 408 break, 486 explicit, 16, 409 compound, 117 implicit, 408 compound (in Java), 552 interaction with call by name, declarative kernel language, 49 485 interactive, 87 lazy execution, 481 procedure application, 66 lazy language, 331 sequential composition, 63, 785 memory management, 77 suspendable, 65 896 Index

value creation, 63 noncompositional, 461 variable-variable binding, 63 program, 219, 220 static structure equality, 103, 418, 723 binding, 506 substitution, 126, 803 linking, 222 substitution property, 518, 521, 523 scope, see scope, lexical subtype typing, 51, 104–106 basic types, 52 stdin (standard input), 229, 553 class hierarchy, 518 stdout (standard output), 553 Sun Microsystems, xxvi, 462 Steiner, Jennifer G., 334 superclass, 503, 513, 556 Stirling’s formula for factorial, 618 supercomputer, 175 storage manager, 325 supply-driven execution, see eager ex- store, 781 ecution equivalence, 785 suspension mutable (for cells), 416 Delay operation, 305 mutable (for ports), 348 due to program error, 48, 89 need, 780, 795 thread, 239, 276 predicate, 781 Sussman, Gerald Jay, 42 read-only, 206, 798 Sussman, Julie, 42 single-assignment, 42–49, 60, 99, Symbian Ltd., 378 235, 781 symbolic link, 459 trigger, 282, 795 synchronization, 333–337 value, 43 clock, 308 stream, 795 dataflow, 790 deterministic, 257 synchronized keyword, 593, 616 Java, 553 synchronous communication, 332 merger, 395 active object variant, 562 producer/consumer, 257 component interaction, 456 usage trade-offs, 439 CSP, 619 strict ..., see eager . . . dependency, 387 strict two-phase locking, 604 error reporting, 360 strictness analysis, 289, 310, 342 failure detection, 400, 739 string, 53, 830 fault confinement, 745 virtual, 211, 831 receive, 332 StringToAtom operation, 824 send, 332 structure synchronous programming, 266 compiler, 162 syntactic sugar, 40, 79–84 compositional, 461 dynamic record creation, 165 difference, 141 local statement, 40 distribution, 255 state transition diagram, 369 effect of concurrency, 252 syntax, 31 grammar, 32 convention for examples, xxix hierarchical, 453 language, 31 interpreter, 653 nestable constructs (in Oz), 833 Index 897

nestable declarations (in Oz), testing 833 declarative programs, 111, 407 Oz language, 833 dynamic typing, 105 Oz lexical, 839 programming in the small, 219 Prolog, 663 stateful programs, 407 term (in Oz), 833 text file, 210 synthesized argument, 161 Thalys high-speed train, 382 system exception, 96 theorem Szyperski, Clemens, 462 binomial, 4 Church-Rosser, 331 tail call optimization, 72 G¨odel’s completeness, 634 Tanenbaum, Andrew S., 334 G¨odel’s incompleteness, 634 task (in concurrency), 780 halting problem, 681 tautology, 632 theorem prover, 117, 634, 662 TCP (Transmission Control Proto- Therac-25 scandal, 21 col), 712, 740 thinking machine, 621 technology, xv third-party independence, 335 dangers of concurrency, 21 32-bit address, 78 history of computing, 176 32-bit word, 74, 174 magic, 314 this, see self molecular computing, 176 Thompson, ’Arcy Wentworth, 405 Prolog implementation, 661 thread, 846 reengineering, 522 declarative model, 233 singularity, 176 hanging, 399 software component, 462 interactive interface, 89 synchronous digital, 267 introduction, 15 transition to 64-bit, 78 Java, 615 Tel, Gerard, 353 monotonicity property, 239, 781, tell operation, 782, 787 782 temporal logic, 603 priority, 253 temporary failure, 739 ready, 239 term runnable, 239 Erlang, 391 suspended, 239 Oz, 833 synchronization, 333 Prolog, 664 thread statement, 241, 785 termination Thread class (in Java), 616 detection, 276, 382 throughput, 263 ping-pong example, 305 thunk, 432 failure in declarative program, ticket, 480, 714 245 Connection module, 715 partial, 243, 338, 804 ticking, 307 proof, 449 time complexity, 11 total, 804 time slice, 252–254 test-driven development, 452 duration, 254 898 Index

time-lease mechanism, 480, 734, 738 language design, 811 time-out, 740 lazy vs. eager execution, 329 Erlang, 391–394 memory use vs. execution speed, system design, 460 177 timer protocol, 368 names vs. atoms, 510 timestamp, 207, 602 nonstrictness vs. explicit state, timing measurement 331, 344 active object, 379 objects vs. ADTs, 428 memory consumption, 173 optimistic vs. pessimistic schedul- palindrome product (constraint ing, 603 version), 758 planning vs. refactoring, 452 palindrome product (naive ver- simple semantics vs. efficient im- sion), 629 plementation, 788 transitive closure, 471 single vs. multiple inheritance, word frequency, 201 532 tokenequality, 418, 714, 723 specification language vs. pro- tokenpassing, 579, 588, 591, 721 gramming language, 116 token syntax (of Oz), 833 testing declarative vs. stateful tokenizer, 32, 162 programs, 407 top-down software development, 8, type view vs. structure view, 520 451 transaction, 580, 600–615 total termination, 804 bank example, 202 trade-off database, 655 asynchronous communication vs. fault distributed, 615 confinement, 745 fault-tolerant store, 743 compilation time vs. execution incarnation, 607 efficiency, 457 logging example, 505 compositional vs. noncomposi- nested, 615 tional design, 461 restart, 606 dynamicvs. static scoping, 58 tell operation, 788, 811 dynamic vs. static typing, 104 two-phase locking, 604 explicit state vs. implicit state, transaction manager, 610 315, 409 transaction processing monitor, 611 expressiveness vs. execution effi- transducer, 259 ciency, 116 transition, 368 expressiveness vs. manipulabil- transitive closure, 463–471 ity, 681 declarative algorithm, 465, 468 functional decomposition vs. type Floyd-Warshall algorithm, 470 decomposition, 542 stateful algorithm, 468 helper procedure placement, 120 translator, see compiler indexed collections, 435 tree, 150 inheritance vs. component com- balanced, 150 position, 462, 492 depth, 151 kernel language design, 844 drawing, 158 Index 899

finite, 150 stateless, 420 Haskell expression, 310 static, 51, 104–106 node depth, 156 strong, 104, 308 ordered binary, 151 unbundled, 420 parse, 32, 162, 643 weak, 104 rational, 760 type decomposition, 522, 542 search, 624 stream merge, 398 UML(Unified Modeling Language), syntax, 162 489, 528 ternary, 150 undecidable problem, 209 traversal, 155 Unicode, 458, 459, 820 trigger, 281–285, 847 Java, 553 activation, 282 unification, 98–104, 846 by-need, 575 algorithm, 101 definition using WaitNeeded, 795 distributed, 733 implicit, 282 equivalence set of variables, 101 programmed, 193, 262, 282 examples, 99 true, 824 unification grammar, 649–650 try statement, 92, 799 uniform distribution, 474 tuple, 52, 826 unit, 824 usage trade-offs, 438 Unix operating system, xxiv, 254, tuplespace, 456, 586–590 305, 459, 553 Turing machine, 41, 115, 681, 846 lex/yacc parsing tools, 642 Turing, Alan, 115 pipe, xvi, 257 two-phase locking, 604 unmarshaling, 709 type, 50, 195 URL(Uniform Resource Locator), abstract, 195 211, 715 ADT, 195 limited lifetime, 460 atomic, 824 basic, 52 value, 43 bundled, 420 compatible, 46 class, 313 complete, 46 concurrent data abstraction, 578 compound, 43 declarative, 420 failed, 328, 802, 848 descriptive, 129 in data abstraction, 420 dynamic, 51, 104–106, 709 partial, 46 hierarchy, 52 value store, 43 inference, 98, 137, 309 var operation (in Prolog), 662 open, 420 variable, 2 PDA(object), 420 binding, 44, 45, 787 polymorphic, 312 dataflow, 42, 48, 846 secure, 201–210, 419–435 declarative, 42 signature, 129, 309 determined, 66, 101, 206, 283, stateful, 420 333, 660, 791 900 Index

domain, 760 WaitTwo operation, 319, 320, 393, equivalence set, 101 396, 399, 641 escaped, 500, 509 WAN(wide area network), 711, 739 final (in Java), 551 Warren, David H.D., 621 free, 58, 633 watcher, 739, 742 fresh, 651, 787 Webservices, 345, 356 global, 87 Weikum, Gerhard, 600 identifier, 2, 44 wheel, xviii instance, 497 while loop, 447 interactive, 87 white space, see blank space local, 180 widget (in GUI), 213, 681, 682 logic, 101 Width operation, 826 mutable, see cell Wikstr¨om, Claes, 582 needed, 283, 796 Wilf, Herbert S., 170 Williams, Mike, 582 read-only, 206, 209, 348, 380, window (in GUI), 682 798, 847 Windows operating system, xxiv, 254 root, 763 wire, 363 single-assignment, 336 many-shot, 363 special (in Common Lisp), 59 one-shot, 363, 368 unification, 99 Wood, David, 378 Virding, Robert, 582 word virtual machine, xvii, 41, 676 frequency, 198 virtual string, 211, 831 memory, 74 visibility specification, 219 component-based programming, word-of-mouth simulation, 476 364 wrapping and unwrapping, 204 computation space, 764 WWW (World Wide Web), 211 horizontal, 509 vertical, 507 XML (Extensible Markup Language), Visual Basic, 461 115 Vlissides, John, 534 VLSI-BAM microprocessor, 621 zombie, 559 VM (Virtual Machine) operating sys- tem, 41 Vossen, Gottfried, 600

Wait operation (in dataflow), 791 wait operation (in monitor), 592 wait point, 579 wait-for graph, 605 WaitNeeded operation, 797, 847 WaitQuiet operation, 798, 803 WaitStable operation, 767