Newsgroups: comp.lang.functional, comp.lang.java.programmer
From: Andreas Rossberg <rossb...@ps.uni-sb.de>
Date: Wed, 29 Jun 2005 14:47:43 +0200
Local: Wed, Jun 29 2005 8:47 am
Subject: Re: Jon's many-language ray tracer
Chris Rathman wrote: Yes, and doesn't the size of this table hence make precisely my point, > My rule of thumb is that if it can handle the shapes example, then it's i.e. that such a broad definition of OO is utterly useless? ;-) > (Still mulling how to best do the example for Alice ML). I don't hesitate at all to concede that Alice ML is not an object-oriented language. :-) Having said that, as the page's problem description stands, it is signature SHAPE = functor Shape (val x:int val y:int) = functor Circle (val x:int val y:int val r:int) = functor Rectangle (val x:int val y:int val w:int val h:int) = functor DoSomething (S : SHAPE) = structure R = Rectangle (val x=10 val y=20 val w=5 val h=6) structure _ = DoSomething R Note that the problem description does not explicitly require shapes to Now, if you really need shapes first-class, then you need first-class signature RECTANGLE = signature CIRCLE = val r = pack R : RECTANGLE fun doSomething p = val _ = List.map doSomething [r, c] Does that suit you? Caveat: all code untested. - Andreas -- Let's get rid of those possible thingies! -- TB 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.
| ||||||||||||||