|A minor(?) problem I need help with firstname.lastname@example.org (The Arrow) (1999-05-16)|
|Re: A minor(?) problem I need help with Maffu@Kindy.net (1999-05-22)|
|From:||Maffu@Kindy.net (Matthew Kindy)|
|Date:||22 May 1999 03:03:09 -0400|
|Organization:||University of Central Florida|
On 16 May 1999 15:09:04 -0400, The Arrow
> 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?
Return to the
Search the comp.compilers archives again.