Blog Post

#2522 Build 1.0.68

brian Thu 7 Apr 2016

Its been long overdue, but we have finally posted 1.0.68!

Dom Changes

There have been many breaking changes to the dom APIs. This is in preparation for the development of a brand new UI toolkit called domkit which we hope to open source later this year. Domkit replaces FWT as our toolkit for developing HTML5 user interfaces in Fantom. See topic 2466 for more details, and please review change log for list of changes.

Windows Launcher

We have replaced the Windows executable launchers with batch scripts. For example you now use fan.bat instead of fan.exe to launch a Fantom program. This allows a single set of launchers to work for both 32-bit and 64-bit JVMs. Plus it cleans up how to handle substitutes for bootstrap so that things are consistent with Unix.

Running as Windows Services

This build also introduces a new Window’s program called fansc.exe which makes it easy to configure Fantom programs to run as Window’s service in the background. See docs for details.

JavaScript Source Maps

Compiling Fantom to JavaScript now generates source maps so that stack tracing and debugging in the browser shows Fantom source and Fantom source code line numbers (you have to wire up a WebMod to show source though).

JavaScript Optimizations

Two important JS compiler optimizations:

  • closure call sites are optimized to reuse reflection data to significantly reduce allocation of temp objects
  • we now support a fairly compressed JS file that can load the entire timezone database in the browser (its precompiled and stored in etc/sys)

HTTPS

Wisp now supports HTTPS out of the box. When running in HTTPS, both a http and https port are configured and all http traffic is redirected to the https socket. To enable this feature you must setup your keystore in PKCS12 format under /etc/inet/keystore.p12. See docs for details on how to setup. This change deprecates the port field in favor of httpPort.

WebSockets

This build includes a prototype for both client and server side web::WebSocket. The server side isn’t quite complete because I still want to enhance it a bit to pull it off the wisp actors.

Actors

We have deprecated support for serialized messages in actors. If you are not using immutable messages, then you will receive a gaint dump to stdout warning you not to use serialization for messages. That feature caused a lot of subtle bugs and performance problems. I will completely remove support for non-immutable messages in the next build. See topic 2428 for full discussion.

We have also enhanced the Future API to be completed through an API calls versus just an actor response. As part of this change we added a FutureState enum you can query and tweaked some of the API terminology.

Param Reflection

You can now reflect the expression used by a method parameter default. For example:

static Str foo(Str bar := "baz") { bar }

method := type.method("foo")
param := method.params[0]
defVal := type.method(“foo”).paramDef(param)  // evaluates to “baz”

Immutable Bufs

At long last you can lock down an in-memory sys::Buf as an immutable object. This makes to safe to pass Bufs between actors or store in a const field. All that is needed is to call sys::Obj.toImmutable on the Buf instance. This only works for in-memory buffers:

Buf().print(“hello”).toImmutable

Making a Buf immutable is a cheap operation because it creates a shallow copy, but to ensure its immutable it “steals” the byte[] from the source to avoid a memcopy. This means the original Buf is effectively cleared.

Buf PBKDF2

A new sys::Buf.pbk method provides support for PBKDF2 with SHA-1 and SHA-256. This functionality is implemented for both JVM and JS environments.

Returning Void

We slightly modified the language to allow a return statement with an expression inside a Void method per topic 2403:

// old way
if (!file.exists) { res.sendErr(404); return }

// new way
if (!file.exists) return res.sendErr(404)

Bit I/O

We have added bit-level support to the I/O APIs:

Partial bytes are buffered in the stream until complete 8-bit bytes can be read or written.

Change Log

Build 1.0.68 (6 Apr 2015)

  • Windows replace exe launchers with batch scripts
  • Windows fansc service controlller
  • JsonOutStream: remove newlines from output
  • WispService.extraResHeaders
  • Doc: deprecate query, queryAll -> use querySelector, querySelectorAll
  • Elem: add Style type
  • Elem: trap support
  • Elem: deprecate hasClassName, addClassName, removeClassName -> moved to Style
  • Elem: deprecate name, val, checked -> use trap operator
  • Elem: deprecate first, last, prev, next -> firstChild, lastChild, prevSibling, nextSibling
  • Elem: deprecate find, findAll in favor of querySelector, querySelectorAll
  • Elem: add animate(), replace(), scrollPos, scrollSize
  • Elem: drag and drop API support
  • dom: add MutationObserver
  • dom: add WeakMap
  • DomEvent renamed to Event; rework API to use dom::Key
  • Map.getChecked
  • Win.hisReplaceState
  • Win.screenSize
  • JS compiler optimized closure call sites
  • JS source map support
  • JS support for compressed timezone database
  • HTTPS support for WispService
  • Rework WispSession to use immutable session maps
  • WebSocket prototype
  • Change Java emitter to raise exception in abstract factory methods
  • Range.eachWhile
  • Enhance Env.props to work with pods
  • Method.paramDef reflection (JVM only)
  • Immutable Buf support
  • Buf.pbk to add PBKDF2 support
  • Enhance Future API: state, complete, and completeErr
  • Deprecate Actor.sendWhenDone in favor for sendWhenComplete
  • InStream.readNullTerminatedStr
  • Bit I/O: OutStream.writeBits, InStream.readBits
  • MarkdownDocWriterer
  • 1466: js: Func.arity is missing
  • 1591: JS RegexMatcher support
  • 2396: dom::HttpReq.send() should take nullable content
  • 2403: Returning Void
  • 2428: Actor deprecate support for serialized messages
  • 2436: Cannot parse .props file when first line is # comment
  • 2438: Handle quotes in Cookie per RFC 6265
  • 2453: js: MapType casting errs
  • 2454: Javascript Float.toStr()
  • 2455: Mixin vs Abstract in Javascript
  • 2501: ClosureFuncSpecs for non JS classes

SlimerDude Thu 7 Apr 2016

Awesome Brian, this is welcome news indeed!

Many thanks, Steve.

LightDye Fri 8 Apr 2016

That is great news! Thank you!

Login or Signup to reply.