[clean-list] declaration order

Jigang Sun Jigang.Sun at student.paisley.ac.uk
Tue Dec 26 01:55:05 MET 2006


I observed that unlike traditional language, Clean does not care declaration order, for example 

//Start module
module try
import StdEnv
instance plus Int
where
 ( plus ) x y = x + y  

class (plus) infixl 6 a :: !a !a -> a		

Start =  1 plus 3
produces 4 without complaining. 

In the example, type class instance is declared before type class.

If this were an imperative language, the compiler should complie in contextual order, i.e. compile type class declaration first and store the result somewhere, when meet type class instance declaration lately, read the type class information and create an type class instance. I wonder if this is a common feature of functional language. 

Thanks.
Jigang




This year the University of Paisley will not be producing or sending official University Christmas Cards.  Instead, having received feedback from a number of stakeholders, it has been decided to establish a fund to support students in need.

We thank you for your continued support

Legal disclaimer
--------------------------

The information transmitted is the property of the University of Paisley and is intended only for the person or entity 
to which it is addressed and may contain confidential and/or privileged material.  Statements and opinions expressed in this e-mail may not represent those of the company.  Any review, retransmission, dissemination and other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender immediately and delete the material from any computer. 

--------------------------




More information about the clean-list mailing list