You are browsing as a guest. Sign up (or log in) to start making projects!

1h 4m 18s logged

#3 Devlog
I created a single method in this hour. I wanted to just have method that creates an Iterator over a collection of objects. But if you have different objects that becomes very messy very fast, because the concrete type of the iterator is also different then. Now the method only claims to return something that is an iterator, so it shouldn’t be a problem, right? Well it is, because the compiler doesn’t know at compile time what type will be returned and thus can’t do monomorphization. The solution: Make the types of all of the objects the same through static polymorphism BEFORE you construct the iterator by putting everything into an enum and implementing an access method.

You could of course avoid all of that and just use dynamic polymorphism, but who needs that. Also sorry for posting so little, I will try to post more often.

0
7

Comments 0

No comments yet. Be the first!