Thursday, September 22, 2011

Back into Java for a while

OK, decided to fix a bushel of nagging bugs in the Java part of the system. I started by finishing the SORT function. Well, that led me into doing some serious problems with vectors such that I could sort them. And to use the Java sort system, I had to add about 15 methods in each most of the vector classes (the Java Collections system). Now I can sort vectors, but (there is always one or more of those...) there are fence post problems with bit vectors, strings, and lists. I'm pretty sure that I can make them work by the end of the weekend. Here is the prior thought.

And to add to the work, none of the Character functions have a Function2 interface - needed for Sort. And that will bring out ideas of updating the Unicode tables. They're about 4 years old now, and it would be good to update it.

I have a new student working for me on some new ideas for handling subtyping. It's built similarly with the Factory classes for creating new instances of types. For other of you don't know, types in CLforJava are reified with Java interfaces and map the CL type system. Many of these interfaces also house one or more nested static classes. For example, to get a Lisp Integer, you go to lisp.common.type.Integer.Factory.newInstance("57890978450503857"). In subtyping, many of the interfaces would also have another nested factory that can reify a subtype (for example, (integer 4 15)) as a function that can detect that a value or set of values that fit the type or not. Since this is a function (Java/Lisp), it can be used by the compiler with safe checking.

Tuesday, September 6, 2011

Sorting things out

OK, I'm tired of working on the new compiler, so I decided to fix up the SORT function. I had a student working on it last semester, and he had made some good forward work. Then he managed to crash the compiler. Not ours; the Java compiler. Ouch! So it was left on the floor for a while.

Ok, last weekend I decided to fix it up. I had broken a toe, so I wasn't going anywhere anyway. Going back with some of the Java code was a good thing. It showed some problems in the basic type system. I moved the java.util.List and java.util.Collection interface packages up to the lisp.common.type.Sequence interface. This forced me to complete the code for all of the affected classes. The next thing to redo is the implementation for the SortComparator (implements the Java compareTo method). The student didn't realize that compareTo has 3 possible values rather 2. hmmm.

This is where the type system gets a bit squirrelly in handling Vectors. More on that after I get sorting lists working.