On Tue, Mar 8, 2011 at 7:06 PM, Alan W. Irwin <ir...@beluga.phys.uvic.ca> wrote:
> On 2011-03-06 19:58-0500 Hezekiah M. Carty wrote:
>
>> OCaml should be matching more closely now:
>
> Hi Hez:
>
> The C implementation of the range adjustment sucked in an obvious way
> so I had to change it and all other implementations of example 27
> including the OCaml one.  Since I am floundering around with the OCaml
> language (programming by analogy rather than from any knowledge of
> what I am doing) could you review my x27.ml change (revision 11613)?
>

The changes look good to me.

> That revision does give the same answer as C, but it strikes me that the
> "style" of the xmin, xmax, ymin, and ymax reference logic is quite
> distinct from all other floating point calculations so you may want to
> change it to be consistent with the rest.  Furthermore, I don't
> understand at all why xmin, etc., must be initialized since that
> happens in any case for i==0.  But if I dropped that "unneeded"
> initialization the ocaml compiler complained.  So I left it in with a
> comment.
>

This is due to a few facets of the OCaml language.  OCaml does not
allow you to create uninitialized values - there is no "null" value.
This is why the values need to be initialized.  It also has the happy
result of no segfaults in pure (no external C) OCaml programs.  OCaml
values are also immutable by default - the "ref" keyword is used to
create a mutable value.  These differences from C imposes a bit of
extra effort when porting examples from C and trying to stay as close
as possible to the original C style.

I hope this clarifies things somewhat.  Thank you for propagating the change!

Hez

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to