Re: A minor(?) problem I need help with

Maffu@Kindy.net (Matthew Kindy)
22 May 1999 03:03:09 -0400

          From comp.compilers

Related articles
A minor(?) problem I need help with arrow@trelleborg.mail.telia.com (The Arrow) (1999-05-16)
Re: A minor(?) problem I need help with Maffu@Kindy.net (1999-05-22)
| List of all articles for this month |
From: Maffu@Kindy.net (Matthew Kindy)
Newsgroups: comp.compilers
Date: 22 May 1999 03:03:09 -0400
Organization: University of Central Florida
References: 99-05-048
Keywords: types, optimize

On 16 May 1999 15:09:04 -0400, The Arrow
<arrow@trelleborg.mail.telia.com> wrote:


> function fun2 =
> {
> var obj1, obj2, obj3;
> var tmp, fun. cls;
>
> obj1 = new Class1;
> obj2 = new Class2;
> obj3 = Instance;
>
> tmp = Instance.prop1; /* tmp is assigned 4 */
> Instance.prop1 = 7; /* Instance.prop1 is assigned 7 */
> obj3.prop1 = 1; /* Instance.prop1 should be assigned 1 */
>
> obj1.prop1 = "bar"; /* what class is obj1? */
> tmp = obj2.prop2; /* what class is obj2? */
>
> tmp = obj1.prop2; /* legal */
> obj1.prop2 = tmp; /* illegal */
>
> fun = fun1; /* how can I know fun is now a function? */




>Is there any way of doing these checks at compile time, without
>special cases in assignments to keep track of these things?


Can you maintain a lookup table in your parser (i.e. modify your
symbol table) to hold class/object info for your declarations?


That way, after the object is declared, class info is readily
available by hashing into the symbol (lookup) table.


Am I missing something here?


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.