skaller wrote:
> should work.  Or perhaps:
>
>       const inf: double = "1.0/0.0";

I'd prefer that. I wish we could do this, but it doesn't compile because 
of the "virtual const".

************************
typeclass Floating[T] {
  virtual const inf: T;
  virtual fun isinf: T -> bool;
}

instance Floating[float] {
  const inf: float = "1.0f/0.0f";
  fun isinf (x:float) : bool => (abs x) == inf;
}

open Floating[float];

var x = inf[float];
************************

>> I could see it useful to be able to have a numeric_limits-like typeclass 
>> to provide this kind of metadata about types.
>
> C++ numeric limits are singularly useless because they can't
> be accessed during pre-processing .. which is where they're
> usually needed. C macros don't have this problem .. and
> are available at run time too.

We can't do that yet, right? That would require something like MetaOCaml?

-e


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to