On Fri, 2006-09-08 at 20:35 -0400, Peter Tanski wrote:
> On Sep 8, 2006, at 7:32 PM, skaller wrote:

> fun same[ (Eq[T]) => T] (T * T) -> Bool = { }...
> 
> (Note there is more syntax we could figure out.  The Haskell syntax is:
> 
> same :: (Eq a) => a -> a -> Bool

I think we'd have something like:

        fun same[T,Q where Traint[T,Q]]

The reason is existing practice:

        fun f(x:int, y:int where x+y > 0):int expect result > 0 = { .. }

is how Felix states pre- and post- conditions for functions.

The syntax:

        fun same[T:Eq] 

is already supported for constraints, and is just sugar for

        fun same[T where Eq[T]]

However at present the constraint is restricted to a typeset.
So there is already a way to write these constraints, and they're
already checked during overloading .. however the constraints
are NOT currently part of the type system. Seems like fixing
that is the key here.

> (2) The type checker needs two things to validate a function: the  
> aforementioned data table for the type class and an instance table  
> for the data type itself.  

Ok, sound easy enough (famous last words .. :)

The problem is as before .. you can't consult a table
you haven't built yet.

The scope of a type class is the block it is defined in.
The WHOLE block. Not just after its definition.

Felix has no provision for sequentially binding things,
using previously bound definitions.

> Of course there may be more efficient ways to go about this--all this  
> typechecking stuff mostly stays in the compiler except when you have  
> compiled a library and need to keep the data tables for types and  
> typeclasses so future programs without reference to the source code  
> may know the constraints. 

Not an issue at the moment: it's a whole program analyser,
there is no separate compilation.

I would like to be able to 'cache' bound symbol tables,
and even inlined code, but at the moment the caching
is done of the parsed, macro processed AST: Felix
checks time stamps and verifies version numbers,
then Marshalls in a pre-compiled AST (which is just
the usual tree of nodes).

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