Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
15 views

Programming in D Ali Çehreli 2024 scribd download

The document is an overview of the ebook 'Programming in D' by Ali Çehreli, which covers various programming concepts and features of the D programming language. It includes information about the book's editing, licensing, and content structure, along with a detailed table of contents outlining the chapters and topics covered. The ebook is available for download on ebookmeta.com with bonus features for an enhanced reading experience.

Uploaded by

bobeshjuriy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Programming in D Ali Çehreli 2024 scribd download

The document is an overview of the ebook 'Programming in D' by Ali Çehreli, which covers various programming concepts and features of the D programming language. It includes information about the book's editing, licensing, and content structure, along with a detailed table of contents outlining the chapters and topics covered. The ebook is available for download on ebookmeta.com with bonus features for an enhanced reading experience.

Uploaded by

bobeshjuriy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Get the full ebook with Bonus Features for a Better Reading Experience on ebookmeta.

com

Programming in D Ali Çehreli

https://ebookmeta.com/product/programming-in-d-ali-cehreli/

OR CLICK HERE

DOWLOAD NOW

Download more ebook instantly today at https://ebookmeta.com


Programming in D
Ali Çehreli
Programming in D

Ali Çehreli

Edited by Luís Marques


Programming in D

D version: 2.098.1
1
Book revision: 2022-02-21
2
The most recent electronic versions of this book are available online .

Copyleft (ɔ) 2009-2022 Ali Çehreli

This work is licensed under the Creative Commons Attribution-


NonCommercial-ShareAlike 4.0 International License. To view a copy of this
license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/.

3
Edited by Luís Marques
4
Cover design by İzgi Yapıcı
5
Cover illustration by Sarah Reece
6
Published by Ali Çehreli

Fonts:
Andada by Carolina Giovagnoli for Huerta Tipográfica
Open Sans by Steve Matteson
DejaVu Mono by DejaVu Fonts

PDF version is generated with Prince XML


Other ebook versions are generated with Calibre

ISBNs:
978-0-692-59943-3 hardcover by IngramSpark
978-0-692-52957-7 paperback by IngramSpark
978-1-515-07460-1 paperback by Kindle Direct Publishing
978-1-519-95441-1 ePUB by Draft2Digital

1. https://bitbucket.org/acehreli/ddili
2. http://ddili.org/ders/d.en
3. http://www.luismarques.eu
4. http://izgiyapici.com
5. mailto:sarah@reeceweb.com
6. mailto:acehreli@yahoo.com
Contents
Foreword by Andrei Alexandrescu xix
Preface xxi
Acknowledgments ............................................................................................................. xxi
1. The Hello World Program 1
Compiler installation ............................................................................................................1
Source file...................................................................................................................................1
Compiling the hello world program ...............................................................................1
Compiler switches ................................................................................................................. 2
IDE................................................................................................................................................ 3
Contents of the hello world program ............................................................................ 3
Exercises .................................................................................................................................... 4
2. writeln and write 5
Exercises .................................................................................................................................... 5
3. Compilation 6
Machine code .......................................................................................................................... 6
Programming language....................................................................................................... 6
Interpreter ................................................................................................................................ 6
Compiler .................................................................................................................................... 7
4. Fundamental Types 8
Logical expression type ....................................................................................................... 8
Integer types ............................................................................................................................ 8
Floating point types .............................................................................................................. 8
Character types....................................................................................................................... 9
Properties of types................................................................................................................. 9
size_t ......................................................................................................................................10
Exercise ....................................................................................................................................10
5. Assignment and Order of Evaluation 11
The assignment operation ................................................................................................11
Order of evaluation..............................................................................................................11
Exercise .....................................................................................................................................11
6. Variables 12
Exercise .................................................................................................................................... 13
7. Standard Input and Output Streams 14
Exercise .................................................................................................................................... 14
8. Reading from the Standard Input 15
Skipping the whitespace characters ............................................................................ 16
Additional information ..................................................................................................... 17
Exercise .................................................................................................................................... 17
9. Logical Expressions 18
Logical Expressions............................................................................................................. 18
Grouping expressions ........................................................................................................ 21
Reading bool input ............................................................................................................. 21
Exercises .................................................................................................................................. 21
10. if Statement 24
The if block and its scope ...............................................................................................24
The else block and its scope ..........................................................................................24
Always use the scope curly brackets............................................................................25
The "if, else if, else" chain..................................................................................................25

v
Exercises ..................................................................................................................................27
11. while Loop 28
The continue statement ..................................................................................................28
The break statement ..........................................................................................................29
Unconditional loop .............................................................................................................29
Exercises ..................................................................................................................................30
12. Integers and Arithmetic Operations 31
Exercises .................................................................................................................................. 41
13. Floating Point Types 42
Floating point type properties........................................................................................42
.nan ...........................................................................................................................................43
Specifying floating point values ....................................................................................43
Overflow is not ignored.....................................................................................................45
Precision ..................................................................................................................................45
There is no truncation in division ................................................................................45
Which type to use ................................................................................................................46
Cannot represent all values.............................................................................................46
Unorderedness......................................................................................................................47
Exercises ..................................................................................................................................48
14. Arrays 49
Definition ................................................................................................................................49
Containers and elements..................................................................................................50
Accessing the elements......................................................................................................50
Index ..........................................................................................................................................51
Fixed-length arrays vs. dynamic arrays ......................................................................51
Using .length to get or set the number of elements ............................................51
An array example ................................................................................................................52
Initializing the elements...................................................................................................52
Basic array operations ....................................................................................................... 53
Exercises .................................................................................................................................. 55
15. Characters 57
History...................................................................................................................................... 57
Unicode encodings..............................................................................................................58
The character types of D ...................................................................................................59
Character literals .................................................................................................................59
Control characters.............................................................................................................. 60
Single quote and backslash ............................................................................................ 60
The std.uni module ............................................................................................................. 61
Limited support for ı and i ...............................................................................................62
Problems with reading characters ...............................................................................62
D's Unicode support............................................................................................................63
Summary.................................................................................................................................64
16. Slices and Other Array Features 65
Slices..........................................................................................................................................65
Using $, instead of array.length ................................................................................66
Using .dup to copy ..............................................................................................................66
Assignment.............................................................................................................................67
Making a slice longer may terminate sharing.........................................................67
Operations on all elements............................................................................................. 70
Multi-dimensional arrays ................................................................................................72
Summary.................................................................................................................................74

vi
Exercise ....................................................................................................................................74
17. Strings 75
readln and strip, instead of readf ........................................................................... 75
formattedRead for parsing strings .............................................................................76
Double quotes, not single quotes...................................................................................77
string, wstring, and dstring are immutable......................................................77
Potentially confusing length of strings.......................................................................78
String literals .........................................................................................................................79
String concatenation..........................................................................................................79
Comparing strings.............................................................................................................. 80
Lowercase and uppercase are different..................................................................... 80
Exercises .................................................................................................................................. 81
18. Redirecting the Standard Input and Output Streams 82
Redirecting the standard output to a file with operator > ..................................82
Redirecting the standard input from a file with operator < ..............................82
Redirecting both standard streams..............................................................................83
Piping programs with operator | ..................................................................................83
Exercise ....................................................................................................................................83
19. Files 84
Fundamental concepts ......................................................................................................84
std.stdio.File struct.....................................................................................................86
Exercise ....................................................................................................................................87
20. auto and typeof 88
auto ...........................................................................................................................................88
typeof ......................................................................................................................................88
Exercise ....................................................................................................................................89
21. Name Scope 90
Defining names closest to their first use................................................................... 90
22. for Loop 93
The sections of the while loop.......................................................................................93
The sections of the for loop ............................................................................................93
The sections may be empty .............................................................................................94
The name scope of the loop variable ...........................................................................94
Exercises ..................................................................................................................................95
23. Ternary Operator ?: 96
The type of the ternary expression ..............................................................................97
Exercise ....................................................................................................................................98
24. Literals 99
Integer literals.......................................................................................................................99
Floating point literals....................................................................................................... 101
Character literals ............................................................................................................... 101
String literals .......................................................................................................................102
Literals are calculated at compile time.....................................................................103
Exercises ................................................................................................................................103
25. Formatted Output 104
format_character .................................................................................................................105
width........................................................................................................................................107
separator .................................................................................................................................107
precision..................................................................................................................................108
flags ..........................................................................................................................................108

vii
Positional parameters ......................................................................................................109
Formatted element output ............................................................................................. 110
format ..................................................................................................................................... 111
Exercises ................................................................................................................................ 112
26. Formatted Input 113
Format specifier characters........................................................................................... 114
Exercise .................................................................................................................................. 114
27. do-while Loop 115
Exercise .................................................................................................................................. 116
28. Associative Arrays 117
Definition .............................................................................................................................. 117
Adding key-value pairs .................................................................................................... 118
Initialization ........................................................................................................................ 118
Removing key-value pairs .............................................................................................. 118
Determining the presence of a key............................................................................. 119
Properties .............................................................................................................................. 119
Example .................................................................................................................................120
Exercises ................................................................................................................................120
29. foreach Loop 121
The foreach syntax.......................................................................................................... 121
continue and break ........................................................................................................122
foreach with arrays.........................................................................................................122
foreach with strings and std.range.stride .....................................................122
foreach with associative arrays ................................................................................. 123
foreach with number ranges ...................................................................................... 123
foreach with structs, classes, and ranges............................................................... 123
The counter is automatic only for arrays................................................................124
The copy of the element, not the element itself ....................................................124
The integrity of the container must be preserved ............................................... 125
foreach_reverse to iterate in the reverse direction......................................... 125
Exercise ..................................................................................................................................126
30. switch and case 127
The goto statement...........................................................................................................127
The expression must be an integer, string, or bool type ..................................129
Value ranges.........................................................................................................................129
Distinct values.....................................................................................................................130
The final switch statement ......................................................................................130
When to use..........................................................................................................................130
Exercises .................................................................................................................................131
31. enum 132
Effects of magic constants on code quality............................................................. 132
The enum syntax ................................................................................................................. 132
Actual values and base types ........................................................................................ 133
enum values that are not of an enum type................................................................. 133
Properties .............................................................................................................................. 134
Converting from the base type..................................................................................... 135
Exercise .................................................................................................................................. 135
32. Functions 136
Parameters............................................................................................................................ 137
Calling a function .............................................................................................................. 139

viii
Doing work ........................................................................................................................... 139
The return value................................................................................................................. 139
The return statement .................................................................................................... 140
void functions ................................................................................................................... 140
The name of the function............................................................................................... 141
Code quality through functions................................................................................... 141
Exercises ................................................................................................................................ 145
33. Immutability 147
Immutable variables ........................................................................................................148
Parameters............................................................................................................................150
Initialization ........................................................................................................................ 154
Immutability of the slice versus the elements....................................................... 155
How to use ............................................................................................................................ 157
Summary............................................................................................................................... 158
34. Value Types and Reference Types 159
Value types............................................................................................................................ 159
Reference variables ...........................................................................................................160
Reference types................................................................................................................... 161
Fixed-length arrays are value types, slices are reference types...................... 165
Experiment........................................................................................................................... 165
Summary...............................................................................................................................167
35. Function Parameters 168
Parameters are always copied ......................................................................................168
Referenced variables are not copied..........................................................................169
Parameter qualifiers ......................................................................................................... 171
Summary...............................................................................................................................179
Exercise ..................................................................................................................................180
36. Lvalues and Rvalues 181
Limitations of rvalues...................................................................................................... 181
Using auto ref parameters to accept both lvalues and rvalues ..................182
Terminology......................................................................................................................... 183
37. Lazy Operators 184
38. Program Environment 185
The return value of main() ........................................................................................... 185
Standard error stream stderr .....................................................................................187
Parameters of main() ......................................................................................................187
Command line options and the std.getopt module ........................................188
Environment variables....................................................................................................190
Starting other programs .................................................................................................190
Summary............................................................................................................................... 191
Exercises ................................................................................................................................ 191
39. Exceptions 192
The throw statement to throw exceptions ..............................................................192
The try-catch statement to catch exceptions .....................................................197
Exception properties .......................................................................................................202
Kinds of errors ................................................................................................................... 203
Summary.............................................................................................................................. 205
40. scope 206
41. assert and enforce 208
Syntax....................................................................................................................................208

ix
static assert .................................................................................................................209
assert even if absolutely true........................................................................................210
No value nor side effect...................................................................................................210
Disabling assert checks ................................................................................................ 211
enforce for throwing exceptions ............................................................................... 211
How to use ............................................................................................................................ 211
Exercises ................................................................................................................................212
42. Unit Testing 214
Causes of bugs .....................................................................................................................214
Discovering the bugs ........................................................................................................214
Unit testing for catching bugs ...................................................................................... 215
Activating the unit tests ..................................................................................................216
unittest blocks.................................................................................................................216
Testing for exceptions ......................................................................................................217
Test driven development.................................................................................................218
Exercise .................................................................................................................................220
43. Contract Programming 221
in blocks for preconditions...........................................................................................221
out blocks for postconditions ..................................................................................... 222
Expression-based contracts.......................................................................................... 224
Disabling contract programming .............................................................................. 224
in blocks versus enforce checks............................................................................... 224
Exercise ................................................................................................................................. 226
44. Lifetimes and Fundamental Operations 228
Lifetime of a variable....................................................................................................... 228
Lifetime of a parameter.................................................................................................. 228
Fundamental operations ............................................................................................... 229
45. The null Value and the is Operator 233
The null value ....................................................................................................................233
The is operator ................................................................................................................. 234
The !is operator............................................................................................................... 234
Assigning the null value............................................................................................... 234
Summary...............................................................................................................................235
46. Type Conversions 237
Automatic type conversions..........................................................................................237
Explicit type conversions............................................................................................... 242
Summary.............................................................................................................................. 245
47. Structs 246
Definition ............................................................................................................................. 246
Accessing the members .................................................................................................. 248
Construction ....................................................................................................................... 249
Copying and assignment ................................................................................................ 251
Struct literals .......................................................................................................................253
static members................................................................................................................253
Exercises ............................................................................................................................... 256
48. Variable Number of Parameters 258
Default arguments ........................................................................................................... 258
Variadic functions ............................................................................................................260
Exercise ................................................................................................................................. 263

x
49. Function Overloading 265
Overload resolution ......................................................................................................... 266
Function overloading for user-defined types........................................................ 266
Limitations .......................................................................................................................... 267
Exercise ................................................................................................................................. 268
50. Member Functions 269
Defining member functions ......................................................................................... 269
Exercises ................................................................................................................................273
51. const ref Parameters and const Member Functions 275
immutable objects .............................................................................................................275
ref parameters that are not const ............................................................................275
const ref parameters....................................................................................................275
Non-const member functions .................................................................................... 276
const member functions ............................................................................................. 276
inout member functions .............................................................................................. 277
How to use ........................................................................................................................... 278
52. Constructor and Other Special Functions 279
Constructor ......................................................................................................................... 279
Destructor ............................................................................................................................ 288
Copy constructor...............................................................................................................290
Postblit................................................................................................................................... 292
Assignment operator....................................................................................................... 293
Disabling member functions ....................................................................................... 295
Summary.............................................................................................................................. 297
53. Operator Overloading 298
Overloadable operators..................................................................................................300
Element indexing and slicing operators ................................................................. 302
Defining more than one operator at the same time........................................... 303
Return types of operators.............................................................................................. 304
opEquals() for equality comparisons .................................................................... 306
opCmp() for sorting.......................................................................................................... 307
opCall() to call objects as functions....................................................................... 309
Indexing operators............................................................................................................310
Slicing operators ................................................................................................................ 313
opCast for type conversions ......................................................................................... 315
Catch-all operator opDispatch.................................................................................... 317
Inclusion query by opBinaryRight!"in".............................................................. 317
Exercise .................................................................................................................................. 319
54. Classes 322
Comparing with structs ................................................................................................. 322
Summary...............................................................................................................................327
55. Inheritance 328
Warning: Inherit only if "is a" ...................................................................................... 330
Inheritance from at most one class........................................................................... 330
Hierarchy charts ................................................................................................................ 331
Accessing superclass members .................................................................................... 331
Constructing superclass members .............................................................................332
Overriding the definitions of member functions.................................................333
Using the subclass in place of the superclass.........................................................334
Inheritance is transitive..................................................................................................335

xi
Abstract member functions and abstract classes.................................................336
Example .................................................................................................................................337
Summary.............................................................................................................................. 340
Exercises ............................................................................................................................... 340
56. Object 342
typeid and TypeInfo ..................................................................................................... 342
toString .............................................................................................................................. 344
opEquals .............................................................................................................................. 344
opCmp ...................................................................................................................................... 347
toHash ................................................................................................................................... 349
Exercises ................................................................................................................................ 351
57. Interfaces 354
Definition ..............................................................................................................................354
Inheriting from an interface ....................................................................................354
Inheriting from more than one interface ........................................................... 355
Inheriting from interface and class ....................................................................356
Inheriting interface from interface ...................................................................356
static member functions.............................................................................................356
final member functions ...............................................................................................358
How to use ............................................................................................................................359
Abstraction ...........................................................................................................................359
Example ................................................................................................................................ 360
Summary............................................................................................................................... 361
58. destroy and scoped 363
An example of calling destructors late .....................................................................363
destroy() to execute the destructor ....................................................................... 364
When to use......................................................................................................................... 364
Example ................................................................................................................................ 364
scoped() to call the destructor automatically .................................................... 367
Summary.............................................................................................................................. 368
59. Modules and Libraries 370
Packages................................................................................................................................. 371
Importing modules ........................................................................................................... 371
Libraries................................................................................................................................ 376
60. Encapsulation and Protection Attributes 379
Encapsulation..................................................................................................................... 380
Protection attributes ....................................................................................................... 380
Definition .............................................................................................................................. 381
Module imports are private by default ..................................................................... 381
When to use encapsulation .......................................................................................... 382
Example .................................................................................................................................383
61. Universal Function Call Syntax (UFCS) 385
62. Properties 388
Calling functions without parentheses ................................................................... 388
Property functions that return values ..................................................................... 388
Property functions that are used in assignment ................................................. 389
Properties are not absolutely necessary ................................................................. 390
When to use.......................................................................................................................... 391
63. Contract Programming for Structs and Classes 393
Preconditions and postconditions for member functions...............................393

xii
Preconditions and postconditions for object consistency .............................. 394
invariant() blocks for object consistency...........................................................395
Contract inheritance ....................................................................................................... 396
Summary.............................................................................................................................. 398
64. Templates 399
Function templates ..........................................................................................................400
More than one template parameter.......................................................................... 401
Type deduction...................................................................................................................402
Explicit type specification .............................................................................................402
Template instantiation ................................................................................................... 403
Template specializations................................................................................................ 403
Struct and class templates ............................................................................................404
Default template parameters.......................................................................................406
Every template instantiation yields a distinct type............................................407
A compile-time feature...................................................................................................407
Class template example: stack data structure ......................................................407
Function template example: binary search algorithm ..................................... 410
Summary...............................................................................................................................412
65. Pragmas 414
pragma(msg) .......................................................................................................................414
pragma(lib) .......................................................................................................................414
pragma(inline) ................................................................................................................414
pragma(startaddress).................................................................................................416
pragma(mangle) ................................................................................................................416
66. alias and with 418
alias .......................................................................................................................................418
with ........................................................................................................................................ 422
Summary.............................................................................................................................. 423
67. alias this 424
68. Pointers 425
The concept of a reference............................................................................................ 425
Syntax.................................................................................................................................... 427
Pointer value and the address-of operator & ......................................................... 428
The access operator * ...................................................................................................... 429
The . (dot) operator to access a member of the pointee................................... 429
Modifying the value of a pointer................................................................................ 430
Pointers are risky.............................................................................................................. 432
The element one past the end of an array .............................................................. 432
Using pointers with the array indexing operator [] ..........................................433
Producing a slice from a pointer ................................................................................ 434
void* can point at any type ..........................................................................................435
Using pointers in logical expressions........................................................................435
new returns a pointer for some types ....................................................................... 436
The .ptr property of arrays......................................................................................... 437
The in operator of associative arrays ...................................................................... 437
When to use pointers ...................................................................................................... 438
Examples .............................................................................................................................. 439
Exercises ............................................................................................................................... 444
69. Bit Operations 446
Representation of data at the lowest level.............................................................. 446

xiii
Binary number system ................................................................................................... 447
Hexadecimal number system...................................................................................... 448
Bit operations ..................................................................................................................... 450
Semantics............................................................................................................................. 454
Common uses ..................................................................................................................... 456
Exercises ............................................................................................................................... 458
70. Conditional Compilation 460
debug......................................................................................................................................460
version(tag) and version(level) ...................................................................... 463
Assigning identifiers to debug and version ......................................................... 464
static if............................................................................................................................ 464
static assert ................................................................................................................. 465
Type traits ............................................................................................................................ 466
Summary.............................................................................................................................. 467
71. is Expression 468
is (T) ................................................................................................................................... 468
is (T Alias) .................................................................................................................... 468
is (T : OtherT) ............................................................................................................ 469
is (T Alias : OtherT) ............................................................................................. 469
is (T == Specifier) .................................................................................................. 469
is (T identifier == Specifier) .......................................................................471
is (/* ... */ Specifier, TemplateParamList) ..................................... 472
72. Function Pointers, Delegates, and Lambdas 475
Function pointers ............................................................................................................. 475
Anonymous functions ....................................................................................................480
Delegates............................................................................................................................... 483
toString() with a delegate parameter............................................................... 487
Summary.............................................................................................................................. 489
73. foreach with Structs and Classes 491
foreach support by range member functions ......................................................491
foreach support by opApply and opApplyReverse member functions . 493
Loop counter ....................................................................................................................... 496
Warning: The collection must not mutate during the iteration ................... 498
Exercises ............................................................................................................................... 499
74. Nested Functions, Structs, and Classes 500
Summary.............................................................................................................................. 503
75. Unions 504
Anonymous unions.......................................................................................................... 505
Dissecting other members ............................................................................................ 505
Examples .............................................................................................................................. 506
76. Labels and goto 510
goto .........................................................................................................................................510
Loop labels ............................................................................................................................ 512
goto in case sections....................................................................................................... 512
Summary............................................................................................................................... 512
77. Tuples 513
Tuple and tuple() ........................................................................................................... 513
AliasSeq ............................................................................................................................... 516
.tupleof property............................................................................................................ 518
Summary............................................................................................................................... 519

xiv
78. More Templates 520
The shortcut syntax ......................................................................................................... 520
Kinds of templates.............................................................................................................522
Kinds of template parameters......................................................................................525
typeof(this), typeof(super), and typeof(return) ...................................533
Template specializations.................................................................................................534
Meta programming...........................................................................................................534
Compile-time polymorphism........................................................................................536
Code bloat..............................................................................................................................537
Template constraints........................................................................................................538
Using templates in multi-dimensional operator overloading ........................ 541
Summary.............................................................................................................................. 546
79. More Functions 547
Return type attributes..................................................................................................... 547
Behavioral attributes....................................................................................................... 550
Code safety attributes ...................................................................................................... 555
Compile time function execution (CTFE).................................................................556
Summary...............................................................................................................................558
80. Mixins 560
Template mixins................................................................................................................ 560
String mixins ...................................................................................................................... 562
Mixin name spaces........................................................................................................... 564
String mixins in operator overloading .....................................................................565
Mixed in destructors ........................................................................................................565
Importing text files........................................................................................................... 566
Example .................................................................................................................................567
81. Ranges 569
History................................................................................................................................... 569
Ranges are an integral part of D................................................................................. 570
Traditional implementations of algorithms.......................................................... 570
Phobos ranges ..................................................................................................................... 571
InputRange ..........................................................................................................................573
ForwardRange .................................................................................................................... 582
BidirectionalRange ..................................................................................................... 584
RandomAccessRange ........................................................................................................585
OutputRange ....................................................................................................................... 591
Range templates ................................................................................................................ 594
Summary.............................................................................................................................. 594
82. More Ranges 596
Range kind templates...................................................................................................... 596
ElementType and ElementEncodingType ............................................................ 599
More range templates ..................................................................................................... 599
Run-time polymorphism with inputRangeObject() and
outputRangeObject() ..................................................................................................600
Summary...............................................................................................................................601
83. static foreach 602
84. Parallelism 605
taskPool.parallel() ..................................................................................................607
Task ........................................................................................................................................608
taskPool.asyncBuf() ...................................................................................................612

xv
Another Random Document on
Scribd Without Any Related Topics
covered hill in the midst of forests. Two hundred coolies worked
forty-five days in clearing away vegetation and excavating the buried
terraces. Measurements and drawings were made, and twelve plates
from them accompany Sir Stamford Raffles’s work. After the Dutch
recovered possession of Java, their artists and archæologists gave
careful study to this monument of earlier civilization and arts. Further
excavations showed that the great platform or broad terrace around
the temple mass was of later construction than the body of the
pyramid, that a flooring nine feet deep had been put entirely around
the lower walls, presumably to brace them, and thus covering many
inscriptions the meanings of which have not yet been given, not to
English readers at least. Dutch scientists devoted many seasons to
the study of these ruins, and Herr Brumund’s scholarly text,
completed and edited by Dr. Leemans of Leyden, accompanies and
explains the great folio volumes of four hundred plates, after
Wilsen’s drawings, published by the Dutch government in 1874.
Since their uncovering the ruins have been kept free from
vegetation, but no other care has been taken. In this comparatively
short time legends have grown up, local customs have become
fixed, and Boro Boedor holds something of the importance it should
in its immediate human relations.
For more than six centuries the hill-temple was lost to sight,
covered with trees and rank vegetation; and when the Englishmen
brought the great sculptured monument to light, the gentle, easily
superstitious Javanese of the neighborhood regarded these recha—
statues and relics of the ancient, unknown cult—with the greatest
reverence. They adopted them as tutelary divinities, as it were,
indigenous to their own soil. While Wilsen lived there the people
brought daily offerings of flowers. The statue on the first circular
terrace at the right of the east staircase, and the secluded image at
the very summit, were always surrounded with heaps of stemless
flowers laid on moss and plantain-leaves. Incense was burned to
these recha, and the people daubed them with the yellow powder
with which princes formerly painted, and even humble bridegrooms
now paint, themselves on festal days, just as Burmese Buddhists
daub gold-leaf on their shrines, and, like the Cingalese Buddhists,
heap champak and tulse, jasmine, rose, and frangipani flowers,
before their altars. When questioned, the people owned that the
offerings at Boro Boedor were in fulfilment of a vow or in
thanksgiving for some event in their lives—a birth, death, marriage,
unexpected good fortune, or recovery from illness. Other worshipers
made the rounds of the circular terraces, reaching to touch each
image in its latticed bell, and many kept all-night vigils among the
dagobas of the Nirvana circles. Less appealing was the custom, that
grew up among the Chinese residents of Djokjakarta and its
neighborhood, of making the temple the goal of general pilgrimage
on the Chinese New Year’s day. They made food and incense
offerings to the images, and celebrated with fireworks, feasts, and a
general May-fair and popular outdoor fête.

THE LATTICED DAGOBAS ON THE CIRCULAR TERRACES.

After the temple was uncovered the natives considered it a free


quarry, and carried off carved stones for door-steps, gate-posts,
foundations, and fences. Every visitor, tourist or antiquarian, scientist
or relic-hunter, helped himself; and every residency, native prince’s
garden, and plantation lawn, far and near, is still ornamented with
Boro Boedor’s sculptures. In the garden of the Magelang Residency,
Miss Marianne North found a Chinese artist employed in “restoring”
Boro Boedor images, touching up the Hindu countenances with a
chisel until their eyes wore the proper Chinese slant. The museum at
Batavia has a full collection of recha, and all about the foundation
platform of the temple itself, and along the path to the passagrahan,
the way is lined with displaced images and fragments, statues, lions,
elephants, horses; the hansa, or emblematic geese of Buddhism; the
Garouda, or sacred birds of Vishnu; and giant genii that probably
guarded some outer gates of approach. A captain of Dutch hussars
told Herr Brumund that, when camping at Boro Boedor during the
Javanese war, his men amused themselves by striking off the heads
of statues with single lance- or saber-strokes. Conspicuous heads
made fine targets for rifle and pistol practice. Native boys, playing on
the terraces while watching cattle, broke off tiny heads and
detachable bits of carving, and threw them at one another; and a few
such playful shepherds could effect as much ruin as any of the
imaginary bands of fanatic Moslems or Brahmans. One can better
accept the plain, rural story of the boy herders’ destructiveness than
those elaborately built up tales of the religious wars, when priests
and people, driven to Boro Boedor as their last refuge, retreated,
fighting, from terrace to terrace, hurling stones and statues down
upon their pursuers, the last heroic believers dying martyrs before
the summit dagoba. Fanatic Mohammedans in other countries
doubtless would destroy the shrines of a rival, heretic creed; but
there is most evidence in the history and character of the Javanese
people that they simply left their old shrines, let them alone, and
allowed the jungle to claim at its will what no longer had any interest
or sacredness for them. To this day the Javanese takes his religion
easily, and it is known that at one time Buddhism and Brahmanism
flourished in peace side by side, and that conversion from one faith
to the other, and back again, and then to Mohammedanism, was
peaceful and gradual, and the result of suasion and fashion, and not
of force. The old cults faded, lost prestige, and vanished without
stress of arms or an inquisition.
XVI
BORO BOEDOR AND MENDOET

With five hundred Buddhas in near neighborhood, one might expect


a little of the atmosphere of Nirvana, and the looking at so many
repetitions of one object might well produce the hypnotic stage akin
to it. The cool, shady passagrahan at Boro Boedor affords as much
of earthly quiet and absolute calm, as entire a retreat from the outer,
modern world, as one could ever expect to find now in any land of
the lotus. This government rest-house is maintained by the resident
of Kedu, and every accommodation is provided for the pilgrim, at a
fixed charge of six florins the day. The keeper of the passagrahan
was a slow-spoken, lethargic, meditative old Hollander, with whom it
was always afternoon. One half expected him to change from battek
pajamas to yellow draperies, climb up on some vacant lotus
pedestal, and, posing his fingers, drop away into eternal meditation,
like his stony neighbors. Tropic life and isolation had reduced him to
that mental stagnation, torpor, or depression so common with single
Europeans in far Asia, isolated from all social friction, active, human
interests, and natural sympathies, and so far out of touch with the
living, moving world of the nineteenth century. Life goes on in
placidity, endless quiet, and routine at Boro Boedor. Visitors come
rarely; they most often stop only for riz tavel, and drive on; and not a
half-dozen American names appear in the visitors’ book, the first
entry in which is dated 1869.
I remember the first still, long lotus afternoon in the passagrahan’s
portico, when my companions napped, and not a sound broke the
stillness save the slow, occasional rustle of palm-branches and the
whistle of birds. In that damp, heated silence, where even the mental
effort of recalling the attitude of Buddha elsewhere threw one into a
bath of perspiration, there was exertion enough in tracing the
courses and projections of the terraced temple with the eye. Even
this easy rocking-chair study of the blackened ruins, empty niches,
broken statues, and shattered and crumbling terraces, worked a
spell. The dread genii by the doorway and the grotesque animals
along the path seemed living monsters, the meditating statues even
seemed to breathe, until some “chuck-chucking” lizard ran over them
and dispelled the half-dream.
In those hazy, hypnotic hours of the long afternoon one could best
believe the tradition that the temple rose in a night at miraculous
bidding, and was not built by human hands; that it was built by the
son of the Prince of Boro Boedor, as a condition to his receiving the
daughter of the Prince of Mendoet for a wife. The suitor was to build
it within a given time, and every detail was rigidly prescribed. The
princess came with her father to inspect the great work of art, with its
miles of bas-reliefs and hundreds of statues fresh from the sculptor’s
chisel. “Without doubt these images are beautiful,” she said coldly,
“but they are dead. I can no more love you than they can love you”;
and she turned and left her lover to brood in eternal sorrow and
meditation upon that puzzle of all the centuries—the Eternal
Feminine.
At last the shadows began to stretch; a cooler breath came;
cocoanut-leaves began to rustle and lash with force, and the musical
rhythm of distant, soft Malay voices broke the stillness that had been
that of the Sleeping Beauty’s enchanted castle. A boy crept out of a
basket house in the palm-grove behind the passagrahan, and
walked up a palm-tree with that deliberate ease and nonchalance
that is not altogether human or two-footed, and makes one rub his
eyes doubtingly at the unprepared sight. He carried a bunch of
bamboo tubes at his belt, and when he reached the top of the
smooth stem began letting down bamboo cups, fastening one at the
base of each leaf-stalk to collect the sap.
Everywhere in Java we saw them collecting the sap of the true
sugar-palm and the toddy-palm, that bear such gorgeous spathes of
blossoms; but it is only in this region of Middle Java that sugar is
made from the cocoa-palm. Each tree yields daily about two quarts
of sap that reduce to three or four ounces of sugar. The common
palm-sugar of the passers looks and tastes like other brown sugar,
but this from cocoa-palms has a delicious, nutty fragrance and flavor,
as unique as maple-sugar. We were not long in the land before we
learned to melt cocoa-palm sugar and pour it on grated ripe
cocoanut, thus achieving a sweet supreme.
The level valley about Boro Boedor is tilled in such fine lines that it
seems in perspective to have been etched or hatched with finer tools
than plow and hoe. There is a little Malay temple surrounded by
graves in a frangipani-grove near the great pyramid, where the
ground is white with the fallen “blossoms of the dead,” and the tree-
trunks are decked with trails of white and palest pink orchids. The
little kampong of Boro Boedor hides in a deep green grove—such a
pretty, picturesque little lot of basket houses, such a carefully painted
village in a painted grove,—the village of the Midway Plaisance, only
more so,—such a set scene and ideal picture of Java, as ought to
have wings and footlights, and be looked at to slow music. And
there, in the early summer mornings, is a busy passer in a grove that
presents more and more attractive pictures of Javanese life, as the
people come from miles around to buy and to sell the necessaries
and luxuries of their picturesque, primitive life, so near to nature’s
warmest heart.
All the neighborhood is full of beauty and interest, and there are
smaller shrines at each side of Boro Boedor, where pilgrims in
ancient times were supposed to make first and farewell prayers. One
is called Chandi Pawon, or more commonly Dapor, the kitchen,
because of its empty, smoke-blackened interior resulting from the
incense of the centuries of living faith, and of the later centuries
when superstitious habit, and not any surviving Buddhism, led the
humble people to make offerings to the recha, the unknown,
mysterious gods of the past.
THE RIGHT-HAND IMAGE AT MENDOET.

Chandi Mendoet, two miles the other side of Boro Boedor, is an


exquisite pyramidal temple in a green quadrangle of the forest, with
a walled foss and bridges. Long lost and hidden in the jungle, it was
accidentally discovered by the Dutch resident Hartman in 1835, and
a space cleared about it. The natives had never known of or
suspected its existence, but the investigators determined that this
gem of Hindu art was erected between 750 and 800 A. D. The
workmanship proves a continued progress in the arts employed at
Boro Boedor, and the sculptures show that the popular faith was
then passing through Jainism back to Brahmanism. The body of the
temple is forty-five feet square as it stands on its walled platform,
and rises to a height of seventy feet. A terrace, or raised
processional path, around the temple walls is faced with bas-reliefs
and ornamental stones, and great bas-reliefs decorate the upper
walls. The square interior chapel is entered through a stepped arch
or door, and the finest of the Mendoet bas-reliefs, commonly spoken
of as the “Tree of Knowledge,” is in this entrance-way. There Buddha
sits beneath the bo-tree, the trunk of which supports a pajong, or
state umbrella, teaching those who approach him and kneel with
offerings and incense. These figures, as well as the angels
overhead, the birds in the trees, and the lambs on their rocky shelf,
listening to the great teacher, are worked out with a grace and skill
beyond compare. Three colossal images are seated in the chapel, all
with Buddha’s attributes, and Brahmanic cords as well, and the long
Nepal ears of the Dhyani ones. They are variously explained as the
Hindu trinity, as the Buddhist trinity, as Buddha and his disciples, and
local legends try to explain them even more romantically. One
literary pilgrim describes the central Adi Buddha as the statue of a
beautiful young woman “counting her fingers,” the mild, benign, and
sweetly smiling faces of all three easily suggesting femininity.
One legend tells that this marvel of a temple was built by a rajah
who, when once summoned to aid or save the goddess Durga, was
followed by two of his wives. To rid himself of them, he tied one wife
and nailed the other to a rock. Years afterward he built this temple in
expiation, and put their images in it. An avenging rival, who had
loved one of the women, at last found the rajah, killed him, turned
him to stone, and condemned him to sit forever between his abused
partners.
A legend related to Herr Brumund told that “once upon a time” the
two-year-old daughter of the great Prince Dewa Kosoumi was stolen
by a revengeful courtier. The broken-hearted father wandered all
over the country seeking his daughter, but at the end of twelve years
met and, forgetting his grief, demanded and married the most
beautiful young girl he had ever seen. Soon after a child had been
born to them, the revengeful courtier of years before told the prince
that his beautiful wife was his own daughter. The priests assured
Prince Dewa that no forgiveness was possible to one who had so
offended the gods, and that his only course of expiation lay in
shutting himself, with the mother and child, in a walled cell, and there
ending their days in penitence and prayer. As a last divine favor, he
was told that the crime would be forgiven if within ten days he could
construct a Boro Boedor. All the artists and workmen of the kingdom
were summoned, and working with zeal and frenzy to save their
ruler, completed the temple, with its hundreds of statues and its
miles of carvings, within the fixed time. But it was then found that the
pile was incomplete, lacking just one statue of the full number
required. Prayers and appeals were useless, and the gods turned
the prince, the mother, and the child to stone, and they sit in the cell
at Mendoet as proof of the tale for all time.
With such interests we quite forgot the disagreeable episode in the
steaming, provincial town beyond the mountains, and cared not for
toelatings-kaart or assistant resident. Nothing from the outer world
disturbed the peace of our Nirvana. No solitary horseman bringing
reprieve was ever descried from the summit dagoba. No file of
soldiers grounded arms and demanded us for Dutch dungeons. Life
held every tropic charm, and Boro Boedor constituted an ideal world
entirely our own. The sculptured galleries drew us to them at the
beginning and end of every stroll, and demanded always another
and another look. A thousand Mona Lisas smiled upon us with
impassive, mysterious, inscrutable smiles, as they have smiled
during all these twelve centuries, and often the realization, the
atmosphere of antiquity was overpowering in sensation and weird
effect.
Boro Boedor is most mysterious and impressive in the gray of
dawn, in the unearthly light and stillness of that eerie hour. Sunrise
touches the old walls and statues to something of life; and sunset,
when all the palms are silhouetted against skies of tenderest rose,
and the warm light flushes the hoary gray pile, is the time when the
green valley of Eden about the temple adds all of charm and poetic
suggestion. Pitch-darkness so quickly follows the tropic sunset that
when we left the upper platform of the temple in the last rose-light,
we found the lamps lighted, and huge moths and beetles flying in
and about the passagrahan’s portico. Then lizards “chuck-chucked,”
and ran over the walls; and the invisible gecko, gasping, called, it
seemed to me, “Becky! Becky! Becky! Becky! Becky! Becky!” and
Rebecca answered never to those breathless, exhausted, appealing
cries, always six times repeated, slowly over and over again, by the
fatigued soul doomed to a lizard’s form in its last incarnation. There
was infinite mystery and witchery in the darkness and sounds of the
tropic night—sudden calls of birds, and always the stiff rustling,
rustling of the cocoa-palms, and the softer sounds of other trees, the
shadows of which made inky blackness about the passagrahan;
while out over the temple the open sky, full of huge, yellow, steadily
glowing stars, shed radiance sufficient for one to distinguish the
mass and lines of the great pyramid. Villagers came silently from out
the darkness, stood motionless beside the grim stone images, and
advanced slowly into the circle of light before the portico. They knelt
with many homages, and laid out the cakes of palm-sugar, the
baskets and sarongs, we had bought at their toy village. Others
brought frangipani blossoms that they heaped in mounds at our feet.
They sat on their heels, and with muttered whispers watched us as
we dined and went about our affairs on the raised platform of the
portico, presenting to them a living drama of foreign life on that
regularly built stage without footlights. One of the audience pierced a
fresh cocoanut, drank the milk, and then rolling kanari and benzoin
gum in corn-fiber, lighted the fragrant cigarette, and puffed the
smoke into the cocoa-shell. “It is good for the stomach, and will keep
off fever,” they answered, when we asked about this incantation-like
proceeding; and all took a turn at puffing into the shell and reinhaling
the incense-clouds. The gentle little Javanese who provided better
dinners for passagrahan guests than any island hotel had offered us,
came into the circle of light, with her mite of a brown baby sleeping in
the slandang knotted across her shoulder. The old landlord could be
heard as he came back far enough from his Nirvana to call for the
boy to light a fresh pipe; and one felt a little of the gaze and
presence of all the Dhyani Buddhas on the sculptured terraces in the
strange atmosphere of such far-away tropic nights by the Boedor of
Boro.
When we came “gree-ing” back by those beautiful roads to Djokja,
and drew up with a whirl at the portico of the Hotel Toegoe, the
landlord of beaming countenance ran to meet us, greet us with
effusion, and give us a handful of mail—long, official envelops with
seals, and square envelops of social usage.
“Your passports are here. They came the next day. They are so
chagrined that it was all a stupid mistake. The assistant resident at
Buitenzorg telegraphed to the resident here to tell the three
American ladies who were to arrive in Djokja that he had posted their
passports, and to have every attention paid you. He wished to
commend you and put you en rapport with the Djokja officials, that
you might enjoy their courtesies. Then the telegraph operator
changed the message so as not to have to send so many words on
the wire, and he made them all think you were some very dangerous
people whom they must arrest and send back. The assistant resident
knew there was some mistake as soon as he saw you.” (Did he?)
“He is so chagrined. And it was all the telegraph operator’s fault, and
you must not blame our Djokja Residency.”
Instead of mollifying, this rather irritated us the more, and the
assistant resident’s long, formal note was fuel to the flame.

“Ladies: This morning I telegraphed to the secretary-


general what in heaven’s name could be the reason you were
not to go to Djokja. I got no answer from him, but received a
letter from the chief of the telegraph, who had received a
telegram from the telegraph office of Buitenzorg, to tell me
there had been a mistake in the telegram. Instead of ‘The
permission is not given,’ there should have been written, ‘The
papers of permission I have myself this moment posted. Do
all you can in the matter,’ etc. Perhaps you will have received
them the moment you get this my letter.
“So I am so happy I did not insist upon your returning to
Buitenzorg, and so sorry you had so long stay at Boro
Boedor; and I hope you will forget the fatal mistake, and feel
yourself at ease now,” etc.

Evidently the little episode was confined to the bureau of


telegraphs entirely, the messages to the American consul, secretary-
general, and Buitenzorg resident all suppressed before reaching
them. Certainly this was no argument for the government ownership
and control of telegraphs in the United States. There were regrets
and social consolations offered, but no distinct apology; and we were
quite in the mood for having the American consul demand apology,
reparation, and indemnity, on pain of bombardment, as is the foreign
custom in all Asia. Pacification by small courtesies did not pacify.
Proffered presentation to native princes, visits to their bizarre
palaces, and attendance at a great performance by the sultan’s
actors, dancers, musicians, and swordsmen, would hardly offset
being arrested, brought up in an informal police-court, cross-
questioned, bullied, and regularly ordered to Boro Boedor under
parole. We would not remain tacitly to accept the olive-branch—not
then. The profuse landlord was nonplussed that we did not humbly
and gratefully accept these amenities.
“You will not go back to Buitenzorg now, with only such unhappy
experience of Djokja! Every one is so chagrined, so anxious that you
should forget the little contretemps. Surely you will stay now for the
great topeng [lyric drama], and the wedding of Pakoe Alam’s
daughter!”
“No; we have our toelatings-kaarten, and we leave on the noon
train.”
And then the landlord knew that we should have been locked up
for other reasons, since sane folk are never in a hurry under the
equator. They consider the thermometer, treat the zenith sun with
respect, and do not trifle with the tropics.
XVII
BRAMBANAM

“In the whole course of my life I have never met with such stupendous
and finished specimens of human labor and of the science and taste of
ages long since forgot, crowded together in so small a compass, as in this
little spot [Brambanam], which, to use a military phrase, I deem to have
been the headquarters of Hinduism in Java.” (Report to Sir Stamford
Raffles by Captain George Baker of the Bengal establishment.)

There are ruins of more than one hundred and fifty temples in the
historic region lying between Djokjakarta and Soerakarta, or Djokja
and Solo, as common usage abbreviates those syllables of
unnecessary exertion in this steaming, endless mid-summer land of
Middle Java. As the train races on the twenty miles from Djokja to
Brambanam, there is a tantalizing glimpse of the ruined temples at
Kalasan; and one small temple there, the Chandi Kali Bening, ranks
as the gem of Hindu art in Java. It is entirely covered, inside as well
as outside, with bas-reliefs and ornamental carvings which surpass
in elaboration and artistic merit everything else in this region, where
refined ornament and lavish decoration reached their limit at the
hands of the early Hindu sculptors. The Sepoy soldiers who came
with the British engineers were lost in wonder at Kalasan, where the
remains of Hindu art so far surpassed anything they knew in India
itself; while the extent and magnificence of Brambanam’s Brahmanic
and Buddhist temple ruins amaze every visitor—even after Boro
Boedor.
TEMPLE OF LORO JONGGRAN AT BRAMBANAM.

We had intended to drive from Boro Boedor across country to


Brambanam, but, affairs of state obliging us to return from our
Nirvana directly to Djokja, we fell back upon the railroad’s promised
convenience. In this guide-bookless land, where every white resident
knows every crook and turn in Amsterdam’s streets, and next to
nothing about the island of Java, a kind dispenser of misinformation
had told us that the railway-station of Brambanam was close beside
the temple ruins; and we had believed him. The railway had been
completed and formally opened but a few days before our visit, and
our Malay servant was also quite sure that the road ran past the
temples, and that the station was at their very gates.
When the train had shrieked away from the lone little station
building, we learned that the ruins were a mile distant, with no sort of
a vehicle nor an animal nor a palanquin to be had; and
archæological zeal suffered a chill even in that tropic noonday. The
station-master was all courtesy and sympathy; but the choice for us
lay between walking or waiting at the station four hours for the next
train on to Solo.
We strolled very slowly along the broad, open country road under
the deadly, direct rays of the midday sun,—at the time when, as the
Hindus say, “only Englishmen and dogs are abroad,”—reaching at
last a pretty village and the grateful shade of tall kanari-trees, where
the people were lounging at ease at the close of the morning’s busy
passer. Every house, shed, and stall had made use of carved temple
stones for its foundations, and the road was lined with more such
recha—artistic remains from the inexhaustible storehouse and
quarry of the neighboring ruins. Piles of tempting fruit remained for
sale, and brown babies sprawled content on the warm lap of earth,
the tiniest ones eating the green edge of watermelon-rind with
avidity, and tender mothers cramming cold sweet potato into the
mouths of infants two and four months old. There was such an easy,
enviable tropical calm of abundant living and leisure in that Lilliput
village under Brobdingnag trees that I longed to fling away my
“Fergusson,” let slip life’s one golden, glowing, scorching opportunity
to be informed on ninth-century Brahmanic temples, and, putting off
all starched and unnecessary garments of white civilization, join that
lifelong, happy-go-lucky, care-free picnic party under the kanari-trees
of Brambanam; but—
A turn in the road, a break in the jungle at one side of the highway,
disclosed three pyramidal temples in a vast square court, with the
ruins of three corresponding temples, all fallen to rubbish-heaps,
ranged in line facing them. These ruined piles alone remain of the
group of twenty temples dedicated to Loro Jonggran, “the pure,
exalted virgin” of the Javanese, worshiped in India as Deva, Durga,
Kali, or Parvati. Even the three temples that are best preserved have
crumbled at their summits and lost their angles; but enough remains
for the eye to reconstruct the symmetrical piles and carry out the
once perfect lines. The structures rise in terraces and broad courses,
tapering like the Dravidian gopuras of southern India, and covered,
like them, with images, bas-reliefs, and ornamental carvings. Grand
staircases ascend from each of the four sides to square chapels or
alcoves half-way up in the solid body of the pyramid, and each
chapel once contained an image. The main or central temple now
remaining still enshrines in its west or farther chamber an image of
Ganesha, the hideous elephant-headed son of Siva and Parvati.
Broken images of Siva and Parvati were found in the south and north
chambers, and Brahma is supposed to have been enshrined in the
great east chapel. An adjoining temple holds an exquisite statue of
Loro Jonggran, “the maiden with the beautiful hips,” who stands,
graceful and serene, in a roofless chamber, smiling down like a true
goddess upon those who toil up the long carved staircase of
approach. Her particular temple is adorned with bas-reliefs, where
the gopis, or houris, who accompany Krishna, the dancing youth, are
grouped in graceful poses. One of these bas-reliefs, commonly
known as the “Three Graces” has great fame, and one and two
thousand gulden have been vainly offered by British travelers
anxious to transport it to London. Another temple contains an image
of Nandi, the sacred bull; but the other shrines have fallen in
shapeless ruins, and nothing of their altar-images is to be gathered
from the rubbish-heaps that cover the vast temple court.
CLEARING AWAY RUBBISH AND VEGETATION AT BRAMBANAM TEMPLES.

The pity of all this ruined splendor moves one strongly, and one
deplores the impossibility of reconstructing, even on paper, the
whole magnificent place of worship. The wealth of ornament makes
all other temple buildings seem plain and featureless, and one set of
bas-reliefs just rescued and set up in line, depicting scenes from the
Ramayan, would be treasure enough for an art museum. On this
long series of carved stones disconsolate Rama is shown searching
everywhere for Sita, his stolen wife, until the king of the monkeys,
espousing his cause, leads him to success. The story is wonderfully
told in stone, the chisel as eloquent as the pen, and everywhere one
reads as plainly the sacred tales and ancient records. The graceful
figures and their draperies tell of Greek influences acting upon those
northern Hindus who brought the religion to the island; and the
beautifully conventionalized trees and fruits and flowers, the mythical
animals and gaping monsters along the staircases, the masks,
arabesques, bands, scrolls, ornamental keystones, and all the
elaborate symbols and attributes of deities lavished on this group of
temples, constitute a whole gallery of Hindu art, and a complete
grammar of its ornament.

KRISHNA AND THE THREE GRACES.

These temples, it is believed, were erected at the beginning of the


ninth century, and fixed dates in the eleventh century are also
claimed; but at least they were built soon after the completion of
Boro Boedor, when the people were turning back to Brahmanism,
and Hindu arts had reached their richest development at this great
capital of Mendang Kumulan, since called Brambanam. The fame of
the Javanese empire had then gone abroad, and greed for its riches
led Khublai Khan to despatch an armada to its shores; but his
Chinese commander, Mengki, returned without ships or men, his
face branded like a thief’s. Another expedition was defeated, with a
loss of three thousand men, and the Great Khan’s death put an end
to further schemes of conquest. Marco Polo, windbound for five
months on Sumatra, then Odoric, and the Arab Ibn Batuta, who
visited Java in the fourteenth century, continued to celebrate the
riches and splendor of this empire, and invite its conquest, until Arab
priests and traders began its overthrow. Its princes were conquered,
its splendid capitals destroyed, and with the conversion of the people
to Mohammedanism the shrines were deserted, soon overgrown,
and became hillocks of vegetation. The waringen-tree’s fibrous roots,
penetrating the crevices of stones that were only fitted together, and
not cemented, have done most damage, and the shrines of Loro
Jonggran went fast to utter ruin.
A Dutch engineer, seeking to build a fort in the disturbed country
between the two native capitals, first reported these Brambanam
temples in 1797; but it was left for Sir Stamford Raffles to have them
excavated, surveyed, sketched, and reported upon. Then for eighty
years—until the year of our visit—they had again been forgotten, and
the jungle claimed and covered the beautiful monuments. The
Archæological Society of Djokja had just begun the work of clearing
off and rescuing the wonderful carvings, and groups of coolies were
resting in the shade, while others pottered around, setting bas-reliefs
in regular lines around the rubbish-heaps they had been taken from.
This salvage corps chattered and watched us with well-contained
interest, as we, literally at the very boiling-point of enthusiasm, at
three o’clock of an equatorial afternoon, toiled up the magnificent
staircases, peered into each shrine, made the rounds of the
sculptured terraces, or processional paths, and explored the whole
splendid trio of temples, without pause.
Herr Perk, the director of the works, and curator of this
monumental museum, roused by the rumors of foreign invasion,
welcomed us to the grateful shade of his temporary quarters beside
the temple, and hospitably shared his afternoon tea and bananas
with us, there surrounded by a small museum of the finest and most
delicately carved fragments, that could not safely be left unprotected.
While we cooled, and rested from the long walk and the eager
scramble over the ruins, we enjoyed too the series of Cephas’s
photographs made for the Djokja Society, and in them had evidence
how the insidious roots of the graceful waringen-trees had split and
scattered the fitted stones as thoroughly as an earthquake; yet each
waringen-gripped ruin, the clustered roots streaming, as if once
liquid, over angles and carvings, was so picturesque that we half
regretted the entire uprooting of these lovely trees.

LORO JONGGRAN AND HER ATTENDANTS.

When the director was called away to his workmen, we bade our
guiding Mohammedan lead the way to Chandi Sewou, the
“Thousand Temples,” or great Buddhist shrine of the ancient capital.
“Oh,” he cried, “it is far, far from here—an hour to walk. You must go
to Chandi Sewou in a boat. The water is up to here,” touching his
waist, “and there are many, many snakes.” Distrusting, we made him
lead on in the direction of Chandi Sewou; perhaps we might get at
least a distant view. When we had walked the length of a city block
down a shady road, with carved fragments and overgrown stones
scattered along the way and through the young jungle at one side,
we turned a corner, walked another block, and stood between the
giant images that guard the entrance of Chandi Sewou’s great
quadrangle.
The “Thousand Temples” were really but two hundred and thirty-
six temples, built in five quadrilateral lines around a central cruciform
temple, the whole walled inclosure measuring five hundred feet
either way. Many of these lesser shrines—mere confessional boxes
in size—are now ruined or sunk entirely in the level turf that covers

You might also like