On 11/14/06, skaller <[EMAIL PROTECTED]> wrote:
> On Tue, 2006-11-14 at 09:36 +0000, Rhythmic Fistman wrote:
>
> > I don't really understand typeclasses so of course I suspect
> > that they could be a solution.
>
> Lol. Well, a typeclass is just a set of functions that
> characterise a type (or types).
>
> So you can write an algorithm which works for all
> types of a particular kind, i.e. a generic algorithm.
>
> typeclass Pix[image, pixel] {
>   virtual fun get: image * int * int -> pixel;
>   virtual proc blit: image * (image * int * int);
>   ..
> }
>
> proc Zdraw[with Pix[Image,pixel]
>   (base: image, sprites: array[image * int * int])
> {
>    blit ....
> }

Cool. Bookmarking that. Do you reckon I can use that
cfun/cproc stuff to generate a c library of the same?

> It's kind of like virtual dispatch in C++, except your
> instances can be optimised.
>
> instance Pix[rgb_image, rgb] ....
>
> It's much like an unimplemented C++ template,
> with implemented specialisations, except that the
> typing is sound.

Awesome. How about conversion? Can I generate
the N^2 cases for conversions between N formats?
Or at least ease the pain?

Ta,
RF

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to