----boundary-LibPST-iamunique-1811568918_-_-
Content-type: text/plain
>> Robert,
>> Thanks for your note. But someone please help me understand this.
>> I proposed ...
>> Stan
I didn't quite understand your question: are you asking me to explain the
advantages of Procedure types, or of objects? I think you are asking the
former.
My position is that I think they both have advantages, and so should
both be available. If only one was allowed I would definately go the
o-o way; it is much more powerful.
So, some advantages of procedure types, an unbalanced assessment:
1 - Many existing functions (eg Math.Cos) are procedures. If I want to
numerically integrate it in an o-o integrator (like mine is in fact!)
I would need to create a wrapper object.
2 - People with a scientific background grew up with FORTRAN, and
are familiar with this type of declaration.
3 - The extra capabilities of objects seem unnecessary for Cos, the
above design does all that is wanted of a Cos function.
4 - Consider the following example (taken from LibReals):
PROCEDURE Cube* (x : REAL) : REAL;
BEGIN
RETURN x * x * x
END Cube;
Which can be called by R.Cube (x) - I use IMPORT R := LibReals;
The o-o approach requires:
TYPE
MonadicFn* = POINTER TO ABSTRACT RECORD END;
Cube* = POINTER TO RECORD (MonadicFn) END;
PROCEDURE (fn : MonadicFn) Eval* (x : REAL) : REAL, NEW, ABSTRACT;
PROCEDURE (fn : Cube) Eval* (x : REAL) : REAL;
BEGIN
RETURN x * x * x
END Eval;
Which can be called by
VAR
cube : R.Cube;
BEGIN
NEW (cube); cube.Eval (x).
That's why I say the former is simpler.
(The Module interface is also shorter and simpler.)
5 - Efficiency. Methods require an extra level of indirection. Inside
a big engineering sum this just seems like unnecessary overhead.
6 - Brevity. Generally procedure names are shorter. I use M for Math, R for
LibReals, C for LibComplex, I for LibIntegers. Because there are only a few
much used modules that provide 99% of the functions (by use, if not by number)
this brevity is not confusing (to me).
Complicated expressions with 4 or 5 or more functions on 1 line are
common. Short names for common functions are a significant advantage to
readability and comprehensibility. The .Eval in cube.Eval
just seems to visually clutter maths expressions.
7 - If I select R.Cube, right click, I get immediate access to the interface,
source, and Docu. This is very nice. It does not work if I select cube.Eval.
I can't easily work out where cube.Eval is defined. Who on Earth needs
polymorphism for a Cube function?
I could probably go on ...
Given that procedures are useful how can I pass them to other things
with having procedure valued variables, and thus procedure types?
This does not seek to be a balanced email; I could also write a pro-
objects list. But one advantage I can't resist mentioning is that
I can't save procedure variables to disc, whereas if MonadicFn had
been declared as a Store I could Externalise cube. Question: does
creating a Store extension have a significant overhead inside a
big loop?
Good night
Robert
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
--------------------------------------------
To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
blackbox-request{([at]})nowhere.xy
To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.
Send any problem reports or questions related to this email list to the list owner at
owner-blackbox{([at]})nowhere.xy
Current posting policy:
a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.
b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.
----boundary-LibPST-iamunique-1811568918_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIFxwYXINCj4+ICBSb2JlcnQsXHBhcg0KPj4gIFRo
YW5rcyBmb3IgeW91ciBub3RlLiBCdXQgc29tZW9uZSBw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