Delphi Quick Syntax Reference: A Pocket Guide to the Delphi and Object Pascal Language 1st Edition John Kouraklis - Download the ebook and explore the most detailed content
Delphi Quick Syntax Reference: A Pocket Guide to the Delphi and Object Pascal Language 1st Edition John Kouraklis - Download the ebook and explore the most detailed content
com
https://ebookmeta.com/product/delphi-quick-syntax-reference-
a-pocket-guide-to-the-delphi-and-object-pascal-language-1st-
edition-john-kouraklis/
OR CLICK HERE
DOWLOAD EBOOK
https://ebookmeta.com/product/c-10-quick-syntax-reference-a-pocket-
guide-to-the-language-apis-and-library-mikael-olsson/
ebookmeta.com
https://ebookmeta.com/product/r-quick-syntax-reference-2nd-edition-a-
pocket-guide-to-the-language-apis-and-library-margot-tollefson/
ebookmeta.com
https://ebookmeta.com/product/css3-quick-syntax-reference-2nd-edition-
a-pocket-guide-to-the-cascading-style-sheets-language-mikael-olsson/
ebookmeta.com
https://ebookmeta.com/product/power-of-love-1st-edition-piper-cook/
ebookmeta.com
Stealing Atlanta Cary Allen Stone
https://ebookmeta.com/product/stealing-atlanta-cary-allen-stone/
ebookmeta.com
https://ebookmeta.com/product/tempest-tide-avalar-explored-03-1st-
edition-deacon-frost-2/
ebookmeta.com
https://ebookmeta.com/product/english-fiction-of-the-romantic-
period-1789-1830-1st-edition-gary-kelly/
ebookmeta.com
https://ebookmeta.com/product/scientific-american-mind-scientific-
american/
ebookmeta.com
https://ebookmeta.com/product/rick-steves-berlin-4th-edition-rick-
steves/
ebookmeta.com
Occupational Safety and Health in the Emergency Services
5th Edition James Angle
https://ebookmeta.com/product/occupational-safety-and-health-in-the-
emergency-services-5th-edition-james-angle/
ebookmeta.com
Delphi
Quick Syntax
Reference
A Pocket Guide to the Delphi and
Object Pascal Language
—
John Kouraklis
www.allitebooks.com
Delphi Quick Syntax
Reference
A Pocket Guide to the Delphi
and Object Pascal Language
John Kouraklis
www.allitebooks.com
Delphi Quick Syntax Reference: A Pocket Guide to the Delphi and Object
Pascal Language
John Kouraklis
London, UK
www.allitebooks.com
Table of Contents
About the Author��������������������������������������������������������������������������������vii
About the Technical Reviewer�������������������������������������������������������������ix
Introduction�����������������������������������������������������������������������������������������xi
iii
www.allitebooks.com
Table of Contents
Chapter 2: Basics�������������������������������������������������������������������������������17
Variables�������������������������������������������������������������������������������������������������������������17
Data Types�����������������������������������������������������������������������������������������������������������20
Integer�����������������������������������������������������������������������������������������������������������20
Char���������������������������������������������������������������������������������������������������������������21
Boolean����������������������������������������������������������������������������������������������������������22
Enumerated Types�����������������������������������������������������������������������������������������22
Subrange�������������������������������������������������������������������������������������������������������23
Real���������������������������������������������������������������������������������������������������������������23
Strings�����������������������������������������������������������������������������������������������������������25
Sets���������������������������������������������������������������������������������������������������������������27
Arrays������������������������������������������������������������������������������������������������������������28
Records���������������������������������������������������������������������������������������������������������31
Pointers���������������������������������������������������������������������������������������������������������35
Variant�����������������������������������������������������������������������������������������������������������36
Generics��������������������������������������������������������������������������������������������������������37
Constants������������������������������������������������������������������������������������������������������������40
Comments�����������������������������������������������������������������������������������������������������������41
Summary������������������������������������������������������������������������������������������������������������42
References����������������������������������������������������������������������������������������������������������42
iv
www.allitebooks.com
Table of Contents
Jump Statements������������������������������������������������������������������������������������������������51
Exit Statement�����������������������������������������������������������������������������������������������51
Break Statement��������������������������������������������������������������������������������������������52
Continue Statement���������������������������������������������������������������������������������������52
Goto Statement����������������������������������������������������������������������������������������������53
Summary������������������������������������������������������������������������������������������������������������54
v
Table of Contents
Index�������������������������������������������������������������������������������������������������103
vi
About the Author
John Kouraklis started exploring computers when he was 16 and since
then has followed all the way from Turbo Pascal to the latest Delphi
versions as a hobby initially and as a profession for most of his adult life.
He has developed a wide range of applications, from financial software
to reverse engineering tools, including an application for professional
gamblers.
He is part of the Delphi community and participates in online
communities, forums, and many other events. For example, he is active
on Delphi-PRAXiS, which is perhaps the biggest English-speaking online
forum about Delphi. John also has a personal website where he posts
articles regularly. Lastly, he has written two more books about Delphi
published by Apress.
vii
About the Technical Reviewer
Dr. Holger Flick studied computer science at the Technical University
of Dortmund and received his doctorate from the Faculty of Mechanical
Engineering at the Ruhr-University Bochum. He has been programming
with Delphi since 1996 and has always been active in the community.
During and after his studies, he worked as a freelancer on numerous
projects for Borland and was able to exchange ideas directly with many
Delphi experts from Scotts Valley, CA. Mainly, he tested Delphi for the
QA department, but also programmed database applications and web
applications for the Borland Developer Network. Holger has also presented
at conferences and seminars on various Delphi topics. His commitment
and extensive knowledge of Delphi programming, gained through years of
theoretical and practical work in the area of object-oriented programming
with Delphi and other programming languages (e.g., C#, Objective-C), led
to his appointment as the Embarcadero Delphi MVP in 2016. From 2013 to
2018, Dr. Holger Flick was responsible for the entire software and hardware
architecture of a medium-sized business in Witten, Germany.
Among other things, he developed company-specific software
solutions with Delphi. Since 2017, he presents products and solutions
of TMS software as Chief Evangelist in the form of numerous technical
articles, bilingual video tutorials, and leads through seminars. In 2019,
he founded FlixEngineering LLC in the United States and is available for
Delphi contracting of any kind. The next year, he self-published several
books himself for web and desktop software development with Delphi.
ix
Introduction
Delphi is a modern general-purpose programming language which
enhances and supersedes Object Pascal. It is in the market for more
than two decades now, and it is used in a wide range of applications.
The language is maintained by Embarcadero and is backed by a large
community of developers.
The language is versatile, it supports different programming
paradigms, and it exhibits quick learning curve. It is easy to grasp the
main and fundamental concepts and start coding straightaway. Naturally,
as in every language, there is complexity down the line especially when
advanced libraries are utilized.
This book offers a guide to the fundamentals. It takes people with no
knowledge of the language all the way to what they need to know to start
their journey in Delphi. By the end of this book, you will have enough
knowledge to be able to read articles about Delphi and understand code
of intermediate complexity. In short, this book offers a fast-track induction
course to the language.
xi
Introduction
I use the Professional edition, but there is nothing I do that exploits any
features specific to this edition. The code can be tested using even the free
Community Edition of Delphi. In fact, most of the code can be executed in
other editions of Object Pascal.
There are some topics that utilize features found in specific versions of
Delphi. Whenever this happens, I clearly flag the topics.
xii
Introduction
C
hapter 1: Delphi Pascal
This chapter looks at Delphi as a programming language. It discusses the
syntax and structure of the code, and it introduces the basic development
workflow Delphi developers follow.
C
hapter 2: Basics
The second chapter provides the fundamental knowledge a newcomer
needs to get an understanding of how basic concepts in programming
work in Delphi. Variables, data types, and generics are introduced.
C
hapter 3: Looping, Conditional and Jump
Statements
Managing the execution flow of code in Delphi is the topic of this chapter.
Common structures like loops, conditional statements, and code jumps
are covered to provide to the reader different ways to control logic in code.
C
hapter 4: Procedures and Functions
In this chapter, we move to modular programming. We visit procedures
and functions and investigate the way they are implemented and used in
Delphi.
C
hapter 5: Object-Oriented Programming (OOP)
OOP is one of the most fundamental and widespread paradigms in
modern software development. In this chapter, we look at how OOP is
done in Delphi and expand the discussion to cover interfaces, another core
concept of contemporary programming.
xiii
Introduction
C
ode Files
This book includes source code files that can be accessed via the
Download Source Code link located at www.apress.com/9781484261118.
The projects are named after the number of the chapter (ChapterXX) they
refer to. There is also a dedicated project group which loads all the projects
for all chapters. You can find it under the name DelphiQuickReference.
groupproj.
xiv
CHAPTER 1
Delphi Pascal
Delphi Pascal or, simply, Delphi is the most popular version of Object Pascal
which, in turn, is an extension of the classic Pascal programming language
(Cantu, 2016). This chapter introduces the basic concepts of the language.
S
yntax
If you look at Delphi source code, you will notice that it is dominated by
words rather than symbols. Code appears inside a begin...end block
rather than inside symbols like curly brackets ({..}) as in other languages.
Typically, code flows from top to bottom and from left to right. This
implies that variables, objects, constants, and other elements need
first to be declared before they are used (with the exception of forward
declaration of classes).
Programming Paradigms
Delphi is a fully developed object-oriented programming (OOP) language
but does not force any specific development paradigm. You are free to
use the OOP approach, but if, for some reasons, you prefer to use pure
procedural programming, Delphi can fully support you. In fact, a huge part
of the native libraries in Delphi come as procedures rather than embedded
in objects and classes. This stands for Windows API calls, but, as the
language is moving to cross-platform code, more libraries come in classes
and records.
2
Chapter 1 Delphi Pascal
Visual Applications
Delphi provides two out-of-the-box frameworks to support the
development of visual applications: the Visual Component Library (VCL)
and, starting from Delphi XE2, the FireMonkey (FMX) framework. VCL
is used for Windows applications only, and FMX provides cross-platform
components to build graphical user interfaces. Apart from VCL and FMX,
there are third-party frameworks and libraries available to enrich the
development of visual applications.
3
Chapter 1 Delphi Pascal
and Linux 64-bit. It is worth mentioning that although you can create
applications for all the preceding platforms, the development is done on
Windows only; that is, the compilers are Windows programs themselves.
Project Files
A program in Delphi has one source code file saved under the name of the
application and with the .dpr extension. The code starts with the program
keyword followed by the name of the application, and it has one main block
of code enclosed in the begin..end keywords. The last end keyword is
followed by a period (end.), and this signifies the end of the code file. Any text
that appears after this generates a warning, but it is ignored by the compiler.
Delphi also generates a file with the .dproj extension. This file holds
vital information about the cross-platform configurations, and it can also
be used when the compilation of code is streamlined to MSBUILD.
There are a number of other support files with different extensions
(e.g., .local, .deployproj) you may find, but they are not vital for the
correct compilation of a Delphi program, or the compiler can regenerate
them automatically.
4
Chapter 1 Delphi Pascal
Units
You can, very easily, create one big file and store all your code in it (with
the exception of visual elements like forms and frames). Delphi will not
complain and will compile your code correctly. However, this does not
sound something that scales up easily when you write complex software.
Instead, common practice suggests to organize your code in smaller
separate files or modules as they are known in software engineering.
Delphi is a modular language and provides support to modules via
unit files. In Pascal world, the term unit is used instead of module. The
term module still exists in Delphi, and it refers to a special component
(TDataModule) which sits in its own separate unit file. A unit is a separate
code file, it has the .pas extension, and it is linked back to the project
and is compiled to a binary file with the extension .dcu. DCUs are more
important than the source code files because the compiler is able to use
a .dcu file without the need to locate and access the corresponding .pas
file. The downside is that DCU files are tightly linked to the version of the
compiler that was used to create them. There were some exceptions in the
past, but this is the general rule.
The following snippet shows the minimum elements you can find in
a unit file (which, basically, does nothing). There are two distinct parts—
interface and implementation. The interface section is the part of the
unit that is visible to other units. For example, if you declare a variable in
this section, it will be accessible to any other units that refer to this unit. On
the other hand, any declarations made in the implementation section are
only available in this unit and not outside it. When it comes to OOP, classes
are typically declared in the interface section, and any method code
should appear in the implementation section in the same unit. Of course,
you can have the declaration and implementation of a class solely in the
implementation section, but it will be accessible only within the unit.
5
Chapter 1 Delphi Pascal
unit QuickReference;
interface
implementation
end.
This unit is named QuickReference, and the file name is and should
be under the same name (QuickReference.pas). Delphi allows the use of
dot notation in units which provides the ability to generate namespaces. As
a result, you can save the unit under the name Quick.Reference.Delphi.
pas. When you want to access the unit, you simply declare it using the
keyword uses as follows:
uses
Quick.Reference.Delphi;
6
Chapter 1 Delphi Pascal
Frames are very similar to forms with the difference that they do not
represent stand-alone windows and they do not have system menus and
icons. A frame can be embedded in forms or in other frames to build more
complex and reusable user interfaces. In terms of files, frames use the
same file structure as forms.
7
Chapter 1 Delphi Pascal
Figure 1-1. The Code View of Delphi IDE (Delphi 10.4 Sydney)
Figure 1-2. The Form Designer in RAD Studio (Delphi 10.4 Sydney)
8
Chapter 1 Delphi Pascal
program Cheers;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
begin
try
{ TODO -oUser -cConsole Main : Insert code here }
Writeln('Hey Delphi, Cheers!');
Writeln('Press Enter');
Readln;
9
Chapter 1 Delphi Pascal
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
Debugging is done inside the IDE as well. You can set a breakpoint at a
code line by clicking the gutter area in the text editor. When a breakpoint is
set, a red circle appears as shown in Figure 1-4. This area is the gutter area
of the editor.
10
Chapter 1 Delphi Pascal
Run again the project by pressing F9. This time the execution will stop
at the line with the breakpoint, and you will be able to step through the
code gradually by using the debugger buttons in the toolbar.
11
Chapter 1 Delphi Pascal
12
Chapter 1 Delphi Pascal
13
Chapter 1 Delphi Pascal
Alternative IDEs
As mentioned earlier, Delphi development is done in Delphi IDE, which
comes together with the compilers. The only other alternative to write pure
Delphi code is to use Visual Studio Code with the OmniPascal extension
(OmniPascal, 2020). OmniPascal adds to Visual Studio Code the capability
to understand Delphi syntax and then to compile, debug, and run Delphi
programs. The only downside is that it does not offer a form designer,
which means that the Delphi IDE remains the only way to develop
graphical applications in Delphi.
If we open the scope of the IDE and look at the domain of Object
Pascal more broadly, there is another IDE worth mentioning. The Free
Pascal community offers Lazarus (Lazarus, 2020) which is a cross-platform
open source IDE. Lazarus is highly compatible with Delphi, but it is
primarily made to support Free Pascal—another flavor of Object Pascal.
14
Chapter 1 Delphi Pascal
S
ummary
In this chapter, we started with a very basic introduction of Delphi as
a programming language. Then, we touched upon RAD Studio, the
integrated environment that is, almost exclusively, used to develop Delphi
software. In the next chapter, we review the basic elements of the language.
R
eferences
Calvert, C., n.d.. Object Pascal Style Guide. [Online] Available at: http://
edn.embarcadero.com/article/10280#2.0 [Accessed 27 04 2020].
Cantu, M., 2016. Object Pascal Handbook. s.l.:s.n.
Embarcadero, 2020. RAD Studio Product Page. [Online] Available at:
www.embarcadero.com/products/rad-studio [Accessed 08 04 2020].
Embarcadero, n.d. RAD Studio Rio. [Online] Available at: http://
docwiki.embarcadero.com/RADStudio/Rio/en/Main_Page [Accessed 08
04 2020].
15
Chapter 1 Delphi Pascal
16
CHAPTER 2
Basics
V
ariables
Variables, a term borrowed from mathematics, is what we use in software
development to store data that change in the course of a program. It
is, practically, hard to write code without using variables. Technically
speaking, variables represent memory addresses, and they have two
elements: an identifier and a data type.
The identifier is a convenient name that is used to access the value
of the variable, and the data type defines what sort of data the variable
holds. Delphi is a strongly and statically typed language. Strongly typed
means that the developer defines the (data) type of the variable, and the
variable cannot hold any other data type than the one defined; statically
typed means that the data type is imposed at compile time rather than at
runtime.
As an example, consider a variable that holds the age of a person.
In Delphi, we define a variable using the keyword var followed by the
identifier (name), a colon, and the data type. Traditionally, variables in
Delphi are declared before the main block of a program or a method. Of
course, all the conventions for naming identifiers and code lines apply
(naming conventions, capitalization, and the use of semicolon at the end
of the code line).
Building on the example from the previous chapter, we define our new
variable as it is shown in the following code (for simplicity, I have removed
the {..} text and the try...except block code):
program Cheers;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
var
age: Integer;
begin
Writeln('Hey Delphi, Cheers!');
Writeln('Press Enter');
Readln;
age:=30;
end.
...
begin
Writeln('Hey Delphi, Cheers!');
Writeln('Press Enter');
Readln;
18
Chapter 2 Basics
age:=age + 10;
end.
Starting with Delphi 10.3 Rio, developers are able to declare variables
inside block codes (inline variables) and assign values directly. The code
now becomes as follows:
...
begin
Writeln('Hey Delphi, Cheers!');
Writeln('Press Enter');
Readln;
var age:Integer :=30;
end.
var age:=30;
19
Chapter 2 Basics
D
ata Types
I nteger
In Delphi, there is a good number of integer types that can be used
depending on how big you expect the number to be, whether you want
to carry the sign or not (signed/unsigned) and the target platform of the
application (Tables 2-1 and 2-2).
20
Chapter 2 Basics
Char
The Char data type represents a single character. For historical reasons,
when Unicode characters and strings were added to Delphi, a whole range
of char (and string) types was introduced to accommodate the different
requirements of non-Unicode and Unicode characters (and strings). This
led to some confusion among developers.
Modern Delphi development does not really look at such differences
(unless a very old compiler is used), and the data type char can be safely
used in desktop and mobile applications to handle Unicode characters.
21
Chapter 2 Basics
Boolean
Boolean values represent two states: True and False. As in the case of char
type, there are more than one Boolean types to facilitate communication
with other languages and operating systems, but, again, the vast majority of
code does not use them. True Boolean value translates to 1 and false to 0.
Enumerated Types
Enumerated types need to be defined before used as data types in
variables. They are truly custom data type to fit the needs of the developer.
The values bear no meaning to the compiler and can be used to improve
readability and increase abstraction. Enumerated type can be defined as in
the following examples:
type
TAnswer = (aYes, aNo);
TChapter = (cChapter01, cChapter02, cChapter3, cChapter4);
var
consent: TAnswer;
currentChapter: TChapter;
begin
consent:=aYes;
currentChapter:=cChapter02;
end.
22
Chapter 2 Basics
S
ubrange
Subrange is a very handy data type. It provides the ability to declare data
types as a range (Low..High), and it is related to another (predefined) data
type. The code snippet that follows defines a subrange that represents the
adult ages and some chapters from the TChapter enumerated type:
Type
TMyCoinsAge = 10..High(Byte);
TMainPart = cChapter02..cChapter04;
type
TExperimentTemp = -10..3 * (20 + 5);
R
eal
This data type represents a floating-point number (decimal) of different
precision. Table 2-3 presents the available real data types in Delphi.
23
24
Chapter 2
Decimal Digits
Strings
Strings represent a sequence of characters. The transition to Unicode led
to a number of string data types. Similarly to the case of char, modern
development does not consider the different types, and we just use the
type string (unless an older compiler is used or there are other more
specific requirements).
...
var
name: string;
begin
name:='Delphi';
var surname:='Quick Reference Guide';
end.
As you can see from the preceding code, strings in Delphi are enclosed
in single quotes ('').
If you want to print a single quote, then you have to escape it by using
two single quotes (not double quote mark) as in the following example:
begin
...
Writeln('Delphi''s fantastic world!');
...
end.
25
Chapter 2 Basics
Writeln(name[1]);
Writeln(name[0]);
This approach means that you need to differentiate the code based on
the platform you are compiling. There is another way to go around this.
You can use the function Low to allow the compiler to figure out the correct
starting index:
Writeln(name[low(name)]);
26
Chapter 2 Basics
Sets
Sets are an extremely convenient way to manage groups of elements of the
same data type. A set is defined in relation to an enumerated data type.
Earlier when we discussed enumerated types, we defined TChapter. Now,
we need a set to represent the chapters we have read. We do this with the
following declarations:
type
TChapter = (cChapter01, cChapter02, cChapter3, cChapter4);
TChaptersRead = set of TChapter;
var
progress: TChaptersRead;
begin
progress:=[cChapter01, cChapter02];
end.
27
Another Random Document on
Scribd Without Any Related Topics
Malachean Orphan Society, where O'Connell presided, but having
indulged in his potations at a luncheon, he forgot the requirement
for his services at Mrs. Mahony's great rooms in Patrick Street. "I
slept," said he, "until about 11 o'clock, and then I recollected myself,
so I went quietly to the office and got the file of the previous year,
and, with a little alteration, it did for the day's dinner as well." He
often mentioned what he designated his greatest mistake. He
described it thus:—"On the concluding day of George the Fourth's
visit, in 1821, he went to Powerscourt, where he got a splendid
reception from the noble proprietor. Lord Powerscourt had caused
reservoirs to be constructed above the waterfall, in order that when
his Majesty went to see it, the sluices might be drawn, and a
tremendous cataract produced. I went down in the morning and
viewed the place, and minutely noted all the preparations. I then
drew on my imagination for a description of a second Niagara, and
put into the mouth of the royal visitor various exclamations of delight
and surprise. I sent off my report, and it appeared in due time, but
unfortunately the king was too much hurried by other arrangements,
and did not go to the Waterfall at all, but drove direct from
Powerscourt House to Kingstown, where he embarked. I have been
often quizzed for my imaginative report, but, nevertheless, I stated
what the King ought to have done, and what he ought to have said,
and if he did otherwise, it was not my fault."
I was extremely fortunate, at my accession to magisterial office, to
find myself provided with clerks who could not be surpassed in
diligence, integrity, or intelligence. I shall particularize Messrs.
Pemberton and Cox. The former was the son of a previous chief
magistrate, at whose instance he was appointed. The latter had
been for several years in America, and had been engaged by Jacob
Philip Astor in forming the settlement of Astoria, in Washington
Irvine's description of which he is most favorably mentioned. He was
a man of great literary taste, and was an accomplished linguist.
Their performance of official duties never required from me, nor to
my knowledge from any of my colleagues, the slightest correction or
reproof. Pemberton was a solicitor, and was promoted in 1846 to the
Clerkship of the Crown for the King's County. He had been many
years before an assistant to Messrs. Allen and Greene, the Clerks of
the Peace for the City of Dublin. I shall have to notice hereafter
some amusing incidents connected with Cox, but shall give
precedence to a few anecdotes derived from Pemberton, and arising
from his acquaintance with the old Session House in Green Street,
and the records there, to which, I suppose, he had full access.
Towards the close of the last century an aid-de-camp of the then
viceroy was indicted, at the Quarter Sessions, for the larceny of a
handsome walking-stick, and also for assaulting the gentleman who
owned it, and who was, moreover, a Frenchman. The transaction
arose in a house of a description unnecessary to be particularized.
An affray took place, the Frenchman was kicked down stairs, and
lost his cane, which was alleged to have been wrested from him by
the aid-de-camp. The charge of larceny was absurd, and the grand
jury ignored the indictment. But the assault could neither be denied
nor justified, and the traverser submitted, pleaded "guilty," and was
fined five pounds. That punishment did not cure his propensity for
beating Frenchmen and taking their sticks. On the 21st of June,
1813, he beat Marshal Jourdan at Vittoria, and captured his baton;
and on the 18th of June, 1815, at Waterloo, he beat the greatest
Frenchman that ever lived, Napoleon Bonaparte. I do not feel
justified in naming the delinquent aid-de-camp, and perhaps the
reader may think it quite unnecessary that I should.
More than half a century has elapsed since the office of Recorder of
Dublin was held by Mr. William Walker, whose town residence was in
Lower Dominick Street. One day a groom, in the service of a Mr.
Gresson, was tried before him, for stealing his master's oats. The
evidence was most conclusive, for the culprit had been detected in
the act of taking a large bag of oats out of his master's stable, which
was in the lane at the back of the east side of Dominick Street.
When the prisoner was convicted, the Recorder addressed him to
the following effect:—"The sentence of the Court is, that you are to
be imprisoned for three calendar months; and at the
commencement of that term you are to be publicly whipped from
one end of that lane to the other, and back again; and in the last
week of your imprisonment, you are to be again publicly whipped
from one end of that lane to the other, and back again; for I am
determined, with the help of Providence, to put a stop to oat-
stealing in that lane." His worship's emphatic denunciation of oat-
stealing in that lane, arose from the circumstance of his own stable
being the next door to Mr. Gresson's.
The same civic functionary was a great amateur farmer. He had a
villa and some acres of land at Mount Tallant, near Harold's Cross,
and prided himself upon his abundant crops of early hay. On one
occasion he entered the court to discharge his judicial duties at an
adjourned sessions, and was horrified at hearing from the acting
Clerk of the Peace (Mr. Pemberton) that there were upwards of
twenty larceny cases to be tried. "Oh!" said he, "this is shocking. I
have three acres of meadow cut, and I have no doubt that the
haymaking will be neglected or mismanaged in my absence." In a
few minutes, he inquired in an undertone, "Is there any old offender
on the calendar?"
"Yes," was the reply, "there is one named Branagan, who has been
twice convicted for ripping lead from roofs, and he is here now for a
similar offence, committed last week in Mary's Abbey."
"Send a turnkey to him," said the Recorder, "with a hint that, if he
pleads guilty, he will be likely to receive a light sentence."
These directions were complied with, and the lead-stealer was put to
the bar and arraigned.
"Are you guilty or not guilty?"
"Guilty, my lord."
"The sentence of the court is that you be imprisoned for three
months. Remove him."
Branagan retired, delighted to find a short imprisonment substituted
for the transportation that he expected. As he passed through the
dock, he was eagerly interrogated by the other prisoners—
"What have you got?"
"Three months."
"Three months—only three months!" they exclaimed; "Oh! but we're
in luck. His lordship is as mild as milk this morning. It's seldom that
he's in so sweet a humour."
"Put forward another," said the Recorder.
"Are you guilty or not guilty?"
"Guilty, my lord."
"Let the prisoner stand back, and arraign the next."
Accordingly, the prisoners were rapidly arraigned, and the same plea
of "Guilty" recorded in each case. Presently it was signified to his
lordship that the calendar was exhausted. All the thieves had
pleaded guilty.
"Put the prisoners to the front of the dock," said he; and they were
mustered as he directed. He then briefly addressed them—
"The sentence of the court is that you and each of you be
transported for seven years. Crier, adjourn the court."
Branagan had been thrown as a sprat, and had caught the other fish
abundantly. This incident might afford a useful, or perhaps it should
be termed, a convenient suggestion, to other judicial functionaries,
especially on circuit when there is a crowded dock.
When Mr. Pemberton received the appointment of Clerk of the Crown
for the King's County, Mr. Cox, who had been for several years the
second clerk in the Head Police Office, succeeded to the chief
clerkship. He possessed very extensive knowledge of the world, and
was highly educated. Many incidents connected with him are worthy
of being recorded. I may mention here that the Police Laws of the
Irish Metropolitan district are, to the highest degree, complex,
voluminous, involved, and perplexing. In the English Metropolitan
district two statutes regulate, one the Police Force, and the other the
Police Courts. In Dublin we have a statute passed in 1808, another
in 1824, a third in 1836, a fourth in 1837, a fifth in 1838, a sixth in
1839, a seventh in 1842, and an Act in relation to public carriages,
which may also be termed a police statute, in 1848. They contain
three hundred and sixty-six sections, and may be designated as
disgraceful to the several executive governments which have left
them unconsolidated and uncodified. When the 5th Vic. sess. 2,
Chap. 24, passed, it recited the other Acts to which I have alluded,
and then its preamble proceeds to heap or bundle them all together
in the following terms:—
Dr. Ireland was, for many years, the principal surgeon of the Dublin
Metropolitan Police. He had to inspect the recruits, and satisfy
himself of their size, health, mental capacity, and bodily strength
being suitable to the service in which they proposed to engage. Cox
said that the Dublin Police was in one respect, very like to Howth
Harbor, as no one could get into either without passing "Ireland's
Eye." When the railway was being made from Dublin to Wicklow, he
said that its course through the County of Dublin was extremely
inharmonious, for it went first to a Dun-drum, proceeded to a Still-
organ, and then attained to a Bray.
Mr. Cox came into the Police Court one morning after the custody
cases had been disposed of. He brought forward an elderly female
whom he stated to be desirous of making a statutable declaration
before me, and which she had brought already drawn. There was a
peculiar expression in his countenance as he suggested that I might,
perhaps, be pleased to peruse the document previous to its official
reception. It was made under circumstances which I shall briefly
mention. A young man named Dempsey thought fit to embrace a
military life, and enlisted in the 97th Regiment. He did not give his
paternal name, but adopted the maiden name of his mother, and
was enrolled as Peter Moran. He served for some years in India, but
died there from the effects of sun-stroke. Some arrears of pay and a
share of prize-money were due at the time of his decease; and his
widowed mother applied, as next of kin, to obtain the amount. The
War-Office authorities did not understand how Peter Moran came to
be the son of Anne Dempsey. The declaration to which Cox slyly
drew my attention was intended to afford an explanation of the
grounds on which the claim was preferred, and it, moreover,
afforded an instance of a martial disposition being as early in its
inception as the birth-acquired tendency of poetic inspiration. The
declaration was as follows:—
"We have got in the barley all right, and we are going at the
oats to-morrow. I had to lend the horses to-day to Mr. Kimmis. I
couldn't refuse, for you know he is a good warrant to obleege
us when we want a turn. Nolan is bothering about the rent. He
is very cross. You must see and make it out for him, if you were
even to beg for it."
A FEW HYPERBOLES.
One of the clerks in the police-court of Liverpool got leave of
absence in, as I best remember, 1845. He came to Dublin with some
other young Englishmen for a few days of recreation. Curiosity
induced him to visit our police-courts, where our clerks received him
with fraternal courtesy. He told Mr. Cox that he and three others took
an outside car, for a suburban drive. It happened to be on Corpus
Christi day, and they were going along Rathmines road, just as the
religious procession incident to the festival was moving round the
extensive court outside of the Roman Catholic chapel there. They
directed the driver to stop, and then stood up on the seats to obtain
a full view. Almost immediately one of them exclaimed, "Well, that
beats the devil!" The carman touched his hat to the exclaimer and
replied, "Yes, your honor, that's what it's for." I have heard the late
Judge Halliburton (Sam Slick the clock-maker) say, that he asked a
carman what was the reason for building the Martello towers? and
that the interrogated party told him, "he supposed it was, like the
round towers, to puzzle posterity."
The Spaniard, who described the rain as so heavy, that "it wetted
him to the marrow," was not so poetical or forcible in his hyperbole
as some of our jarveys have been. I recollect reading in a little work,
published many years ago, and entitled "Sketches of Ireland," that
when a gentleman complained of the choking dust of the Rock road,
and declared that he did not think it possible for a road to be so
dusty, his driver remarked, "It's thrue for yer honor! but this road
bates all others for dust, for, by all accounts, there was dust on this
road the day after Noah's flood." A lady who resided at Chapelizod
was wont to give a carman whom she frequently employed a glass
of grog, along with his fare, at the conclusion of each engagement.
However, she became too sparing of the spirits, or too generous of
the water, but the grog eventually became so weak, that its recipient
criticised it, of course with an oath, by asserting, that "if you threw
half-a-pint of whisky over Essex Bridge, you might take up as strong
grog as that at the Lighthouse."
MISCELLANEOUS SUMMONSES.
According to my recollections of the summons cases of a police-
court, apart from carriage complaints, I feel justified in remarking on
the mild and forgiving tendencies of the men, and the vindictive
rancour of the women of Dublin. From recent conversations with
police functionaries, I am disposed to believe that the present time
differs in no material respect from the past. The man claims the
protection of the law; "he has no desire to injure the parties he
complains of, but he wants them bound to the peace, just to keep
them quiet." The woman wants "the coorse of the law, and to have
her adversary chastised and kept from killing the whole world, like a
murdhering vagabone as she is; it's no use in talkin', but the street
will never be quiet until she gets some little confinement just to larn
her manners." Summonses for abusive language, or as the fair
complainants term it, "street scandal," are, perhaps, the most
numerous cases as a class; and on the hearing of them, there is
frequently elicited an amount of vituperation beyond anything that
Billingsgate could attempt to supply. In almost every case a total
absence of chastity is imputed as a matter of course; and if a
foreigner would only believe both sides of a police summons-book,
he would be forced to the conclusion that chastity was a virtue rarely
found amongst the lower order of Dublin females. Yet the very
contrary is the fact: furious in their resentments, uncontrollable in
their invectives, and inveterately addicted to assassination of
character, they are, in general, extremely chaste; and attest the
value they attach to female virtue by invariably imputing its absence
to their opponents. Sometimes, indeed, a novel term of reproach
arouses volcanic fury, and an eruption of indignation is excited by
the most extraordinary and unmeaning epithet. I cannot forget a
fish-vendor from Patrick Street vociferating to me, that if her enemy
was not sent off to Grangegorman at wanst, her life and her child's
life (for she was enceinte) would be lost. "But what did she say?"
was my query. "What did she say! yer worship, what did she say!
Why she came down forenenst the whole world at the corner of
Plunket Street, and called me 'a b——y ould excommunicated
gasometer.'" I may mention that as female invective generally
ascribed inconsistency to its opponent, so the male scolds—happily
not very numerous—had their favorite term of reproach; and when
they wished to destroy a man's reputation, they designated him—a
thief?—no; a robber?—no; a murderer?—no; they satiated all their
malignity in calling him "an informer."
Disputes between manufacturers and their artisans or workmen
were very rarely the subject of magisterial investigation. There was,
however, one case disposed of by me in which a comparison was
instituted of a most extraordinary nature. A journeyman summoned
an employer for abruptly dismissing him, without giving him,
according to the usage of the trade, "a week's notice or a week's
wages." I shall not mention the name, residence, or trade of the
defendant: but I must say that his countenance exhibited the
greatest obliquity of vision that I ever observed in a human face. All
the trite phrases commonly applied to squints would fail adequately
to describe the tendency of his eyes to avoid seeing the same object
at the same time. He admitted having summarily discharged the
workman, and alleged that the complainant had totally spoiled an
article which he had been directed to make in a hexagon form, and
conformable to a pattern supplied, and had produced a piece of
work in which shape and proportion had been totally disregarded.
The complainant insisted that the work had been properly done, and
in complete conformity with the model, and he asked why it was not
produced, so that I might judge, by viewing it, whether it deserved
to be condemned as crooked and shapeless. I suggested a
postponement of the case, and the production of the condemned
article. The defendant, who was rather excited, replied, "Your
worship, I was so vexed when it was brought in, that I threw it out
of the window of the finishing room into the yard, and it was
smashed to pieces, but I am ready to swear, in this or any other
court, that it was as crooked as the two eyes in my head." The laugh
in which I indulged, at hearing this comparison, was lost in the
risibility of all present. I suggested that the parties might come to an
understanding, and that the complainant might be afforded another
opportunity of making an article perfectly conformable to the
pattern, and without any resemblance to anything else. This was
agreed to, and they departed reconciled.