Blog Post

#393 Build 1.0.35

brian Fri 14 Nov 2008

The latest build has been posted and online docs updated.

XML

This build includes a new API for working with XML. There is a set of Fan-centric classes for modeling the DOM and a non-validating XML parser. The XML parser can parse a DOM into memory or be used as a pull parser.

Here is a sample program to read in an xml file and print it to stdout:

using xml
class XmlTest
{
  static Void main(Str[] args)
  {
    f := args[0].toUri.toFile
    doc := XParser(f.in).parseDoc
    doc.write(Sys.out)
  }
}  

Documentation

I've taken the time to go through all the documentation to update it for nullable types and value types. If you notice any errors still in the docs please let me know.

There are also a couple new chapters in the docs:

  • Deployment: covers pod depends and how fan code is deployed
  • Fwt: there is now a chapter with an overview the Fan Widget Toolkit

Coercion to Non-Null Runtime Checking

The Java runtime now generates an opcode to check coercions from nullable to non-nullable. See discussion.

Punchlist

Most of this build was spent catching up on my punchlist. There are a lots of bug fixes and minor enhancements to the compiler, fwt, and flux which are detailed below.

Change Log

Build 1.0.35 (14 Nov 08)

  • Update documentation for nullable and value types
  • New docLib::Fwt chapter
  • New docLang::Deployment chapter
  • Turn on non-null coercion runtime checking
  • Allow function types const fields with implicit toImmutable
  • Allow any list or map type as const field via implicit toImmutable
  • New xml API
  • OutStream.writeXml
  • Fix compiler checking of internal types
  • Fix compiler auto-casting of function types
  • Fix compiler to disallow empty try blocks
  • Fix compiler to allow for(...); and while(...);
  • Fix compiler to include fandoc for enum defs
  • Enhance docCompiler to show overridden slot and inherited fandoc
  • Fwt: file and directory dialogs
  • Fwt: RichText line background styling
  • Flux: persist undo/redo stack between hyperlinks
  • Flux: allow drag and drop of files to hyperlink
  • Flux: highlight current line
  • Flux: show short filenames in console instead of full paths

helium Fri 14 Nov 2008

Fix compiler to allow for(...); and while(...);

D explicitly disallows this. And I don't see a reason for it if you don't want to participate at the equivalent of the IOCCC or want to play something like Perl golf in Fan.

katox Fri 14 Nov 2008

helium: does it also disallow if(...);? That's something I hang myself occasionally on ;)

andy Fri 14 Nov 2008

I just had the same issue last night katox - I agree those seem like they should all be illegal - and you must explicitly use {}.

brian Fri 14 Nov 2008

D explicitly disallows this. And I don't see a reason for it if you don't want to participate at the equivalent of the IOCCC or want to play something like Perl golf in Fan.

Maybe just because I've been doing a lot of C lately, but I kind of like it - especially when using a for statement to loop thru a linked list. But it is definitely a bit weird with a language like Fan which doesn't require semicolons to terminate a statement.

Any other opinions on that matter?

cheeser Fri 14 Nov 2008

(This originally was done in a reply to [email protected] because I read these through emails but I can't tell if it went anywhere but a bitbucket.)

I'm just learning fan ( or trying to ) but if the trailing semicolons are optional, then i'd disallow such a construct as it would lead to subtle bugs in cases where someone left off that semicolon. Forcing the {} makes it clear that the loop is empty and removes abiguity in regards to what the method body is (or isn't in this case.) I'm not a language geek/lawyer, but that's how I see it.

brian Sat 15 Nov 2008

Fix compiler to allow for(...); and while(...);

OK - I undid this change. If you want to use a for or while loop with no body you need to use {}.

Login or Signup to reply.