shirmung/OOP — comment on commit a8f5b8a14e6b962f03d8a82fc27da3771290669e
File:  line 0
By howardjing:

PLEASE READ THIS CAREFULLY AND DISCUSS KTHX:

I added a dictionary in ImplementationVisitor to keep track of the name and class of every variable declared. I did the implementation before really thinking it through--as a result it is too naive and will have to be drastically changed or completely removed.

Shortcomings:

- (REALLY MAJOR) It doesn't handle visitCallExpressions, which is going to be really important
- (ALSO REALLY MAJOR) Since it is a dictionary, repeats are not allowed, meaning IT DOESN'T KEEP TRACK OF SCOPE

I added the dictionary thinking that it would help with method overloading--but from what I can tell, there are several cases to worry about.

Base Cases:
Case 1)
y.foo(100)
Here 100 is an IntegerLiteral, so we can immediately pick the correct overloaded method to use
Case 2)
y.foo( asdf )
We get the class of asdf from the dictionary in ImplementationVisitor, and can then pick the correct overloaded method to use

More Complicated:
Case 3)
y.foo( x.help(me, aaugh) )
First let type = x.help(me, aaugh)
Recursively evaluate y.foo(type)

By the way, how should we decide which overloaded method to use? For example if the method foo(grandparent x) exists, but we pass a variable of type child as the argument, we will have to go up child's hierarchy tree until we find the correct ancestor of child to use in our method.

WHAT WE WILL NEED:
Information on the return type of every method of every relevant object.
The class hierarchy of every relevant object.

Also, method chaining will probably have to be updated in order to do handle overloaded methods, but I think this is a separate issue.

Am I totally misunderstanding the problem?? LETS DISCUSS!!!

PS: Here are important things that still need to be done
1) import statements
2) arrays
3) System.out