#326 Build 1.0.30

brian Thu 31 Jul 2008

The latest build is available for download and the online docs have been updated.

Both Andy and I will be chilling at the beach next week, so expect a quiet week.

Type and Slot Literals

Type literals have a new syntax which is Foo#. The old syntax Foo.type will generate compiler warnings in this build, and will be removed in the next build. In conjunction there is a new slot literal syntax Foo#method or #method. The entire codebase has been updated to use the new syntax. See docLang and discussion.

Short Construction Calls

The compiler has been enhanced to support the new short construction call syntax:

// old way
Point.make(x,y)

// new way
Point(x, y)

I've updated the entire codebase to use the new convention. See docLang.

Implicit Casting

The compiler now permits you to omit casting a lot more often. Previously only Obj was implicitly cast to other types. Now the compiler allow implicit casting anywhere unless it knows you've got a type error:

Void f(Int x) { ... }

// implicit cast inserted: Int.fits(Num)
Void a(Num x) { f(x) }  =>  f((Int)x)

// compile time error: !Int.fits(Str)
Void a(Str x) { f(x) }  =>  f((Int)x)

See docLang and discussion.

Examples Re-org

The sample scripts have been reorganized a bit:

examples/
    fwt/
       hello.fan
       demo.fan
       richtext.fan
    web/
       hello.fan
       demo.fan

New FWT Features

The new Command class works as a controller for user commands. It manages the classic case of having a menu item and toolbar bound together. It's super easy to use:

exit := Command { name="Exit"; onInvoke=|,| { Sys.exit } }
menu.add(MenuItem { command=exit })
toolbar.add(Button { command=exit })

There are a couple new or enhanced widgets:

  • Combo: see the Text tab in examples/fwt/demo.fan
  • Tree: see the Tree and Table tab in examples/fwt/demo.fan
  • RichText: see the examples/fwt/richtext.fan
  • GridPane: now is fully operational, this is my workhorse pane for building most UIs; see the examples/fwt/demo.fan

I've also done more work on the serialization front. If you go to the Serialization tab in the demo, you can type in a serialized widget tree, and press the button to immediately test it (ignore the message that says it doesn't work, it does now). Pretty cool stuff.

Webapp Rework

Andy updated some of the webapp APIs during his sidewalk development:

The Web/Widget API got reworked a bit to solve some issues I came across:

  1. The doXxx methods on Weblet got renamed to onXxx. We'll use the onXxx convention for all callback methods in web and webapp now.
  2. FindChromeStep was fixed to always create a new Type for each request.
  3. Widget.actionUri, actionForm are gone in favor of toInvoke/invoke (using onXxxx for callbacks).
  4. The notion of widgets trees was made more concrete with new methods on Widget.

An overview of the new Widget API is discussed in docLib::Widget. For the most part the model follows FWT.

Also there's a new web test suite under "examples/web/demo.fan" to demo features of web and webapp pods.

Change Log

Build 1.0.30 (30 Jul 08)

  • Short construction call syntax Type(args)
  • FWT widgets: Combo, Tree, RichText
  • fwt::Command
  • GridPane enhanced, see tab in demo
  • File.listDirs, listFiles, walk, osRoots
  • Expand auto-cast to include any assignable type
  • Weblet.doGet,doPost,... => Weblet.onGet,onPost,...
  • webapp::Widget API changes
  • Add field default to fandoc
  • Change Uri.name to return "" instead of null
  • Rework sample code apps/ to examples/
  • List.binarySearch
  • New type literal syntax: Type#
  • Slot literals: Type#slot or #slot

tompalmer Thu 31 Jul 2008

Sounds great. It's part my fault, but the far reaching discussions sometimes leave me dizzy off in orbit. Still, every new release sounds so nice when summarized. Fan manages to do some fancy features while still feeling down to earth.

alexlamsl Thu 31 Jul 2008

Both Andy and I will be chilling at the beach next week, so expect a quiet week.

Have fun!

msylvan Tue 5 Aug 2008

Is it just me, or is fansh non-functional on Unix systems? (running Fedora's Rawhide development version on x86_64 here).

With 1.0.27, I get

Exception in thread "main" java.lang.NoClassDefFoundError: fanx/tools/fansh

With 1.0.30, using both OpenJDK 1.6.0 64-bit and Sun JRE 6 32-bit, attempting to launch fansh results in Java running out of heap space, after consuming hundreds of megabytes of RAM.

brian Tue 5 Aug 2008

You know what, I changed how the launchers worked for non-sys pods - but I must have forgotten to fix that unix script. I will fix for next build, until then use this:

fan fansh

Sorry about that.

brian Tue 5 Aug 2008

I just checked on OS X - and it should work in build 1.0.30 (I did update the script). So there must be something else going on here.

The fact that your fansh script in 1.0.27 is getting a NoClassDefFoundError would lead me to suspect that maybe the 1.0.27 script is using the 1.0.30 lib/java/sys.jar file (since I removed that class).

wirianto Thu 7 Aug 2008

I got OutOfMemory error with fansh on Windows XP. I'm using JDK 1.6.0 update 10 beta (1.6.0_10-beta-b23).

Here are the stacktrace:

ERROR: cannot compile script
sys::Err: java.lang.OutOfMemoryError: Java heap space
  fan.sys.Int.make (Int.java:59)
  fan.sys.Int.increment (Int.java:122)
  compiler::Tokenizer.consume (Tokenizer.fan:840)
  compiler::Tokenizer.symbol (Tokenizer.fan:673)
  compiler::Tokenizer.find (Tokenizer.fan:131)
  compiler::Tokenizer.next (Tokenizer.fan:85)
  compiler::Tokenizer.strInterpolation (Tokenizer.fan:408)
  compiler::Tokenizer.str (Tokenizer.fan:350)
  compiler::Tokenizer.find (Tokenizer.fan:121)
  compiler::Tokenizer.next (Tokenizer.fan:85)
  compiler::Tokenizer.tokenize (Tokenizer.fan:66)
  compiler::Tokenize.tokenize (Tokenize.fan:82)
  compiler::Tokenize.runSource (Tokenize.fan:71)
  compiler::InitInput.run (InitInput.fan:71)
  compiler::Compiler.compile (Compiler.fan:60)
  compiler::Main.compileScript (Main.fan:207)
  sun.reflect.NativeMethodAccessorImpl.invoke0 (Unknown)
  sun.reflect.NativeMethodAccessorImpl.invoke (Unknown)
  sun.reflect.DelegatingMethodAccessorImpl.invoke (Unknown)
  java.lang.reflect.Method.invoke (Unknown)
  fan.sys.Method.invoke (Method.java:515)
  More...

brian Thu 7 Aug 2008

Ok - that is two instances where fansh is getting an OutOfMemoryError. So something fishy is happening. That stack trace is weird though because fansh shouldn't ever be going thru Main.compileScript. Couple questions:

  1. does this happen as soon as you run fansh.exe? or after using the shell for a bit?
  2. do you have multiple fan builds installed?
  3. does fan fansh work you?

Login or Signup to reply.