Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Ray tracer update
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jon Harrop  
View profile  
 More options Jun 13 2005, 11:17 pm
Newsgroups: comp.lang.functional
From: Jon Harrop <use...@jdh30.plus.com>
Date: Tue, 14 Jun 2005 04:17:54 +0100
Local: Mon, Jun 13 2005 11:17 pm
Subject: Re: Ray tracer update

Daniel C. Wang wrote:
> Jon Harrop wrote:
> {stuff deleted}
>> 1. Not having capitalised constructors worries me, although I've never
>> had a problem (probably because I capitalise them anyway). Could a
>> compiler flag be added to warn of non-capitalised constructors? That
>> would essentially solve that problem.

> I think this is a fair and common gripe. However, the SML match compiler
> is good at spotting errors when you confusing constructors. I find it
> unfortunate that the OCaml pattern match semantics aren't as strong as
> SML. In particular if I'm not mistaken it's impossible for Ocaml's match
> compiler to catch redundant or non-exhaustive matches.

You mean non-exhaustive matches like this:

# function Some _ -> 1;;
Warning: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
None
- : 'a option -> int = <fun>
#

and redundant matches like this:

# function _ -> 1 | _ -> 2;;
Warning: this match case is unused.
- : 'a -> int = <fun>
#

>> 2. I prefer explicit "rec", not implicit as in SML's "fun". I think this
>> only really serves to heighten the "activation barrier" for newbies.

> SML does have "val rec"

> val rec fib = (fn 0 => 0 | 1 => 0 | n => fib(n-1) + fib(n-2))

> not the most pretty I agree.

I think the implicitly rec "fun" is more confusing, for a newbie.

>> 3. No standard way to compile a Standard ML program - MLton- and
>> SML-compiled programs must be different. I was also surprised to find no
>> mach_eps in SML/NJ (perhaps more surprisingly, pre 1.4 Java also lacks
>> this).

> Well this is not exactly fair, since there's only one OCaml system
> around. :)

Well, I compile to bytecode for fast tests and native code for production
output. Mlton produces very fast code but is an order of magnitude slower
to compile to native code than ocamlopt so I want to have a fast compiler.
SML/NJ would fit the bill, only it requires programs to be executed in a
different way.

>> 6. I think a single precision float type for storage in general data
>> structures is a good idea (this makes the x86 C++ version of my ray
>> tracer twice as fast with only trivial changes). There may already be one
>> in SML that I've missed. OCaml only has big arrays.

> MLton supports single precision float types. Single precision float
> types are an "optional" part of the Standard Basis. (I have a gripe that
> the Standard Basis has too many optional parts...)

I see. How do I create a single precision float? Is it Real<32>.real or
something?

>> 7. After all the time and effort spent making SML itself very robust,
>> comparatively little effort seems to have been placed on making it
>> interface safely with non-SML libraries. I can see why, historically, but
>> it is a significant thorn in the idea of teaching SML as a general
>> purpose programming language on an undergrad course.

> There's been quite a bit of work in this area. MLTon's FFI is pretty
> straightforward. The new FFI of SML/NJ is pretty sophisticated. Other
> can chime in... what I know about the OCaml FFI makes me feel like it's
> not soo much better.

Oh no, OCaml's FFI is not any better. That was a generic ML gripe. :-)

Seriously though, and I know I keep saying this, I think great OpenGL
bindings would be incredibly beneficial.

>> Of course, SML is still one of the best languages that I've come across
>> and I'm hugely impressed with its definition, implementations and
>> practical application. So my overall feeling for SML is extremely
>> positive, which might not come across in these criticisms.

> I've finally found my self in a position that makes me have to program
> in C++. I dearly miss SML! SML has it's warts.. but most of the warts
> are erring on the side of clean simple semantics. Some times the clean
> and simple thing is a bit verbose and at times clunky. C++ seems to err
> on the side of making things very concise, but god knows what going on!

Absolutely. My tip is to write ML code to generate C++. ;-)

--
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.