LtU Forum

Category theory in design

I have seen mentioned in this site that category theory is useful in clarifying the design process. I am wondering if the categorical approach would be any different from a purely functional approach. My reasoning is that in category theory, objects (states and data) are not important, if not almost entirely dismissable. What is of importance to the categorists is the relationships between objects, the functions, the way the structures work. It seems to beg the question, is category theory an abstraction of functional programming (not in an intuitive manner, but in the strict sense) and is there anythings that would be explanable in category theory that would not be in a functional language and the converse?

Polymorphic C

I've been having fun recently learning to write programs in Haskell. As a lover of both Scheme and C, its functional semantics and static typing seem like a near perfect combination, and having to re-think certain algorithms that came to me so easily with mutable state has proved to be a fun challenge.

What brought me to Haskell was the fact that I was tired of faking polymorphism in C with void* passing. I just couldn't commit myself to using C++ -- it's just a personal bias -- functions on objects seems much more natural than objects with functions. Plus Haskell is the new hotness (TM).

Of course I thought wouldn't it be great if there was a C (a real C with pointers and all) that also had a ML type system. After a little digging on Google I found this: Towards an ML-style Polymorphic Type System for C; reading through the paper it seems like a very natural evolution of C.

Unfortunately it seems that the idea lives and dies in this paper. I cannot find reference to a compiler implementation anywhere.

Has anyone come across other projects that combine imperative mutable languages (like C) with ML style typing?

Generic types

Looking to write a language that combines primitive and object types with a prototypic approach ala Self, I am struggling to understand how to implement generic types. I read the GNAT Ada interface implementation document but did not see material directly related to this.

My concerns are:

  • Adjust the size of the object to the parameterized type(s)
  • Adjust the methods code to the parameterized type(s)
  • Compare instantiated generic types for compatibility (eg. two instances of the type with covariant method parameters)

In particular, how do languages that support generic types handle the second point?

Regions for Code GC?

I've read many papers on region-based memory management and inference, but none of them discuss region inference for functions and machine code. A VM with dynamic code loading and jitting, like the JVM, or a VM with hot code update, requires some form of automatic reclamation of unused functions. Anyone have a link to such a discussion? Or is garbage collection still the preferable method for automatic code reclamation?

Hardwired polymorphism

Could you assist me in finding a previous discussion related to "hardwired" polymorphism, in which instead of relying on runtime information such as a class tag the dispatch uses a separate version of the function for each possible type. I imagine that could be implemented using C++ templates but I forgot the details.

The issue was of course the explosion of function signatures, but that is probably bound by the amount of interdependence between classes. If I remember correctly a concrete application is for programming embedded systems.

Erik Meijer and Bertrand Meyer - Objects, Contracts, Concurrency, Sleeping Barbers and Eiffel

...as discussed by Bertrand Meyer and Erik Meijer.

On Channel 9 here.

Scala Lift Off Unconference review

I was just a gadfly, so LtU folks who actually presented etc. at the unconference can talk more in-depth, but it seemed to me that Scala is getting serious momentum. More power to it, we could stand to have a "better" Java.

[Edit: I am promoting this to the front page. Click to read more details, as they are posted to the discussion group. -- Ehud]

service course in logic and logic programming: crazy?

This coming fall, I'm teaching our department's service course for non-majors. The topic is open, and in the past I've offered a version using Mark Guzdial's Python-based image processing course and another surveying algorithms and algorithm analysis (a la David Harel's Algorithmics).

For this fall, I'm thinking about offering a course introducing programming from the logic programming point of view. The students will, for the most part, have the mathematical maturity of Oregon high school graduates who are afraid of math, which is to say, essentially nothing. Almost none of them will have any background in either programming or logic, and I'll have the standard "fear factor" to overcome, as well.

At a minimum, then, I'll have to include a few weeks on propositional logic before diving in to actual programming. My inclination for programming is to use Prolog, probably the SWI compiler, for its fairly rich standard library. Beyond that, however, I'm pretty much at sea, and would really appreciate some suggestions. I've never taught a logic programming course before (other than as a component in a senior-level PL class), certainly not at such a low level, and this is not, in general, an area of expertise for me.

If you were to teach such a course (or if you have already), what would you consider an appropriate range and ordering of topics? Any ideas for cool applications? Sudoku solvers are a neat possibility: I'd love other ideas. Do you know of similar courses that have been successfully deployed?

Is this idea insane?

OO via first class enviroments: Bla

(Since SHEEP isn't out yet) The programming language Bla

"breaks with referential transparency and allows use of assignment as well"

and/but

"[via] '1st class environments', Bla integrates functional and object orientedness in a tiny language, in an elegant and natural way. However, on top of this core language, Bla adds quite a few concepts to make programming practical."

FringeDC informal meeting Saturday May 10th

FringeDC is a group in the Washington DC area interested in fringe and
functional languages (Lisp, Haskell, Arc, Prolog, etc.)

If you're in the DC area, please join us this Saturday over a beer!

http://www.lisperati.com/fringedc.html
http://www.lisperati.com/may10th.html

XML feed