0% found this document useful (0 votes)
21 views40 pages

Introducing Functional Programming Using C#: Leveraging A New Perspective For OOP Developers 1st Edition Vaskaran Sarcar Download PDF

Vaskaran

Uploaded by

sevgikozub7b
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views40 pages

Introducing Functional Programming Using C#: Leveraging A New Perspective For OOP Developers 1st Edition Vaskaran Sarcar Download PDF

Vaskaran

Uploaded by

sevgikozub7b
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Get ebook downloads in full at ebookmeta.

com

Introducing Functional Programming Using C#:


Leveraging a New Perspective for OOP Developers
1st Edition Vaskaran Sarcar

https://ebookmeta.com/product/introducing-functional-
programming-using-c-leveraging-a-new-perspective-for-oop-
developers-1st-edition-vaskaran-sarcar/

OR CLICK BUTTON

DOWNLOAD NOW

Explore and download more ebook at https://ebookmeta.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Simple and Efficient Programming with C# Vaskaran Sarcar

https://ebookmeta.com/product/simple-and-efficient-programming-with-c-
vaskaran-sarcar/

ebookmeta.com

Test Your Skills in C# Programming: Review and Analyze


Important Features of C# 1st Edition Vaskaran Sarcar

https://ebookmeta.com/product/test-your-skills-in-c-programming-
review-and-analyze-important-features-of-c-1st-edition-vaskaran-
sarcar/
ebookmeta.com

Java Design Patterns a tour of 23 gang of four design


patterns in Java 1st Edition Vaskaran Sarcar

https://ebookmeta.com/product/java-design-patterns-a-tour-of-23-gang-
of-four-design-patterns-in-java-1st-edition-vaskaran-sarcar/

ebookmeta.com

Interviewing: A Guide for Journalists and Professional


Writers, 3rd Edition Gail Sedorkin

https://ebookmeta.com/product/interviewing-a-guide-for-journalists-
and-professional-writers-3rd-edition-gail-sedorkin/

ebookmeta.com
A Bit of a Bite Mob Ties Book 4 1st Edition Milly Taiden

https://ebookmeta.com/product/a-bit-of-a-bite-mob-ties-book-4-1st-
edition-milly-taiden/

ebookmeta.com

Teens Guide to College Career Planning 12th Edition Justin


Ross Muchnick

https://ebookmeta.com/product/teens-guide-to-college-career-
planning-12th-edition-justin-ross-muchnick/

ebookmeta.com

Cardiac Electrosonography 1st Edition Eyal Herzog David


Leibowitz Yair Elitzur

https://ebookmeta.com/product/cardiac-electrosonography-1st-edition-
eyal-herzog-david-leibowitz-yair-elitzur/

ebookmeta.com

Health and Health Care Concerns among Women and Racial and
Ethnic Minorities 1st Edition Jennie Jacobs Kronenfeld

https://ebookmeta.com/product/health-and-health-care-concerns-among-
women-and-racial-and-ethnic-minorities-1st-edition-jennie-jacobs-
kronenfeld/
ebookmeta.com

Jarvis's Health Assessment & Physical Examination Carolyn


Jarvis & Ann Eckhardt

https://ebookmeta.com/product/jarviss-health-assessment-physical-
examination-carolyn-jarvis-ann-eckhardt/

ebookmeta.com
Hidden History Of American Healthcare 1st Edition Hartmann

https://ebookmeta.com/product/hidden-history-of-american-
healthcare-1st-edition-hartmann/

ebookmeta.com
Introducing
Functional
Programming
Using C#
Leveraging a New Perspective for
OOP Developers

Vaskaran Sarcar
Introducing Functional
Programming Using C#
Leveraging a New Perspective
for OOP Developers

Vaskaran Sarcar
Introducing Functional Programming Using C#: Leveraging a New Perspective for
OOP Developers
Vaskaran Sarcar
Kolkata, West Bengal, India

ISBN-13 (pbk): 978-1-4842-9696-7 ISBN-13 (electronic): 978-1-4842-9697-4


https://doi.org/10.1007/978-1-4842-9697-4

Copyright © 2023 by Vaskaran Sarcar


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically, the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now
known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Smriti Srivastava
Development Editor: Laura Berendson
Editorial Project Manager: Mark Powers
Cover designed by eStudioCalamar
Cover image by BoliviaInteligente on Unsplash (www.unsplash.com)
Distributed to the book trade worldwide by Apress Media, LLC, 1 New York Plaza, New York, NY 10004,
U.S.A. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.
springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science
+ Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail [email protected]; for reprint, paperback,
or audio rights, please e-mail [email protected].
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and
licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales
web page at www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to readers
on GitHub (https://github.com/Apress). For more detailed information, please visit https://www.apress.com/
gp/services/source-code.
Paper in this product is recyclable
This book is dedicated to all those developers who want to
improve their applications and do not give up easily.
Table of Contents
About the Author����������������������������������������������������������������������������������������������������� xi

About the Technical Reviewers����������������������������������������������������������������������������� xiii


Acknowledgments���������������������������������������������������������������������������������������������������xv

Introduction�����������������������������������������������������������������������������������������������������������xvii

Part I: Getting Familiar with Functional Programming����������������������������������� 1


Chapter 1: Functional Programming Overview��������������������������������������������������������� 3
C# Supports Multiple Paradigms�������������������������������������������������������������������������������������������������� 3
Functions and Methods Are Equivalent in C#�������������������������������������������������������������������������� 4
Important Characteristics of FP���������������������������������������������������������������������������������������������������� 5
FP Treats Functions as First-Class Citizens����������������������������������������������������������������������������� 6
FP Prefers Immutability����������������������������������������������������������������������������������������������������������� 8
FP Prefers Pure Functions����������������������������������������������������������������������������������������������������� 11
FP Follows a Declarative Style���������������������������������������������������������������������������������������������� 18
FP vs. OOP����������������������������������������������������������������������������������������������������������������������������������� 24
FP Benefits���������������������������������������������������������������������������������������������������������������������������������� 25
Exercises������������������������������������������������������������������������������������������������������������������������������������� 26
Summary������������������������������������������������������������������������������������������������������������������������������������ 28
Solutions to Exercises����������������������������������������������������������������������������������������������������������������� 28

v
Table of Contents

Chapter 2: Understanding Functions���������������������������������������������������������������������� 33


Mathematical Background of Functions������������������������������������������������������������������������������������� 33
Mathematical Functions vs. C# Functions���������������������������������������������������������������������������������� 35
Representing Functions in C#����������������������������������������������������������������������������������������������������� 35
Using Static Methods������������������������������������������������������������������������������������������������������������ 35
Using Delegates and Lambdas���������������������������������������������������������������������������������������������� 39
Using a Dictionary����������������������������������������������������������������������������������������������������������������� 42
Built-in Delegates Are Important������������������������������������������������������������������������������������������������� 45
Higher-Order Function����������������������������������������������������������������������������������������������������������������� 46
Custom HOF��������������������������������������������������������������������������������������������������������������������������� 46
Built-in HOF��������������������������������������������������������������������������������������������������������������������������� 48
First-Order Function�������������������������������������������������������������������������������������������������������������������� 49
Refactoring Impure Functions����������������������������������������������������������������������������������������������������� 49
Program with Impurities�������������������������������������������������������������������������������������������������������� 50
Removing Impurities�������������������������������������������������������������������������������������������������������������� 51
Exercises������������������������������������������������������������������������������������������������������������������������������������� 53
Summary������������������������������������������������������������������������������������������������������������������������������������ 54
Solutions to Exercises����������������������������������������������������������������������������������������������������������������� 55

Chapter 3: Understanding Immutability����������������������������������������������������������������� 59


What Is Immutability?����������������������������������������������������������������������������������������������������������������� 59
Immutable Objects in .NET���������������������������������������������������������������������������������������������������� 59
Reviewing Mutable Types����������������������������������������������������������������������������������������������������������� 61
Programming with a Mutable Type���������������������������������������������������������������������������������������� 61
The Path Toward Immutability����������������������������������������������������������������������������������������������������� 62
Achieving External Immutability�������������������������������������������������������������������������������������������� 62
Enforcing Internal Immutability��������������������������������������������������������������������������������������������� 65
Better Code Using Modern Features�������������������������������������������������������������������������������������� 68
More on Immutability������������������������������������������������������������������������������������������������������������������ 72
Understanding Shallow Immutability������������������������������������������������������������������������������������� 73
Searching for a Solution�������������������������������������������������������������������������������������������������������� 77

vi
Table of Contents

Making a Better Solution������������������������������������������������������������������������������������������������������� 80


Implementing Popsicle Immutability������������������������������������������������������������������������������������� 83
Exercises������������������������������������������������������������������������������������������������������������������������������������� 87
Summary������������������������������������������������������������������������������������������������������������������������������������ 88
Solutions to Exercises����������������������������������������������������������������������������������������������������������������� 89

Part II: Harnessing the Power of Functional Programming�������������������������� 93


Chapter 4: Composing Functions Using Pipelining������������������������������������������������� 95
Overview������������������������������������������������������������������������������������������������������������������������������������� 95
Coding Functional Composition��������������������������������������������������������������������������������������������� 95
Importance of Chaining Functions���������������������������������������������������������������������������������������������� 99
Program Without Chaining Functions������������������������������������������������������������������������������������ 99
Refactoring Using Chaining Functions�������������������������������������������������������������������������������� 102
Applying Composition��������������������������������������������������������������������������������������������������������������� 106
Using Pipelining������������������������������������������������������������������������������������������������������������������� 106
Using HOFs�������������������������������������������������������������������������������������������������������������������������� 109
Exercises����������������������������������������������������������������������������������������������������������������������������������� 112
Summary���������������������������������������������������������������������������������������������������������������������������������� 113
Solutions to Exercises��������������������������������������������������������������������������������������������������������������� 113

Chapter 5: Composing Functions Using Currying������������������������������������������������� 119


Overview of Currying���������������������������������������������������������������������������������������������������������������� 119
Program Without Currying��������������������������������������������������������������������������������������������������� 120
Using the Concept of Currying��������������������������������������������������������������������������������������������� 121
Using External NuGet Packages������������������������������������������������������������������������������������������������ 129
Using Curryfy����������������������������������������������������������������������������������������������������������������������� 130
Exercises����������������������������������������������������������������������������������������������������������������������������������� 136
Summary���������������������������������������������������������������������������������������������������������������������������������� 138
Solutions to Exercises��������������������������������������������������������������������������������������������������������������� 139

vii
Table of Contents

Chapter 6: Handling Temporal Coupling��������������������������������������������������������������� 145


Temporal Coupling Overview���������������������������������������������������������������������������������������������������� 146
How Does This Happen?������������������������������������������������������������������������������������������������������ 146
Recognizing the Problem���������������������������������������������������������������������������������������������������������� 146
A Program That Suffers from Temporal Coupling���������������������������������������������������������������� 147
Removing the Effect������������������������������������������������������������������������������������������������������������������ 155
A Better Program����������������������������������������������������������������������������������������������������������������� 156
Exercises����������������������������������������������������������������������������������������������������������������������������������� 165
Summary���������������������������������������������������������������������������������������������������������������������������������� 167
Solutions to Exercises��������������������������������������������������������������������������������������������������������������� 167

Chapter 7: Functional Patterns����������������������������������������������������������������������������� 171


Map Pattern������������������������������������������������������������������������������������������������������������������������������ 172
Understanding the Problem������������������������������������������������������������������������������������������������� 173
Initial Solution���������������������������������������������������������������������������������������������������������������������� 173
Better Solution��������������������������������������������������������������������������������������������������������������������� 177
Concise Solution������������������������������������������������������������������������������������������������������������������ 178
Select As Map���������������������������������������������������������������������������������������������������������������������� 182
Introducing Functors����������������������������������������������������������������������������������������������������������� 186
Conclusion��������������������������������������������������������������������������������������������������������������������������� 186
Bind Pattern������������������������������������������������������������������������������������������������������������������������������ 187
Understanding the Problem������������������������������������������������������������������������������������������������� 187
Initial Solution���������������������������������������������������������������������������������������������������������������������� 188
FP-Based Solution��������������������������������������������������������������������������������������������������������������� 189
SelectMany As Bind������������������������������������������������������������������������������������������������������������� 191
What About Monads?����������������������������������������������������������������������������������������������������������� 192
Conclusion��������������������������������������������������������������������������������������������������������������������������� 193
Filter Pattern����������������������������������������������������������������������������������������������������������������������������� 194
Understanding the Problem������������������������������������������������������������������������������������������������� 194
Initial Solution���������������������������������������������������������������������������������������������������������������������� 195
Where As Filter�������������������������������������������������������������������������������������������������������������������� 198

viii
Table of Contents

Fold Pattern������������������������������������������������������������������������������������������������������������������������������ 199


Understanding the Problem������������������������������������������������������������������������������������������������� 202
Solutions Using Built-in Functions�������������������������������������������������������������������������������������� 202
Conclusion��������������������������������������������������������������������������������������������������������������������������� 205
Revisiting ForEach�������������������������������������������������������������������������������������������������������������������� 207
Exercises����������������������������������������������������������������������������������������������������������������������������������� 208
Summary���������������������������������������������������������������������������������������������������������������������������������� 210
Solutions to Exercises��������������������������������������������������������������������������������������������������������������� 210

Chapter 8: Exception Handling����������������������������������������������������������������������������� 215


Reviewing Exception Handling in OOP�������������������������������������������������������������������������������������� 215
Imperative Style of Programming���������������������������������������������������������������������������������������� 217
Exception Handling in FP���������������������������������������������������������������������������������������������������������� 218
Using language-ext������������������������������������������������������������������������������������������������������������� 219
Introducing the Either Type�������������������������������������������������������������������������������������������������� 219
Handling a Single Exception������������������������������������������������������������������������������������������������ 224
Handling Multiple Exceptions���������������������������������������������������������������������������������������������� 226
Chaining Exceptions������������������������������������������������������������������������������������������������������������ 230
Handling Null Values����������������������������������������������������������������������������������������������������������������� 238
Introducing the Option Type������������������������������������������������������������������������������������������������� 239
Exercises����������������������������������������������������������������������������������������������������������������������������������� 248
Summary���������������������������������������������������������������������������������������������������������������������������������� 251
Solutions to Exercises��������������������������������������������������������������������������������������������������������������� 252

Chapter 9: Miscellaneous Topics�������������������������������������������������������������������������� 257


Helpful Features for FP������������������������������������������������������������������������������������������������������������� 257
Delegates and Lambdas������������������������������������������������������������������������������������������������������ 257
Anonymous Methods����������������������������������������������������������������������������������������������������������� 258
Extension Methods and LINQ����������������������������������������������������������������������������������������������� 259
Type Inference��������������������������������������������������������������������������������������������������������������������� 263
Importing Static Members��������������������������������������������������������������������������������������������������� 263

ix
Table of Contents

Immutability Features���������������������������������������������������������������������������������������������������������� 264


Expression-Bodied Members���������������������������������������������������������������������������������������������� 265
Local Functions������������������������������������������������������������������������������������������������������������������� 268
Tuples���������������������������������������������������������������������������������������������������������������������������������� 270
Pattern Matching����������������������������������������������������������������������������������������������������������������� 272
Revisiting Option<T>���������������������������������������������������������������������������������������������������������������� 275
Bind Function���������������������������������������������������������������������������������������������������������������������� 277
Return Function������������������������������������������������������������������������������������������������������������������� 279
Introducing Monads������������������������������������������������������������������������������������������������������������������ 280
Definition����������������������������������������������������������������������������������������������������������������������������� 280
Mathematical Background�������������������������������������������������������������������������������������������������� 281
Monad Laws������������������������������������������������������������������������������������������������������������������������ 281
Chaining Multi-argument Functions����������������������������������������������������������������������������������������� 283
Final Suggestions���������������������������������������������������������������������������������������������������������������������� 285
Command Query Separation������������������������������������������������������������������������������������������������ 285
Learn Design Patterns and Anti-Patterns���������������������������������������������������������������������������� 285
Don’t Let Failures Stop You�������������������������������������������������������������������������������������������������� 286
How Much Functional Code Do I Need?������������������������������������������������������������������������������ 287
Applications of FP��������������������������������������������������������������������������������������������������������������������� 287
The Road Ahead������������������������������������������������������������������������������������������������������������������������ 287
Exercises����������������������������������������������������������������������������������������������������������������������������������� 288
Summary���������������������������������������������������������������������������������������������������������������������������������� 290
Solutions to Exercises��������������������������������������������������������������������������������������������������������������� 291

Appendix: Recommended Resources������������������������������������������������������������������� 295

Index��������������������������������������������������������������������������������������������������������������������� 297

x
About the Author
Vaskaran Sarcar obtained his master’s degree in software
engineering from Jadavpur University, Kolkata (India),
and his master’s of computer application from Vidyasagar
University, Midnapore (India). He was a National Gate
Scholar (2007–2009) and has more than 12 years of
experience in education and the IT industry. He devoted
his early years (2005–2007) to the teaching profession at
various engineering colleges, and later he joined HP India
PPS R&D Hub in Bangalore. He worked at HP until August
2019. At the time of his retirement from HP, he was a senior software engineer and team
lead. Vaskaran is following his passion and is now a full-time author. You can find him on
LinkedIn at https://www.linkedin.com/in/vaskaransarcar and see all of his books at
https://amazon.com/author/vaskaran_sarcar.

xi
About the Technical Reviewers
Leandro Fernandes Vieira is a senior software engineer
currently working for a leading payment solutions company.
He earned his degree in system analysis and development
from São Paulo State Technological College (FATEC-SP),
Brazil. His realm of expertise includes the .NET stack and
the C# and F# programming languages. He has a passion
for programming and algorithms and likes to contribute
to open-source projects; in fact, he is a creator of the
RecordParser project, one of the fastest CSV parsers for .NET.
He enjoys spending time with his family, walking in the park, hitting the gym, and
listening to heavy-metal music.
You can reach him at https://github.com/leandromoh/.

Shekhar Kumar Maravi is a lead engineer in design and


development, whose main interests are programming
languages, algorithms, and data structures. He obtained his
master’s degree in computer science and engineering from
the Indian Institute of Technology, Bombay (India). After
graduation, he joined Hewlett-­Packard’s R&D Hub in India
to work on printer firmware. Currently he is a technical lead
engineer for automated pathology lab diagnostic devices in
the Siemens Healthcare R&D division. He can be reached
by email at [email protected] or via LinkedIn at
https://www.linkedin.com/in/shekharmaravi.

xiii
Acknowledgments
I thank the Almighty. I sincerely believe that only with His blessings could I complete
this book. I also extend my deepest gratitude and thanks to the following people:
• Leandro Fernandes Vieira and Paul Louth: They allowed me to use
the Curryfy library and language-ext library in this book. Leandro
also joined the technical review team and provided many useful
suggestions and improvements for this book.

• Shekhar Kumar Maravi: Shekhar was another technical reviewer for


this book. He has been reviewing my books since 2015. Whenever I
am in need, he provides me with support. Thank you one more time.

• Smriti, Laura, and Mark: Thanks to each of you for giving me


another opportunity to work with you and Apress.

• Shon, Kim, Nagarajan, and Vinoth: Thanks to each of you for your
exceptional support to improve my work.

Finally, I thank those people from the functional programming community who have
shared their knowledge through online blogs, articles, courses, and books.

xv
Introduction
Throughout the ages, prophets have suggested that most of us are not reaching our full
potential. If you look at the great achievers in any field in the current world, you will find
that they are hard workers, and they strive to keep improving. They put in extra effort to
improve their skills, and in many cases, they even hire coaches to learn new techniques.
Then, one day, they discover that all their hard work starts to pay off: they become
masters in their chosen field.
The following quote from the Chinese philosopher Confucius perfectly
summarizes this:

The will to win, the desire to succeed, the urge to reach your full
potential…these are the keys that will unlock the door to personal excellence.

Now let’s apply this philosophy to programming. As a developer, are you reaching
your full potential with C#? I may not know your reply, but I certainly know my answer.
Even after working with C# for more than 14 years, there is still more to learn.
One evening I asked myself, how could I improve my C# skills? I could continue
to try to learn new features and practice them, but intuitively, I knew there was an
alternative answer. So, I started searching for tips and eventually discovered that most of
the time I was using C# for object-oriented programming (OOP). Indeed, it is a perfect
fit for OOP, and there is nothing wrong with this tendency. But what about functional
programming (FP) using C#? It’s not that I never used it (in fact, C# developers are very
much familiar with LINQ), but I was not very conscious of it. So, I keep browsing through
various resources, such as books, articles, and online courses. Eventually, I discovered
that during its development, C# started embracing functional features too, and as a
result, it has become a powerful hybrid language.
I became very interested in the topic and tried to learn more about it. From this
time onward, I started facing challenges. There were some good resources, but I could
not stitch them together to serve my needs. This is why I started documenting my notes
when I was experimenting with using C# in a functional way. This book is a result of
those efforts.

xvii
Introduction

So, welcome to your journey through Introducing Functional Programming Using C#:
Leveraging a New Perspective for OOP Developers.
C# is a powerful programming language, is well accepted in the programming world,
and helps you make a wide range of applications. These are the primary reasons it is
continuously growing in popularity and is always in high demand. So, it is not a surprise
that existing and upcoming developers (for example, college students and programming
lovers) are curious to learn C# and want to create their applications using it.
Many developers try to learn it in the shortest possible time frame and then claim
they know C# well. In fact, many resources claim you can unlock the real power of C# in
a day, a week, or a month. But is this true? I think not. Remember, I’m 14 years in and I’m
still learning.
Malcolm Gladwell’s 10,000-hour rule says that the key to achieving world-class
expertise in any skill is, to a large extent, a matter of practicing the correct way, for a total
of around 10,000 hours. So, even though we may claim that we know something very
well, we actually know very little. Learning is a continuous process, with no end to it.
Then should we stop learning? Definitely, the answer is no. There is something called-
effective learning. It teaches you how to learn fast to serve your need. This is the context
where I like to remind you about the Pareto principle or 80-20 rule. This rule simply states
that 80% of outcomes come from 20% of all causes. This is useful in programming too.
When you truly learn the fundamental aspects of FP, you can use it effectively to improve
your code. Most importantly, your confidence level will raise to a level from where you
can learn more easily. This book is for those who acknowledge this fact. It helps you to
understand the core principles of FP with plenty of Q&A sessions and exercises.

How Is This Book Organized?


The book has two major parts, which are as follows:

• Part I consists of the first three chapters, which start with an overview
of functional programming (FP). Then we’ll discuss functions and
immutability in depth. These are the building blocks for FP and what
you need to understand to move on to Part II of this book.
• C# is a multiparadigm language, and Part II reveals its potential.
This part will cover how to harness the power of FP. In addition,
two well-known external libraries, called Curryfy and language-ext,

xviii
Other documents randomly have
different content
be said when the Service ended there and the Amidah was
considered optional (‫‏רשות‬‎).

4. On Page 442 (3).

An important element in the Service is religious instruction. The


means adopted were the reading of the Torah and Haphtarah, the
introduction of moral lessons, principles of faith, exposition of Divine
precepts into the Service, and lectures containing various lessons,
exhortations, and explanations of the Biblical and Post-Biblical
Sacred Literature. These lectures are an ancient institution. The
prophets instructed the people, especially on New-moon and
Sabbath (2 Kings iv. 23); the Scribes and the Rabbis of the Talmudic
age expounded the Torah and other Biblical and Post-Biblical
writings; they were followed by darshanim and maggidim, the
modern preachers and ministers. The aim of these lectures is to
create, maintain, or intensify the fear of God and the love of the
Torah (‫‏אהבת תורה ויראת שמים‬‎).

The Sermon has lost much of its original force and influence. The
cause of this fact is probably to be sought chiefly in the
[449]materialism and scepticism of the age, but to some degree also
in the character of the sermon. It cannot be denied that the pulpit,
instead of being made a place from which Love of Torah and Fear of
God receive life, encouragement, and strength, is frequently turned
into a platform for discussing communal or personal quarrels or
theological controversies, or creating a discontent with existing
institutions, without sufficiently considering the result of such
discontent. Themes like these are not outside the province of the
preacher, but they must not be the staple of his discourses, which
must principally seek to foster ‫‏אהבת תורה ויראת שמים‬‎in the hearts of
the congregants. As to the history and literature of this branch of the
Service, see Zunz, Die Gottesdienstlichen Vorträge der Juden.
Berlin, 1832.

5. On Page 420.

The question is frequently asked whether special meetings and


Services may be arranged with a view of improving the religious
status of the Jewish community. There is no reason why attempts
should not be made in this direction. By all means let everything be
done that is conducive to a revival of religious feeling and religious
practice. But in such attempts care must be taken that nothing be
done that is contrary to the precepts of the Law, both Written and
Oral; that the teachers, preachers, or lecturers do not themselves
display a disregard for recognised religious authority, and by such
conduct undermine the existing reverence for the inherited traditional
Religion.

On this basis meetings on Sabbath for the purpose of reading the


Bible, praying, and singing, in whatever language this be done, and
special Services for the pupils of Religion Classes at the close of the
session, must be welcome to all who have a love for our holy
Religion.

6. On Page 420.

A question of equal importance that frequently disturbs the peace of


the congregation is this: whether and in how far the established
Ritual or minhag of a Synagogue may be altered. The Ritual is not
the work of one man or of one age; it is the product of the thoughts
and the feelings of our nation through many [450]centuries. Its
foundation was laid by the Men of the Great Synagogue in the time
of Ezra. Generation after generation were busy in the construction of
the building; storey was added to storey; from time to time new
wings made their appearance. Reverence and piety made
successive builders reluctant to pull down what the same feelings of
preceding generations had reared. The whole formed a Sanctuary
every single stone of which was cherished and guarded against
desecration. Notwithstanding the storms and tempests to which it
was exposed, and which certainly caused a breach here and there,
our Sanctuary stands still on its ancient foundations, and its walls
retain their power of resistance.

What is the duty of the present generation with regard to this


structure? Architects or would-be architects examine it minutely from
foundation to top-stone; but they come to different conclusions. We
will examine these conclusions, sine irâ et studio, assuming that the
examination has been conducted bonâ fide, with a view of
strengthening the Sanctuary, and that the reports are in accordance
with truth and the examiners’ innermost conviction.

(1.) Some declare “the Building no longer attractive; there are so


many other edifices full of points of attraction both without and within;
these must in course of time draw away the visitors from our
Sanctuary, and estrange those who used to fill it.” We admit the force
of the argument. It has always been the aim of those who had the
management of the Synagogue in their hands to make the Service
attractive; there is no reason why it could or should not be done at
present. Means of attraction are mostly of an external character: the
art and luxury displayed in the building and its furniture, the
eloquence of the preacher, the voice of the reader, the singing of the
choir, introduction of novelties, such as instrumental music (scil., on
week-days) and prayers in the vernacular. In themselves these
things are harmless, and although they are not the essence of the
worship, they may lead to it; 135 and, for this reason, it must be
considered a condition sine quâ non, that the style of singing,
reading, and preaching should be such as to please the majority, if
not every one, of the congregants. 136 But there is this to be feared
and guarded [451]against: viz., that the husk be mistaken for the fruit,
and true devotion be lost. Besides, the experiment has been made,
and the desired result has not been obtained. There are plenty of
places for the enjoyment of vocal and instrumental music, with which
the Synagogue would vie in vain in point of attractiveness, and
novelties, as novelties, soon wear away, and bring no real
improvement. Let the leaders of the Synagogue strengthen the faith
of their brethren in God and His Word, maintain, by good example,
their reverence for our ancient traditions and customs, and be
themselves earnest and devout worshippers; they will then surely be
more successful in drawing others to the House of God.

(2.) Another critic says: “The Synagogue Services are discordant;”


that is, the feelings expressed in our prayers have no echo in the
hearts of the worshippers. “Education and general progress have so
entirely changed the whole life of man that he can no longer be
edified by the prayers and method of devotion followed by our
forefathers.” Those who assert this, of course, only assert it of
themselves, and so far their statement may be accepted as correct.
But on examining it more closely we find that there must be
something misleading in it. For what is the central idea of the ancient
prayers and hymns? The conviction that we address our Heavenly
Father, who is the Creator and Ruler of the Universe; who is just,
good, and holy; who alone can fulfil the wishes which we utter in our
prayers, and “who is near to all those who call upon him in truth.”
Does progress of education force us to abandon this principle?
Certainly not. Those who do abandon it cannot be said to do so by
force of education, for they are found among the educated and
uneducated alike; and we should be false to our own Faith if we
were to abandon this fundamental principle of our Divine Service.

The second of the fundamental Principles of our Faith, though less


general than the preceding, is yet equally essential in Judaism, viz.,
the belief in Revelation, in the Integrity and the Divine origin of the
Torah, and the truth of the Divine messages sent through the
prophets. The Ritual is replete with references to this belief, and it
would amount to a rejection of this essentially Jewish Principle, if we
were to expunge such references from the Ritual in order to please a
few unbelievers. [452]

References to the Sacrificial Service, and especially prayers for its


restoration, are disliked by some, who think such restoration
undesirable. Let no one pray for a thing against his will; let him
whose heart is not with his fellow-worshippers in any of their
supplications silently substitute his own prayers for them, but let him
not interfere with the devotion of those to whom “the statutes of the
Lord are right, rejoicing the heart; the commandment of the Lord
pure, enlightening the eyes; the judgments of the Lord true and
righteous altogether” (Ps. xix. 9, 10), and who yearn for the
opportunity of fulfilling Divine commandments which they cannot
observe at present. 137 Prayer, in the true sense of the word, is
impossible without the recognition of God as our Master, whom we
are willing to serve, and whose commands we desire to do, whether
the act implied in them be in other respects agreeable to us or not.

(3.) The Ritual contains many sections which owe their existence to
particular circumstances that have passed away, and to local
conditions which are different from those prevailing in the countries
in which we live. Have these a right to be kept perpetually in the
Ritual? Certainly not. There is no reason why prayers which have
become obsolete and meaningless should not be modified or
discontinued. But as a rule our prayers are free from references to
the particular causes of their composition, and there is no need to
expunge from the Service petitions, thanksgivings, or praises which
were originally intended for a special occasion, if they are expressed
in general terms, and have become in the Synagogue a source of
devotion and edification. But as to the latter condition, it is difficult to
decide whether a liturgical composition has become, and is still, an
aid to devotion. Much depends on the individual character of the
particular congregation in which the question has been raised, and
each case should be decided on its own merits by a competent and
responsible authority.

Many of the Piyyutim 138 and Selichoth belong to this class; also a
few sections in the ordinary Ritual (see note 2), and the repetition
[453]of the Amidah, and the Kiddush in the Synagogue on the eve of
Sabbaths and Festivals.

(4.) It is further asserted that the Ritual was formulated in bygone


times; our wants and tastes are different from those of former ages.
We can neither pray for the same things nor in the same way as our
ancestors. But what did our ancestors pray for? For the well-being of
their body and of their soul; for the realisation of our national hopes
and the ultimate triumph of our holy Religion. Just the same ends we
wish to obtain at present, and these objects form the substance of
our Ritual.—There are some petitions which seem to many out of
place, and out of date. Such are petitions against cruel oppressors.
Our fathers had good reason to cry to the Almighty for relief, for they
were oppressed, whilst we, living in a free country, in the enjoyment
of all the rights of citizens, have no cause whatever for complaint. If
we were to separate ourselves from our brethren in distant countries,
we could expunge all such petitions from the Ritual. This is, however,
not the case; we feel deeply grieved at the sufferings of our brethren.
We should like to see them relieved from oppression and
persecution, and pray to God for His interference in behalf of the
persecuted. When we use the term “revenge” (‫‏נקם‬‎) we do not
associate with it any base desire to see the enemy crushed or
annihilated; we use it rather in the sense of a just and merited
penalty for evil-doers, and associate with it the idea of the ultimate
victory and triumph of our holy Religion after long periods of
oppression and persecution. It is their Faith for which our fathers
suffered, and our brethren in some countries still suffer, and the
triumph of which forms the centre of these petitions. Intense grief
and sorrow sometimes suggested harsh expressions, such as
“Destroy our enemies,” “Put an end to them,” but these are figurative
expressions, and are used in the sense explained by Beruria, the
wife of Rabbi Meir: “May the sinners cease from sinning, and sinners
will be no more.” Similarly we pray in the Amidah: “Let our slanderers
have no hope of success, so that evil-doers may soon vanish and
disappear; break the power of the presumptuous, and humble them.”
In these words we give expression to our feeling of indignation
against the slanderers of our holy Religion, the revilers of Judaism,
such, e.g., as from time to time renew the blood-accusations, [454]or
by false and deceptive arguments or other means entice Jews to
abandon their faith. 139

(5.) We hear frequently the complaint that the Public Service is too
long. This complaint is of a relative character; it is different from the
feeling of joy expressed in the words, “Blessed are those who dwell
in thy house;” it is different from the sentiment of those chasidim
(Mishnah, Berachoth v. 1) who sat still a while before the
commencement of the prescribed prayer, or those who after the
conclusion thereof sit down again, saying, “Surely the righteous shall
give thanks to thy name; the upright shall dwell in thy presence” (Ps.
cxl. 14). As regards the length of the Service, we should bear in mind
the principle of our Sages: It makes no difference whether the
Service is long or short: only be devout. It is provocative of
irreverence to protract the Service unnecessarily until it becomes
wearisome; but it is equally unbecoming to hurry over it as though it
were an unpleasant task. On the whole the Services, especially
when they are well regulated, are not too long, unless too much time
be spent in singing or in unnecessary interruptions.
In all cases in which a modification seems advisable and lawful it
must be borne in mind that the Ritual is a Sanctuary every element
of which is holy, and that hasty reforms may be less effective than is
hoped. It may perhaps be easy to pull down, but it is not so easy to
build up. Devout members of a congregation may easily be
alienated, but not so easily will new members be attracted, or if
attracted, permanently retained.

7. On Page 424.

Rabban Gamaliel said, “Provide thyself a teacher, and be quit of


doubt” (Aboth i. 16). The rule laid down in these words for every
individual applies also to the whole community. Questions like those
mentioned in the preceding note frequently arise in Jewish
congregations, and cause dissension where union is so much
needed. A teacher must be appointed in every community, [455]who
shall be able to guide and to instruct it as to what is right and wrong.
In fact, such a teacher has, as a rule, been appointed in Jewish
congregations; he is known by various names: Haham (‫‏חכם‬‎), Rav
(‫‏רב‬‎“Teacher”), Rabbi (‫‏רבי‬‎“My teacher”), Teacher of righteousness
(‫‏מורה צדק‬‎), and Judge (‫‏דין‬‎). The weight of his authority is less to be
determined by the nature of his office or by written conditions than by
his learning, piety, and personal influence. According to the rule,
“Judge not alone” (ibid. iv. 8), he is generally assisted by two
councillors (dayganim), with whom he forms a court of judgment—
Beth-din—when questions of more than ordinary importance have to
be decided. The congregation must accept his decisions as final,
and must have confidence that he, like the high-priest of old, will give
his answers according to “light and integrity.”
[Contents]

VI. The Dietary Laws.

“Thou shalt not eat any abominable thing” (Deut. xiv. 3); that is,
according to our traditional explanation, everything that the Word of
God declares to be abominable (Sifre, ad locum). One of the
sections of the Dietary Laws concludes thus: “For I am the Lord that
brought you up out of the land of Egypt, to be your God: ye shall
therefore be holy, for I am holy” (Lev. xi. 45).

Holiness is therefore the only object of these laws that is distinctly


mentioned in the Pentateuch. But what is the nature of the holiness
which they are intended to produce or to promote? “The Dietary
Laws,” says Maimonides, “train us in the mastery over our appetites;
they accustom us to restrain the growth of desire, the indulgence in
seeking that which is pleasant, and the disposition to consider the
pleasure of eating and drinking the end of man’s existence” (“The
Guide,” III., chap. xxv. p. 167). And, indeed, [456]wherever the Law
commands restraint of some bodily enjoyment, or restriction of any
of our appetites, such commandment is followed or preceded by the
exhortation to be holy, or the warning not to defile oneself.

Is there any secondary object in these laws besides the motive


distinctly mentioned? It has frequently been observed that Jews
have enjoyed a certain degree of immunity from epidemics that
raged among their non-Jewish neighbours. It has further been
noticed that they have a lower rate of mortality and a greater
longevity. These facts are generally explained to be the result of a
temperate life, regulated by the Divine Law. Finding that such is the
consequence of obedience to the Dietary Laws, we may fairly
assume that in distinguishing certain things from the rest, in
prohibiting some and permitting others, the Lawgiver aimed at the
health and the well-being of man’s body. Our conception of the
goodness of God compels us to believe that in recommending
certain things for our use He intended thereby to promote our well-
being, and to show us what is good for our health, and what is
injurious. But we must take care that we do not on that account
consider these precepts exclusively as sanitary regulations, however
important such regulations may be. We must not lose sight of the
fact that Holiness is the only object of the Dietary Laws, mentioned in
the Pentateuch.

But what difference can it make to the Almighty whether we eat this
or that? Surely it makes no difference to the Almighty; but we have
faith in His Goodness and Wisdom, and are convinced that He
knows by what means we may best attain to that [457]holiness which
we are so frequently exhorted to seek, and that the Divine Laws
which He revealed to us for this very purpose show the shortest and
the safest road to this aim.

With the following exceptions, the Dietary Laws concern only animal
food:—

(1.) ‫‏ערלה‬‎“Forbidden fruit,” i.e., the fruit of a tree during the first three
years after its planting (Lev. xix. 23).—The fruit of the fourth year
(‫‏נטע רבעי‬‎) was formerly, in the time of the Temple, brought to
Jerusalem, and consumed there amidst praises and thanksgiving to
Him who is the source of all blessing (ibid. v. 24). Those who lived
far from Jerusalem were allowed to redeem the fruit of the fourth
year with silver, and to spend the latter in the holy city.
(2.) ‫‏חדש‬‎“New corn.”—The Omer of barley offered on the second day
of Passover is called “the first of your harvest” (Lev. xxiii. 10), and it
was enjoined, “Ye shall eat neither bread, nor parched corn, nor
fresh ears, 140 until this selfsame day, until ye have brought the
oblation of your God” (ibid. 14).

These two laws (‫‏ערלה‬‎and ‫‏חדש‬‎) seem to have their source in the
dictum, “The first of the first-fruits of thy ground thou shalt bring into
the house of the Lord thy God” (Exod. xxiii. 19).

(3.) ‫‏כלאים‬‎.—Mixture of different kinds. “Thou shalt not sow thy field
with two kinds of seed” (Lev. xix. 19). 141 “Thou shalt not sow thy
vineyard with [458]two kinds of seed” (Deut. xxii. 9). In the former
case only the sowing of divers kinds is prohibited, but the produce of
such sowing is not forbidden; in the latter case, if the law is
transgressed, the produce of both the vine and the seed is not to be
used for any purpose whatever (‫‏אסור בהנאה‬‎), for the law is followed
by the words, “lest the whole fruit be forfeited, the seed which thou
hast sown and the increase of the vineyard.”

Although these and similar 142 precepts are introduced by the words
“Ye shall keep my statutes (‫‏חקתי‬‎),” and no reason is given for the
enactment of these statutes, it seems, from the position occupied by
these laws in a section of moral precepts, that they serve as
reminders of the important lesson that our conduct should be
regulated by the principles of contentment and simplicity of life,
principles which are the best safeguard against undue desire for
luxury and superfluity. The prohibition of sowing divers kinds of seed
further reminds us of the importance of preserving our heart in a
state of simplicity and purity; that twofold weights, twofold measures,
and especially a twofold heart are an abomination to the Lord.

In reference to animal food the following principles are observed:—


[459]
1. The killing of animals and the consuming of their flesh must not
tend to create savage and cruel habits. It is therefore forbidden—

(a.) To cut off a piece of flesh from a living animal for our food (‫‏אבר מן‬
‫החי‬‎“a limb of a living animal”).

(b.) To kill the parent with its young on the same day (Lev. xxii. 28;
comp. Deut. xxii. 6).

(c.) To give unnecessary pain to the animal in killing it. The various
regulations for the lawful killing of animals, ‫‏שחיטה‬‎, handed down by
Tradition as Mosaic, ‫‏הלכה למשה מסיני‬‎, are not only in harmony with
this principle, but seem in many instances to have been dictated by
it.

(d.) To eat the blood of beasts and birds (Lev. xvii. 12, 14). The blood
contained in the meat is removed as far as possible by having the
meat soaked in water for half-an-hour, and then kept covered with
salt for an hour, the salt being again removed by rinsing. This
process is called kasher; that is, preparing the meat so as to make it
kasher (‫‏כשר‬‎“fit for food”).

2. The flesh of beasts and birds that have died from any other cause
than having been killed in the manner prescribed is forbidden. The
flesh of animals that have been killed in the prescribed manner, but
are found to have been affected with some dangerous disease, is
also forbidden as t’refah (‫‏טרפה‬‎). 143

3. With regard to the distinction between animals allowed for food


and those forbidden, all animals are [460]divided into ‫‏בהמה‬‎and ‫‏חיה‬‎
“cattle and beast,” ‫‏וף‬‎“bird,” ‫‏דג‬‎“fish,” and ‫‏שרץ‬‎“creeping thing.”

(a.) With regard to cattle and beasts, the rule is given, “Whosoever
parteth the hoof and is cloven-footed and cheweth the cud, that you
may eat” (Lev. xi. 3).—The clean cattle (‫‏בהמה טהורה‬‎) and the clean
beasts (‫‏חיה טהורה‬‎) are enumerated in Deut. xiv. 4 and 5 respectively.

(b.) A number of birds are enumerated (Lev. xi. 13–19) as forbidden,


but no general characteristics of the clean or the unclean birds are
given; and as we are uncertain as to the exact meaning of the
names of many of the birds, we only use for food such birds as are
traditionally known as “clean birds.”

(c.) Fish that have scales and fins are permitted; others—e.g., the
eel—are “unclean” (ibid. xi. 9–12).

(d.) “All winged animals that creep (‫‏שרץ העוף‬‎), going upon all four,
shall be an abomination unto you. Yet these may ye eat of, every
flying creeping thing that goeth upon all four, which have legs above
their feet, to leap withal upon the earth; even these of them ye may
eat; the arbeh with its kind, and the soleam with its kind, the chargol
with its kind, and the chagabh with its kind” (ibid. 20–22). These are
certain kinds of locusts that satisfy the above condition. (Comp.
Maimonides, Mishneh-torah, Hilchoth maachaloth asuroth i. 21–23.)

(e.) “And every creeping thing that creepeth upon the earth shall be
an abomination; it shall not be eaten” (Lev. xi. 41). In this prohibition
are included all kinds of worms such as are found in fruit, and mites,
snails, oysters, lobsters, crabs, &c. [461]

4. The milk of “unclean” cattle or beasts (e.g., asses’ milk), the eggs
of “unclean” birds, and the roe of “unclean” fish (e.g., caviare
prepared of the roe of the sturgeon) are likewise forbidden.

5. “Ye shall eat no manner of fat, of ox, or of sheep, or of goat” (Lev.


vii. 23). From the context we learn that only those portions of the fat
of cattle are forbidden which in the case of sacrifices were burnt
upon the altar as an offering made by fire unto the Lord, viz., “the fat
that covereth the inwards, and all the fat that is upon the inwards,
and the fat that is upon the kidneys which is by the flanks” (ibid. iii. 3,
4). The forbidden fat is known by the name ‫‏חלב‬‎, chelebh, whilst the
fat permitted as food is called ‫‏שומן‬‎, shuman.

6. “Therefore the children of Israel do not eat of the sinew which


shrank, which is upon the hollow of the thigh, unto this day: because
he touched the hollow of Jacob’s thigh in the sinew that shrank”
(Gen. xxxii. 33). This law is designed to remind us of the wrestling of
Jacob with the man who attacked him, which struggle forms a type of
Israel’s fight against the evil threatening him from within and from
without, and teaches us the lesson that, despite temporary troubles
and struggles, Israel will ultimately be victorious. The hind-quarters
of cattle are not eaten unless the forbidden fat and “the sinew that
shrank” (‫‏גיד הנשה‬‎) have first been removed from them.

7. “Thou shalt not seethe the kid in its mother’s milk” (Exod. xxiii. 19).
Tradition explains this law as forbidding all mixture of meat and milk
(‫‏בשר בחלב‬‎). In its literal sense the verse in which this law is
[462]mentioned seems to point to the duty of self-restraint, as if to tell
us that we should not greedily devour the first ripe fruit, or the young
immediately after their birth.

The significance of the law may be learnt from the fact that it is
mentioned three times in the Pentateuch. Hence the strictness with
which this commandment is observed in Jewish homes. In a Jewish
household, established in accordance with Jewish law and tradition,
there are two separate sets of utensils, the one to be used for the
preparation of meat-diet, the other for the preparation of milk and
butter diet.

The flesh of fish is not considered as meat in this respect, nor are
fish subject to the laws of shechitah.
[Contents]

Notes.

1. On Page 459—1a.

The prohibition of eating meat taken from the body of an animal


whilst alive is based on the words ‫‏אך בשר בנפשו דמו לא תאכלו‬‎“But
flesh, when the blood thereof is in its soul, shall ye not eat” (Gen. ix.
4). The phrase “to be in the soul” means to be surrounded and
animated by the soul, to be in the midst of active, living organs of the
animal. “The blood of an animal is in the soul thereof” may therefore
be paraphrased thus, “The blood hath its vital powers and the animal
is alive.” (Comp. Lev. xvii. 11.)

This prohibition is one of the ‫‏שבע מצות בני נח‬‎“the seven Noachide
commandments,” i.e., commandments which, according to Tradition,
were already in force in the days of Noah, and are binding on all his
children or all mankind, and not on the Israelites alone; viz., (1) the
prohibition of idolatry (‫‏עבודה זרה‬‎), (2) of murder (‫‏שפיכות דם‬‎), (3) of
adultery (‫‏גלוי עריות‬‎), (4) of blasphemy (‫‏ברכת השם‬‎), (5) of robbery
(‫‏גזל‬‎), (6) of eating meat taken from a living animal (‫‏אבר מן החי‬‎), and
(7) the institution of courts of justice (‫‏דינין‬‎). See Babyl. Talm.,
Sanhedrin 56a. [463]

2. On Page 459—1c.

The existence of certain rules concerning killing animals for food


included in the oral teaching of the Torah is derived from the
following passage: “Thou shalt kill of thy herd and of thy flock which
the Lord hath given thee as I have commanded thee” (Deut. xii. 21).
In the Commentary of Rashi, ad locum, we read: “Here we see that
certain commandments have been given with regard to the killing of
animals, how this should be done. These commandments are
comprised in Hilchoth Shechitah, which form part of the Oral Law,
revealed to Moses on Sinai.” They are fully discussed and explained
in the first chapter of the treatise Chullin.

Any deviation from these rules in the act of killing the animal renders
the shechitah unlawful (‫‏פסולה‬‎). The killing of cattle, beasts, or fowl
for food is therefore entrusted only to such persons as possess a
knowledge of the rules of shechitah and are skilled and trustworthy.
The beth-din or the Chief-Rabbi decides whether a person has duly
qualified himself for the office of shochet (‫‏שוחט‬‎), and whether he may
kill animals for kasher food.

It is the duty of the shochet to examine the animal before killing it,
and to satisfy himself that it is not in a dying condition; after the
shechitah of any cattle or beast (‫‏בהמה‬‎or ‫‏חיה‬‎) he must examine the
lungs to assure himself that they are in a normal condition. If he finds
them in a diseased state he declares the flesh of the animal as
t’refah (‫‏טרפה‬‎) and unfit for food. In the case of poultry the
examination is not made by the shochet; but if any deviation from the
normal state is discovered in the lungs or in any other part, the meat
must not be used as food unless the animal has been examined by a
competent person (Rabbi or dayyan), and declared by him to be
kasher.

As to the beneficial influence of these examinations on the general


condition of health in the Jewish community, see Dr. H. Behrend’s
articles in Jewish Chronicle, November 12, 1880, and October 24,
1890, and Nineteenth Century, October 1890.
3. On Page 459—1d.

The following particular rules are to be observed in kashering meat:


(a.) The meat is first soaked in water for half-an-hour; this [464]must
be done within three days after the killing of the animal. It is then
taken out of the water, placed on a slanting board or in a wicker-
basket, and after a few minutes, when the water has sufficiently run
off, sprinkled on all sides with salt. After the lapse of an hour the salt
is again removed by soaking and rinsing.

(b.) In case of urgency, when, e.g., the meat is wanted for a patient,
or when on Friday afternoon there would not be left time enough for
cooking or roasting the meat, it need only be kept in water for fifteen
minutes and in salt for half-an-hour.

(c.) In kashering poultry all the inner parts of the animal must be
taken out and salted separately; the rest must be sprinkled with salt
both within and without.

(d.) Liver is salted a little and roasted on fire, not in the oven or in
any vessel. This done, the liver may be cooked or roasted in any
way.

(e.) The heart is cut open before the salting, and a piece is cut off at
the apex, in order that the blood may run off more easily.—For the
same purpose the horny part of the legs is cut off.—The head must
be opened and sprinkled with salt on both sides, after the brain has
been taken out; from the latter the skin is drawn off, and then it is
salted.

(f.) Eggs found in poultry are treated as meat, but must be salted
separately.
(g.) The vessels used for soaking and salting the meat should not be
used for other purposes.

4. On Page 459—1c.

The law of shechitah applies only to cattle, beasts, and birds (‫‏בהמה‬‎,
‫‏חיה‬‎and ‫‏עוף‬‎); there is no commandment as regards the killing of fish.
Tradition supports this exception by reference to the distinction made
in Num. xi. 22: “Shall the flocks and the herds be slain (‫‏ישחט‬‎) for
them, to suffice them? or shall all the fish of the sea be gathered
together (‫‏יאסף‬‎) for them, to suffice them?” Although the latter term
(‫‏יאסף‬‎) is also used of quails (ibid. 32), no such inference is made
with regard to birds, because in ver. 32 the term ‫‏יאסף‬‎is not
contrasted by ‫‏ישחט‬‎; besides, the verb ‫‏שחט‬‎is frequently applied in
the Law to birds, but never to fish. Comp. Babyl. Talm., Chullin, p.
27b.

There is this difference to be observed between ‫‏בהמה‬‎on the [465]one


hand, and ‫‏חיה‬‎and ‫‏עוף‬‎on the other. In the case of the latter two the
shechitah must be followed by the covering of the blood (‫‏כסוי דם‬‎Lev.
xvii. 13). The object of this law is, according to some, to prevent the
blood being used for idolatrous and superstitious purposes, as birds
and beasts were generally hunted in the fields, mountains, and
woods, places frequently associated in the imagination of the
ancients with evil spirits and the like. (Comp. Commentary of R.
Obadiah Seforno on the Pentateuch, ad locum.) The law was
perhaps intended to impress the lesson on the mind of the hunter
that the blood shed of a living being presents a ghastly sight that
offends the eye of man. He will accustom himself to think that taking
away the life of another being, even of an animal, is an act of grave
responsibility, and will not be led to misuse his weapons against any
of his fellow-men.

5. On Page 460—3b.
Comp. Mishnah, Treatise Chullin, iii. 6.—The characteristics of the
clean and the unclean cattle and beasts are given in the Pentateuch,
but the characteristics of the clean or the unclean birds are not
mentioned in the Law. Our Sages, however, declared every bird of
prey—or every bird that seizes its food with its claws, and lifts it up
from the ground before eating it (Rashi) to be an unclean bird; while
all birds are clean that have a projecting claw (‫‏אצבע יתרה‬‎a claw
longer than the rest) and a crop (‫‏זפק‬‎), and whose stomach has a
membrane that can easily be peeled off (‫‏קרקבנו נקלף‬‎). Another rule is
this: Birds that dwell and associate with unclean birds are unclean.
“Not without reason does the starling go to the raven: they are of the
same species” (Babyl. Talm., Chullin 65b). The sentence serves also
as a moral lesson (ibid., Baba Kama 92a). At present, however, only
those birds are killed for food which are known traditionally to have
always been considered as “clean birds” (Maimonides, Mishneh-
torah, Hilchoth maachaloth asuroth, i. 14–20; Tur Joredeah, chap.
lxxxii.).

6. On Page 461—7.

Onkelos translates this commandment: ‫‏לא תיכול בשר בחלב‬‎“Thou


shalt not eat meat in milk,” in accordance with the Oral Law. The
threefold repetition of the commandment forbidding [466]the seething
of a kid in its mother’s milk is explained traditionally to indicate a
threefold prohibition: that of boiling meat and milk together, that of
eating such mixture, and that of deriving any benefit whatever from it
(‫‏ואיסור‬‎, ‫‏איסור אכילה‬‎, ‫‏איסור בישול הנאה‬‎). In obedience to the principle,
“Make a fence round the Law,” we abstain from milk or butter for
some time after having partaken of meat.

7. On Page 461—4.

The honey of bees is an apparent exception from the rule that the
products of the unclean animals are forbidden. The honey mentioned
in the Bible is mostly the juice of fruit, especially of dates; but the
honey of bees is also mentioned (Judges xiv. 8). It is assumed that
honey does not contain any part of the bee itself, but is merely the
juice of the flowers sucked and again discharged by the bees. (See
Babyl. Talm., Bechoroth 7b; Maim., Mishneh-torah, Hil. maachaloth
asuroth iii. 3.)

Note 8.

In addition to the things enumerated in this chapter as forbidden,


there is the prohibition of “wine of libation” (‫‏יין נסך‬‎). Everything used
in the worship of idols was condemned, and could not serve as food,
drink, or any purpose; it was ‫‏אסור בהנאה‬‎. Wine was frequently used
by heathens in libations to their idols. The wine of a heathen was
therefore always suspected of having been employed in idolatrous
libations, and was consequently forbidden as ‫‏יין נסך‬‎. Since, however,
such libations have ceased this prohibition has also lapsed.

It has, however, not lapsed in its entirety. It is only the ‫‏אסור הנאה‬‎that
is no longer in force. The prohibition of using wine prepared by non-
Jews (‫‏סתם יין‬‎) as a beverage still continues. This and similar
prohibitions were intended as a barrier against the increase of mixed
marriages among the Jews. (Comp. Babyl. Talm., Shabbath 17b.)
[467]

You might also like