Blog Post

#881 Build 1.0.48

brian Mon 21 Dec 2009

Latest build has been posted and online docs updated.

Build 1.0.48 is designed as a transition build to introduce a whole bunch of breaking changes. As much as possible I've attempted to leave old functionality in place with warnings to make transition as easy as possible. Although some changes like the new webmod is just simple clean break from the old API. There are also a bunch of new features.

I will be removing many of the deprecated features from hg tip over the next month, and things will be completely removed for build 1.0.49. If you have concerns about deprecation of Obj.type or bitwise operators (probably the two most contentious changes), then please try out this build with your code and see what you think.

Summary of Breaking Changes

The following is an overview of all the breaking changes:

no-arg void closure #851

|,|  => |->|

field setter #870

val  =>  it

bitwise operators deprecated #870

~   =>  Int.not
&   =>  Int.and
|   =>  Int.and
^   =>  Int.and
<<  =>  Int.shiftl
>>  =>  Int.shiftr

deprecated Obj.type #869:

Obj.type            =>  Type.of, Pod.of
Type.loc, Type.log  =>  Pod.loc, log

actors #848:

Context => removed, use Actor.locals


build::CreateZip.inDir => inDirs  to support zipping multiple root dirs

fand renamed to util #841

BootScript  =>  AbstractMain

json #796:

Json.write => simples/serializable output differently 

dom API changes #854:

Window          => Win and changed to singleton
Doc             => singleton
Elem.value      => val
Effect          => removed
HttpReq         => it-block style ctor
HttpReq         => move method into send; provide get/post/postForm
HttpRes.content => in

web + webapp + webmod #836:

Weblet         => now mixin
Weblet.service => onService
WebMod         => added
WebService     => removed
WebStep        => removed
UserAgent      => removed
WebReq.service, resource, userAgent => removed
WebReq.mod, modBase, modRel => added
WebRes.service => removed
examples/web   => refactored
@webView, @webViewPriority => removed
webapp pod     => removed
webmod pod     => added

api renames for name consistency #855:

// prefer current to cur
sys::Locale.current    => cur
sys::Locale.setCurrent => setCur
sys::TimeZone.current  => cur
gfx::GfxEnv.current    => cur

// prefer val to value
Enum.values        => vals // this is generated by the compiler
sys::Map.values    => vals
sys::Type.isValue  => isVal  

// prefer msg to message
Err.message       =>  msg
Email.messageId   =>  msgId
LogRecord.message =>  msg

// prefer rec to record
LogRecord                  =>  LogRec
FileLogger.writeLogRecord  =>  writeLogRec

// prefer addr to address
inet::IpAddress             => IpAddr
inet various APIs
web::WebReq.remoteAddress   => remoteAddr
wisp::WispReq.remoteAddress => remoteAddr

// prefer err to error
sys::Log.isError                 => isErr 
sys::Log.error                   => err 
sys::LogLevel.error              => err 
compiler::Compiler.errors        => errs
compiler::CompilerErr.isError    => isErr
compiler::CompilerLog.error      => err
docCompiler::DocCompiler.errors  => errs
fandoc::FandocParser.errors      => errs
fwt::Command.onInvokeError       => onInvokeErr 
web::WebRes.sendError            => sendErr

fwt #865:

TreeModel.children => changed return to non-nullable

IDE Links

There is a new chapter for links to IDEs

One-Step Bootstrap

There is a new script "adm/" which performs a one-step pull from hg and bootstrap build - see docTools.

For the most part this script works on Windows. I had to make a change for OS X which is not in the official distro - but you can fix your copy with this changeset. I was also having some problems with jar and temp files on OS X which we need to look into. But I was able to get far enough that all the complicated bootstrap stuff was setup, and I only needed to re-kick off buildpods. So if you want to take a look at this script then feedback and patches welcome.


Nice new mini-framework for writing command line mains:

Int Byte Formatting

I kept finding myself wanting to print memory or file size in KB, MB, etc. You can do this now using the "B" pattern:

123.toLocale("B")            =>  123B
1234.toLocale("B")           =>  1.2KB
100_000.toLocale("B")        =>  98KB
(3*1024*1024).toLocale("B")  =>  3MB


Sql now supports mapping timestamp, date, and time to their Fantom equivalents DateTime, Date, and Time.

Deprecated Facet

You can use the new @deprecated facet on a type or slot to output a compiler warning whenever it is used.

IO Enhancments

Added endian support and InStream.readChar

Change Log

Build 1.0.48 (21 Dec 09)

  • Fix List.insertAll error checking
  • Int.toLocale "B" pattern for formatting size in bytes
  • Add sys::deprecated facet and compiler warnings
  • DateTime, Date, and Time support in sql
  • Fix Uri.relTo(/) to remove leading slash
  • Change build::CreateZip.inDir => inDirs
  • Rename dom::Window -> dom::Win
  • Move dom::Win, dom::Doc to singletons
  • #768: Fan source to HTML bug
  • #796: Using Json to read/write Fan objects
  • #797: Setting const fields with reflection
  • #826: New docTools::IDEs chapter
  • #836: New WebMod API
  • #841: Proposal: fand to util
  • #844: List.getSafe
  • #848: Remove sys::Context
  • #851: Change |,| to |->|
  • #853: InStream::readChars
  • #854: Dom API cleanup
  • #855: Some API renames
  • #860: Range.offset
  • #861: compiler: fix Obj to Void coercion bug
  • #865: Make fwt::TreeModel.children non-nullable
  • #869: deprecate Obj.type, Type.loc, Type.log
  • #870: depreate bitwise operators ~ | ^ &
  • #873: InStream / OutStream endianness
  • #874: Field setters: val => it
  • #875: Add 1-step bootstrap script
  • #876: Source Doc Changes

ivan Tue 22 Dec 2009

Great! But it seems that link on the main page is not updated and points to However link works

tactics Tue 22 Dec 2009

And so ends the month of breaking changes!

Despite those all, it looks like it's going to be a good changeset. I can finally test out the webmod system :-D

helium Tue 22 Dec 2009

I don't like the way @deprecated is implemented. I think it should take a string and report it in the warning.

@depicated = "Use method bar instead"
Void foo()

ivan Tue 22 Dec 2009


I think this information should be in fandoc, because:

  • sometimes there may be no one-to-one mapping
  • if you add @deprecated, you need to do rebuild anyway, so you can rebuild doc
  • fandoc allows to provide more information in fancy format

Of course, sometimes having some info in warning may save a bit of time, but I don't think it is noticeable

helium Tue 22 Dec 2009

sometimes there may be no one-to-one mapping

And sometimes there is. For example instead of

WARN Deprecated slot 'sys::Obj.type'

you could get

WARN Deprecated slot 'sys::Obj.type'. Use 'sys::Type.of' instead.

And if there is not you could give a reason why its deprecated, or just point to the docs. I think anything is better than nothing.

The more information the compiler can give me the better.

brian Tue 22 Dec 2009

seems that link on the main page is not updated

Make sure you hit refresh after a build to see the latest changes to home page (especially if you are using chrome - its seriously aggressive in its caching)

I don't like the way @deprecated is implemented.

Andy agrees with you, so I will change it to be a string facet. I will make that change right before next build when I remove all the existing deprecated slots.

I can finally test out the webmod system

Definitely give it a whirl and see what you think. We've been using it now for the SkyFoundry system and I'm much happier with this design. It is much more manageable for gluing together subsystems.

Login or Signup to reply.