MontysCoconut / moco

The Monty to LLVM compiler
http://www.informatik.uni-bremen.de/monty/
GNU General Public License v3.0
10 stars 5 forks source link

Added Generic Types to Moco #18

Closed hwielenberg closed 9 years ago

hwielenberg commented 9 years ago
cpfr commented 9 years ago

I would agree to merge this request, since the changes seem reasonable and the implementation of generics is important for me. The removed unit tests were not up to date anymore and somewhat obsolete due to the existing integration tests. They were removed since they contained errors (not because they found errors). I'm ok with discarding them. However, if it is a probem for this merge request, I'll try to fix them in order to be able to merge this request into the master branch.

lummax commented 9 years ago

I will look closer into this PR later today.

Some questions:

And could you elaborate on how your generics implementation works?

cpfr commented 9 years ago

I can only answer two of those questions (although they are also briefly answered by the merge request text):

Is there reasoning why the name-mangling was reworked? The reason is that name mangling was reworked is that it can not be done prior to the code generation anymore, since the generics implementation needs to do name mangling during the code generation phase due to the generation of template classes.

Is the generics implementation in sync with the specification? The implementation uses generic classes as templates for the concrete types (as opposed to Java, where type erasure is used). In this way it is in sync with the specification. The only difference between the implementation and the specification is that ClassIdentifiers are used for type parameters, while the specification suggests only uppercase letters (e.g. Array<T> instead of Array<ElementType>). However, this is a weak point in the specification, especially because it limits the maximum number of type parameters to 26 (A-Z).

hwielenberg commented 9 years ago

Is there reasoning why all the tests where removed? Mit meinen Änderungen funktionieren die Tests nicht mehr. Wie oben schon Umrissen finde ich die Arbeit nicht Wert die Tests wieder zum laufen zu bringen, da sie