Blog Post

#652 Build 1.0.44

brian Thu 25 Jun 2009

Latest and greatest is posted for download and online docs updated.

JavaScript Support

Our startup SkyFoundry is making heavy use of Fan's JavaScript support, so this technology is getting a lot of attention. The Fan-to-JavaScript compiler got some refactoring in this build and renamed to compilerJs. It now supports dual use for compiling pods or individual script files.

This stuff is still early days, but you can start playing it with via the new "examples/js/demo.fan" script. This script launches a web server on port 8080, then you can edit/add files with the ".fwt" extension and view them in browser compiled into JavaScript.

The "graphics.fwt" script duplicates the code from the SWT demo painting to the HTML5 Canvas element. See my previous blog post for screen shots (you need FF 3.5, Chrome 2.0, or Safari 4.0).

Breaking Changes

This build includes the change to remove the first parameter to List.map and Map.map - see 612. This modification was also causing some nasty trouble for using 1.0.43 to bootstrap compile hg tip - so that should all be fixed now.

We also changed FWT a bit as part of the JavaScript support. Custom widgets cannot subclass directly from Widget anymore, rather you must now subclass from Pane or Canvas. I also removed clipRect and drawPoint from Graphics (they didn't really make a lot of sense anyways).

The fwt::Command.invoke method was made final - if you have custom commands you now override invoked. Invoke will automatically wrap the subclass callback in a try block and display error dialog if something goes wrong. You can override error behavior via the onInvokeError callback.

Flux - Goto File

I added a new "Goto File" command to Flux. In order to use this new command, setup a list of directories to index in "flux/general.fog". Use Ctrl+Shift+G to jump to a specific file:

  • Glob any file name such as "SideBar.fan" or "SideBar*.fan"
  • Glob any base name without extension such as "SideBar"
  • Match camel case abbreviation such as "SB" for "SideBar"

If there is exactly one match you go straight to the file, otherwise you get a dialog similar to the "Recent" dialog. Pretty simple feature right now, but this is kind of the first baby steps towards creating an indexed, semantic model of Fan projects.

ChangeLog

Build 1.0.44 (25 Jun 09)

  • Fix bug in WebReq.absUri
  • Fix webappClient to use Uri instead of Str
  • Remove old webServlet code
  • Regex.glob
  • Flux Goto File command
  • DateTime.toHttpStr use toLocale to avoid race conditions
  • FWT Canvas widget (Widget.make is now internal)
  • Graphics removed clipRect, drawPoint
  • fwt::Command.invoke final, override invoked now
  • Int.pow
  • List on JVM now uses backing store with typed array
  • Json fixes
  • Fix Wisp HTTP pipeling bug when no request body
  • JavaScript compiler enhancements for script support
  • 64-bit integer emulation in JavaScript
  • #612: Change signature of List.map and Map.map
  • #617: Compiler bug - traceback in switch with missing case expression
  • #618: Ambiguous method call on java object
  • #629: NoClassDefFoundError when accessing public static final field with JavaFFI

tompalmer Thu 25 Jun 2009

64-bit integer emulation in JavaScript

Nice. I was wondering about the plans for that. (Still need to try out the JS compiler. I'm quite interested in it. Just have enough other things to do right now.)

Login or Signup to reply.