From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Mon, 5 Sep 1994 01:01:49 -0400 From: Alberto Nava beto@plan9.cs.su.oz.au Subject: a few questions about alef Topicbox-Message-UUID: 0333ae86-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19940905050149.pEFhZUNcmo6jvTIyLzaV-ouuZo17Vv4Dk9ACODUk_-g@z> I've been working with alef in the last weeks and I have a few questions about it. 1) I had some problems with rescue. For example the output of this programs is "2+" and not "21". If I name the recues then the output is ok, 21. #include void main(int argc, byte **argv) { rescue { print("1"); return; } rescue { print("2"); raise ; } raise ; } 2) Do we have something like pointer to functions of an adt in alef. I would like to write something like this. enum {TEXT, AUDIO, VIDEO, MULTI}; void (*f[]) = { /* I'm not sure about f or Mesg.f */ [TEXT] Mime.ldtext(), [AUDIO] Mime.ldaudio(), [VIDEO] Mime.ldvideo(), [MULTI] Mime.ldmulti(), }; and later do (*f[type])(); /* this avoid switch or if else */ 3) Some time in an adt I declared another unamed adt which has functions which common names. For example: #include adt Mime{ ..... void write(*Mime,int); }; adt Mesg { ..... Mime; void write(*Mesg,int); }; If I want to access Mime.write through a Mesg object, Is it save to use casting? void Mesg.write(Mesg *m,int) ((Mime *)m)->write(0); /* in order to call MIME.write */ }