At 17:30 +0000 2/24/08, Luke Palmer wrote:
>On Sun, Feb 24, 2008 at 3:00 PM, Aristotle Pagaltzis <[EMAIL PROTECTED]> wrote:
And I read both very carefully and failed to understand most of it.
I use perl for physics and engineering mostly because I forgot most of my
FORTRAN long ago and perl works everywhere.
I really want to use complex numbers, vectors, matrices, and sometimes
quarternions. I really want to be able to define or use previously defined
operators in a way that I learned in the 50's. I want my compiler to understand
when I use vectors in which the components are complex numbers. I want dot and
cross product to work. I want to be able to multiply a matrix by a vector and
get a polite error message if I try that with impossible arguments.
What I think I learned from those two messages is that it's damnably difficult
for a parser to figure out what I'm doing. Perhaps it just isn't worth while.
But. . .
I really don't mind informing my compiler in advance about what I want a
variable to be treated as. Typedef {}, Dimension () and the like are no problem
at all. I don't mind. And I think that would also apply to my scientifically
oriented friends.
Wouldn't it make life easier for the parser to overload the * operator into a
dot product whenever both arguments have been defined as vectors or been
returned as vectors by a previous operation? One could even use ** for a cross
product since raising to a vector power is unreasonable. Just recognizing the
special use declared and passing the operation off to a required subroutine
would be adequate. Yes. It can all be expressed in simple object-oriented
language but all of the File::Fu stuff is unduly complicating the use in
mathematics.
Practical Extraction and Reporting are what perl is about and I know I'm
stretching the plan but just a bit of code that will allow, but not require,
typedefs - er classes - of special things that cause operators to be passed to
subroutines - er class methods - to be written could make a big difference.
Even translating ^ to pow($x,$y) would be useful to some, but I remember that
much FORTRAN. And -2^2 is -4 (correctly?) in C on a two's complement machine.
--
--> Life begins at ovulation. Ladies should endeavor to get every young life
fertilized. <--