CSC/ECE 517 Fall 2012/ch1 1w6 pp: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
Line 5: Line 5:
== Introduction ==
== Introduction ==


== Difficulties in mixing static and dynamic oo ==  
== Difficulties in mixing static and dynamic oo ==


If the static oo makes use of generics for e.g. Java, then the generic types are erased during compilation for backward compatibility.
As a result for a dynamically types language like Ruby, there will be problems with type conversion.
For example, if you have a Map<String,String>, it will be seen as a simple Map, and JRuby will not be able to determine the correct types using reflection.


== JRuby ==
== JRuby ==

Revision as of 18:34, 9 September 2012

This page is about the mixing static and dynamic Object Oriented code. This page will mention some difficulties when these two types of object orientation are mixed and then we will give on practical example of such in JRuby. JRuby is mixing of Java and Ruby, this page will cover the different types of such mixings and examples of each of them.


Introduction

Difficulties in mixing static and dynamic oo

If the static oo makes use of generics for e.g. Java, then the generic types are erased during compilation for backward compatibility. As a result for a dynamically types language like Ruby, there will be problems with type conversion. For example, if you have a Map<String,String>, it will be seen as a simple Map, and JRuby will not be able to determine the correct types using reflection.

JRuby

Examples JRuby

References

Further Reading