The whole Felix library has now been converted to use type classes. **************************************************************************
No "modules" anywhere. The only semantic change: at this stage classes can't contain initialised variables, there's no _init_() function as there is for non-polymorphic modules. (Bug to be fixed perhaps?) A couple of variables had to be moved into global scope to cope with this issue: these are nasties: the system job queue and clock. The typeclass keyword is gone. ********************************** Please use "class" to fool newbies into thinking Felix has a weird and wonderful kind of class system. It's the truth! Effects: mainly, this will make Felix easier to maintain. Modules still exist, but now I can think about taking them out, at least of the front end. One upside is the following clever idea: Instead of: module IO { string readln(file) { if posix do return posix_read(file); elif windows do return windows_read(file); else throw "Unsupported OS" done } which uses conditional compilation and looks messy, we do this instead: class IO { virtual string read(file); } if posix do instance IO { string read(f:file)=>read_posix(f); } elif windows do instance IO { string read(f:file)=>read_windows(f); } done We're still using conditional compilation BUT now we can still add an instance for OSX. Furthermore, the instances can be moved into platform specific places and many of them conditionally selected at once. In fact with code generators we could do it without conditional compilation (at config time) .. if we wanted. The important thing is we can provide platform independent code (the IO class) with platform specific "holes" in it that can be filled in elsewhere, providing a much better way to separate the platform independent and platform specific code than before. (We could even use a type parameter instead) ****************************** There is another possibility here: we provide an instance which uses a record of functions, dynamically installed in the record. This is real dynamic dispatch. It's almost OO, except it is more like OO with multi-methods because the dispatcher handles a collection of types. Haskell does something like this already, passing dictionaries. If something works along these lines we might provide compiler and run time support. -- john skaller skal...@users.sourceforge.net ------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language