On Thu, 2006-09-07 at 23:51 -0400, Peter Tanski wrote:
> On Sep 7, 2006, at 12:20 PM, skaller wrote:

> GHC actually runs on every platform  
> Felix runs on (currently)

Installing it is an issue: Ocaml is easy to build and upgrade,
GHC isn't. However, we could find out by trying it, maybe
it isn't so bad.

>  This may simply be academic--no sense  
> changing horses in mid-stream.

It isn't academic, it's an option. Some concerns are:

(a) performance of generated code. 
Yes it really matters a lot for a tool that is going to be used
regularly.

(b) Functional.

It may seems strange, but many things work  much faster
if one uses mutation. The inliner, for example, inlines
code in some ad hoc dependency order: if it couldn't
modify the instruction streams in place the algorithm would
be an order of magnitude slower.

Almost all the 'slowness' in the compiler at the moment
is due to using functional techniques.

> > Typeclasses identify the notion of 'kind' with 'typeclass' the
> > same way run time OO identifies the notion of 'type' with 'class'.
> 
> That is actually well put but I'm not sure what you mean by 'kind'.  

> In Haskell, 'kinds' are the type of types, 

Yes.

> for example the type of  
> Int is *, 

In Felix the type of int is TYPE.

> that is (Int :: *); constructors have type (* -> *)-- 

Functions have type TYPE too, all types have type TYPE.

Simple type functions, on the other hand, have type TYPE -> TYPE.
For example:

        typedef fun f(x:TYPE):TYPE=>x * x;

has type

        TYPE -> TYPE

A variant constructor has type TYPE because it is just a function:

        union Person = | Me of int | You of int
        Me: int -> Person

> data NewInt = N Int
> -- (Int :: *), (N :: Int -> NewInt), (NewInt :: Int)
> where Int may be characterised as a 'kind', the distinction between  
> 'kinds' and 'types' is gone as of GHC 6.6 and the System F type  
> system: they are the same thing (to the intermediate-language type  
> system, see http://hackage.haskell.org/trac/ghc/wiki/ 
> IntermediateTypes).

This is desirable. In Felix the type of TYPE would be

        METATYPE

and the type of that would be

        METAMETATYPE

so there's be an infinite regress of kinds. I'd like to get
rid of that.

> Subclassing type classes is a bit different than deriving functors or  
> C++ classes.

I know. But the same problem exists. When you subclass a typeclass
you're adding constraints:

> class Eq a => Ord a where

So you still have the covariance problem, but I can't
write you an example until after at least 3 more cups of coffee :)

Eq and Ord are 'subkinds' of *, it's a subset of the types of
all the types, which admit equality and ordering, respectively.

The subkinding relation written => above is similar to
inheritance.

It also looks like 'Eq' is nominally kinded, which is quite bad.

For example in Felix, I would like to use 'typeclass' kind
of stuff to handle arithmetic and STL iterators.

But the kinding is quite complex. Be interesting to see this
done with typeclasses and compare to the way I did it:
with constrained polymorphism (my constraints are really
a lame attempt to make a typeclass :)

But an example of the issue is: we have 'widening conversions'
like int->long and float->double, and also widening arithmentic
like int * long -> long (C rules).

Unfortunately .. since I'm not a Haskell programmer I can't
easily explain the limitation OO imposes.

> As above, type classes encapsulate the "polymorphism" of operations  
> over types, not properties of types.  I could define types perfectly  
> well without type classes but it would be inconvenient without them.

I could write code in assembler without Haskell .. :)

> Is ( x == y  =  not ( x /= y) ) an equation between arrow compositions?

Yup, it is.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
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