Escape codes and special characters for regex semantics is a deficiency of the 1980s programming world, not Javam
Escape codes and special characters for regex semantics is a deficiency of the 1980s programming world, not Javam
Stephen Cole Kleene was a brilliant mathematician and when he invented regexs in the 50s of the past century, he anticipated a lot of concepts that became popular in computer science, such as recursion (which he also founded as a branch of mathematics and computer science together with Alonzo Church, Kurt Gödel and Alan Turing)
Java on the other hand has some deficiencies here and there and it's not really a modern language free from old cruft
Where are the Lispers when you need them? :)
Java,for example, can't have proper generics because at the bytecode level (the "real" Java) they are not supported, it can't have static constructors because it would break inheritance and they had to come up with static blocks, it has no support for static methods with the same signature of an instance method, because the call syntax doesn't differentiate a call to a static method from a call to an instance method, so the compiler can't tell which method is being called, etc. etc.
These are all consequences of the original choices taken 25 years ago when they designed the bytecode and the sintactic sugar over the bytecode, that still live with us today
Such elegance.
Might as well write code in machine code while we're at it.
How would you write a specification for that language in any other way that was more elegant? Sure, you could make it more verbose, but that wouldn't make it easier to understand the whole of it, or why it is the way it is.
> Sure, you could make it more verbose, but that wouldn't make it easier to understand the whole of it, or why it is the way it is.
Absolutely it would. The way to understand a large thing, is to understand the smaller components and then put them together. Regular Expressions to do not compose well.
That is patently untrue. Regular expressions compose under a number of important mathematical operations, such as union, intersection and concatenation. If your PL supports string interpolation, it's trivial to compose them in these ways (well ok, maybe not intersection). Nobody says that your regex needs to be written as a single string.
P.s. do you realise how much harder it would be to understand the same thing in machine language?