On Tue, 2006-09-05 at 11:06 -0400, Peter Tanski wrote:
> On Sep 4, 2006, at 6:59 AM, skaller wrote:
>
> > On Sun, 2006-09-03 at 19:37 -0400, Peter Tanski wrote:
> >
> >> ---------------------
> >> typedef typecase[clst] C clst => clst
> >> endcase a1 = company;
> >
> >> I get an "unknown" parser error.
> >
> > You have the typedef syntax backwards:
> >
> > typedef company = typecase[clst] C clst => clst endcase;
> >
> > Also you'd get an error on 'a1' here .. what is 'a1'?
>
> I was basing my typedef on your definition:
>
> typedef fun ite(b:TYPE, s:TYPE, r:TYPE): TYPE =>
> typecase [] True =>
> typecase [x] x => s endcase
> endcase
> b r
> ;
>
> which seems to have the same format as the C/C++ keyword typedef; I
> did not realise you use typedef in two different ways (depending on
> context): the OCaml way and the C/C++ synonym-way.
The form:
typedef fun f(..): .. => t;
is simply sugar for
typedef f = fun (..): .. => t;
In both cases the symbol 'f' is simply an alias for a lambda
expression.
> Neither seems to
> be defined in the documentation.
Yeah, that's so.. we're working on it :)
> As for the 'a1', I was following your definition for typecase:
>
> > typecase [v1, v2, ..] pattern => result endcase argument
>
> from the message you sent on Friday, 01 Sept.
Sure, but the typecase .. endcase is a case, so
typecase .. endcase arg
is an application. You can certainly write:
typedef x = typecase .. endcase int;
but the argument does have to be defined (int is defined
in the library). There are two ways to define it: as a
free variable (bound to the environment, eg 'int').
Or as bound variable, using one of the following
semantically equivalent forms:
typedef x[a] = f a; // type schema
typedef fun x(a:TYPE):TYPE = f a; // type function
typedef x = fun (a:TYPE):TYPE = f a; // anonymous type function
The type schema, whilst intended as a sugar for the full monte,
is actually implemented differently ;( This is mainly because
for non-types, such as:
fun f[t] (x:t)=>x,x;
the 'proper' way, that is, the Haskell way:
fun f (t:TYPE) (x:t) => x,x;
requires an expression like:
f int 22
to be handled, which requires 'kind inference'. In the
presence of overloading this is HARD! The simplified
notation uses
f[int] 22
so the 'kind' is indicated syntactically by the [].
--
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