Factor Language Blog

Factor 0.79 released

Sunday, November 6, 2005

Factor 0.79 is now out after two months of development.

  • Incompatible changes:
    • The ifte combinator has been renamed to if.

    • Syntax changes:

      { 1 2 3 }                ! arrays
      V{ 1 2 3 }               ! vectors
      H{ [[ key value ]] ... } ! hashtables
      C{ 1.02 -7.44 }          ! complex numbers
      T{ class slots ... }     ! tuple
      
  • Compiler:
    • New basic block optimizer performs more aggressive dead load and store elimination.
    • Stack shuffles are compiled more efficiently.
    • Pushing literals on either side of a stack shuffle is now compiled more efficiently.
    • Fixed a problem with relocation of compiled code on PowerPC.
    • Fixed various FFI issues on Mac OS X.
  • User interface:
    • Graphics rendering is now done using OpenGL and text rendering is done via FreeType. SDL_gfx and SDL_ttf libraries are no longer required.
    • Added expandable outliners. Used by the inspector, .s, usage., uses., vocabs., and various other words.
    • Added word completion to the listener pane; press TAB.
    • Added word navigation shortcuts to the listener pane; press C+LEFT and C+RIGHT to move a word at a time, and C+BACKSPACE and C+DELETE to delete the previous and next word, respectively.
    • Added mouse-over help for presentations.
    • Previously-entered output is now clickable in the listener.
    • New, better-looking widget theme.
  • Collections:
    • Faster map, 2each and 2map.
    • Arrays are now better supported and should be used instead of vectors where resizing is not desired.
    • Some new sequence words that do not bounds check: nth-unsafe and set-nth-unsafe. These should only be used in special circumstances, such as inner loops (each, map and so on use them).
    • New replace-slice ( new from to seq -- seq ) word replaces a slice of a sequence with another sequence.
    • Hashtables did not obey the rule that equal objects must have equal hashcodes, so using hashtables as hashtable keys did not work.
    • New mismatch ( seq seq -- i ) word returns first index where two sequences differ, or -1 if they have equal elements.
    • New drop-prefix ( seq seq -- seq seq ) word returns a pair of sequences which have the same elements as the two input sequences, with the common prefix removed.

Everything else:

  • On Mac OS X, signal 11 errors caused by stack under/overflow no longer trigger the OS X crash reporter dialog.

  • Easier exception handling. The cleanup ( try cleanup -- ) word encapsulates the following idiom:

    [ A ] [ B rethrow ] catch
    [ A ] [ B ] cleanup
    

    The recover ( try recover -- ) word encapsulates the following idiom:

    [ A ] [ [ B ] when* ] catch
    [ A ] [ B ] recover
    

    The catch ( try -- error/f ) word no longer takes a quotation that receives the error caught; rather, it just pushes the error that was caught on the stack. That is, the old way:

    [ A ] [ B ] catch
    

    Becomes:

    [ A ] catch B
    

    However, most uses of catch can be replaced by cleanup and recover.

  • The distinct t type is gone. Now, the t object is just a symbol.

  • A new with-server ( port ident quot -- ) combinator takes care of listening on a network socket, logging client connections, spawning client handler threads, and error handling. The quotation is called for each client, in a new scope with the client socket as the default stream.

  • New 1+, 1- words are a bit faster than 1 + and 1 - since there is one less generic dispatch involved.

  • On Windows, FFI errors would raise a signal 11 instead of reporting a nice message.

Contributed code:

  • The HTTP server and client has been moved from library/httpd/ to library/contrib/.
  • Intel 8080 CPU and Space Invaders emulator in contrib/space-invaders (Chris Double)
  • AOL Instant Messenger chat client library in contrib/aim (Doug Coleman)
  • Cairo graphics library binding in contrib/cairo. (Sampo Vuori)
  • Advanced math library with quaternions, matrices, polynomials, statistics and various functions in contrib/math/. (Doug Coleman)
  • Dimensioned units in contrib/units/. (Doug Coleman)
  • X11 binding in contrib/x11/ (Eduardo Cavazos)