One could argue that java the language was very influenced by SmallTalk
and
Objective-C. Yes, when writing a language the tasks that are necessary
do have
to be done, and the language is easier to learn when it looks similar to
other
established languages. But let's think about our inString
method. Maybe
we
want to start somewhere within the string. Do we write inString(in
startPoint, str
string, str matchPatter). Are we allowing overloading? Or do we
create
inStringBeginningAt(str matchString, str string, int startPoint) because
unique
symbols are easier for us but harder for programmers, as they have to
remember two symbols and parameter signatures. Is the indexing 0 or 1?
What
about standard perl matching patterns. Do we overload inString and
consider an
exact match a simple regular expression and parse for escaped
characters in
order to understand the regular expression code? Oh, but what if
the clients
want to search for an exact match of a regular expression phrase.
Maybe we
should create a RegularExpression object, overload toString and have
inString(str targetString, RegularExpression regex). Also, inString(str
targetString, RegularExpression, int beginningAt).
What about
substrings, so we look for matches in between position i and k.
What's
the best api for the RegularExpression class? String
constructors, meaning
parsing, and the creation of a grammar to distinguish
between any match on a
pattern of any length (*) and a match on the asterisk.
Aren't regular
expressions hard to read? Should we simplify what regular
expressions we accept
or maybe subclass RegularExpressions and have
SimpleRegularExpressions. The
superclass will take standard perl, the the
subclass will take our own
simplified grammar. Every option comes
with five forks: what do I want
now, what will I want later, what do the clients
want, what will the clients
want in the future, and what do we have time to accomplish? I will
concede this
point: the latter question leads language designers who are using
C-
style syntax to have solutions that look kinda the same. The Objective-C
designers chose to avoid overrides The python folks didn't like all those curly
braces. Seems to me people use a different
adjective (Object-Oriented
languages) (or verb (imperative, functional
languages) when working with
regular expressions. [ Reply to This | Parent | # ]
|