----boundary-LibPST-iamunique-167405442_-_-
Content-type: text/plain
Good morning,
The safety argument (see my previous message) is serious enough that Robert's list of pro-procedure variables arguments deserves to be reconsidered.
There is certainly value in them, however,
upon scrutiny, some of them start to appear a little less convincing.
> 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.
Not necessarily: wrappers for all the standard functions (inlcuding ones Robert so usefully identified, like Cube) could be exported from a standard module Math (the old Math could become HostMath).
The abstract type Function (or MonadicFn...) would be exported too, of course.
> 3 - The extra capabilities of objects seem unnecessary for Cos
This would be irrelevant if Math.cos is a pre-provided standard object.
> 2 - People with a scientific background grew up with FORTRAN, and
> are familiar with this type of declaration.
Teaching old dogs new tricks... How true. <sigh>
Yet f: Math.Function; is not much harder
> 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;
But first, MonadicFn would already be available as Math.Function,
and from the old Math and Robert's Lib we know the list of simple functions that should be provided in the new Math, so perhaps 99% of functions actually used would need no declarations.
> 5 - Efficiency. Methods require an extra level of indirection. Inside
> a big engineering sum this just seems like unnecessary overhead.
Just one extra memory access. With a modern L2 cache -- is it a problem? Hardly.
Do simple loop bodies where this overhead would be critical occur often?
Not in my experience. And in the rare cases when they do, a call to HostMath (with an import of SYSTEM, if necessary) would be adequate.
> 6 - Brevity. .. The .Eval in cube.Eval
> just seems to visually clutter maths expressions.
M.cube.Eval(x) vs L.Cube(x).
The difference is really not that great. Although visible.
In my numeric problems, this kind of expressions are a fraction of the actual code.
> 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.
But it does, if one selects M.cube.Eval.
> I can't easily work out where cube.Eval is defined.
One can, for M.cube.Eval.
On balance,
if one is concerned with the safety argument against procedure variables (F1, What's New),
then relegating them to SYSTEM-level features and providing something like a pair of Math/HostMath modules as described above, appears to be a reasonable compromise.
> 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?
As far as I understand, any method call involves just one extra memory jump, irrespective of the length of inheritance chain (compiler creates a type descriptor for each type, with an array of pointers to method entry points, and for a non-extended method, the pointer is simply copied from the parent type descriptor to the child's one).
Cheers
Fyodor
Powered by the E-mail PIM - Info Select - www.miclog.com
--------------------------------------------
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-167405442_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0M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