grammar for class types, reraised

From: Hendrik Tews (tews@tcs.inf.tu-dresden.de)
Date: Mon Jun 14 1999 - 10:04:32 MET DST


Date: Mon, 14 Jun 1999 10:04:32 +0200
Message-Id: <199906140804.KAA01028@ithif20.inf.tu-dresden.de>
From: Hendrik Tews <tews@tcs.inf.tu-dresden.de>
To: caml-list@inria.fr
Subject: grammar for class types, reraised

Hi,

on May 14th I sent the appended message to the ocaml mailing
list. Unfortunately I haven't seen any answer so far. Could one
of the developers please answer these questions (or give some
pointers)?

1. What is the difference between

# class type b = [int, string] a;;

and

# type c = (int, string) a;;

assuming some class type a with two type parameters?

And why do I have to use different parentheses in both cases?
(Yes, I know, it's what the manual says, but I would expect that
one kind of parentheses should be enough for all kind of type
parameters. )

2. Why is it not possible to add type constraints to the first
kind of type abbreviation, like in

class type ['a] c = ['a, string] a constraint 'a = int;;

3. (To re-raise a question from John Prevost which has never been
addressed:) Why is it not possible to mix type definitions and
class type definitions like in

# class type a = object method m : a end
# and
# type b = Node of a | Tree of b * b

(Yes, it is possible to use the < ... > notation, but it is not
possible to use # with such types.)

Bye,

Hendrik



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:23 MET