Funny story about the Java compiler

I had always wondered if it was .NET alone that had inspired Sun to add generics to Java. Perhaps, as you will see here, there was a little more to the story!

On slide 24 I mention Philip Wadler and Martin Odersky. At this point in the talk I repeated an anecdote that Wadler told me. After they had done the work on generics, Odersky was hired by Sun to write the new Java compiler. He thought the generics were a good idea, so he put them into the compiler. The Sun folks always ran the compiler with the generics turned off. But they couldn’t rip out the generics completely, because they needed them in the compiler in order to get it to compile its own source code, which was written with generics. So they had to leave the feature in, and eventually they started using it, and eventually they decided they liked it.

Toggle between Vertical and Horizontal Windows Splitting

On gnu.emacs.help:

Requested: Function that toggles between vertical and horizontal split layout of currently defined windows preferrably preserving splitting ratio.

(defun my-toggle-window-split ()
  "Vertical split shows more of each line, horizontal split shows
more lines. This code toggles between them. It only works for
frames with exactly two windows."
  (interactive)
  (if (= (count-windows) 2)
      (let* ((this-win-buffer (window-buffer))
             (next-win-buffer (window-buffer (next-window)))
             (this-win-edges (window-edges (selected-window)))
             (next-win-edges (window-edges (next-window)))
             (this-win-2nd (not (and (<= (car this-win-edges)
                                         (car next-win-edges))
                                     (<= (cadr this-win-edges)
                                         (cadr next-win-edges)))))
             (splitter
              (if (= (car this-win-edges)
                     (car (window-edges (next-window))))
                  'split-window-horizontally
                'split-window-vertically)))
        (delete-other-windows)
        (let ((first-win (selected-window)))
          (funcall splitter)
          (if this-win-2nd (other-window 1))
          (set-window-buffer (selected-window) this-win-buffer)
          (set-window-buffer (next-window) next-win-buffer)
          (select-window first-win)
          (if this-win-2nd (other-window 1))))))

Thanks Fabrice.

PLT Web Server Changes

Jay, maintainer of the PLT Web Server, has recently made a lot of changes to make it easier for folks to get started with the app server. The latest change is in the documentation, per this post:

The PLT Web Server manual was organized too much like a reference manual with little guide to a user to understand how some modules fits in to the big picture. I’ve reorganized the documentation with the following paradigm:
— Running the Web Server
— Writing Servlets
— Extending the Web Server
Other improvement related to this: I’ve added examples to almost every servlet function. I have integrated the stateless and non-stateless servlet documentation to put stateless servlets on a more secure footing and make it clear that they are usable in real applications. I’ve created an HTTP sub-module that encapsulates most of the HTTP handling. (This will limit the need to use what used to be considered internal Web Server functions.)

Links: Docs, Writing Servlets, Stateless, and HTTP module.

Why Calculating is Better than Scheming

In 1987 Phil Wadler wrote the paper Why Calculating is Better than Scheming. It is an essay on the shortcomings of using Scheme as the programming language with which to teach beginning programmers in SICP, and how Miranda would have a better choice for teaching the software engineers of tomorrow. This was very fun for me to read, and might be for you, too, if you are interested in teaching or the history of both Haskell and Scheme.
Continue reading “Why Calculating is Better than Scheming”

LINQ for R6RS Scheme

The LINQ Project is a codename for a set of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations. It extends C# and Visual Basic with native language syntax for queries and provides class libraries to take advantage of these capabilities.

Leppie has covertly added LINQ support to another language, R6RS Scheme!