Blog Post

#684 Build 1.0.45

brian Fri 24 Jul 2009

I have finally got a new build with the new symbol and repo features posted. Online docs are updated too. I don't think either symbols or repos are fully done, but the basic infrastructure is in place and pretty solid. Please take a look and play around with this stuff, and then we can discuss how to polish it up.

I think stuff is still liable to have some breaking changes over the next few months, but this build is much closer to what Fan will finally looks like.

Symbols

Consult the following new documentation to get started with symbols:

  • Pod: to learn about the new "pod.fan" source file for pod definitions
  • Symbols: everything about declaring and using symbols

You'll also note that the documentation includes a new "pod-meta.html" file for each pod which documents the pod's facets and its declared symbols. Types and slots now show their facets with links to the facet symbols. Some examples:

Repos

You should be able to setup a working repo now that doesn't require you to touch your core Fan installation. You can setup build symbols, flux configuration, and build/load pods all from a separate working repo. Take a look docLang::Repos to setup your environment to work with repos.

Note: I only support setting a working repo via FAN_REPO environment variable (no command line support). Plus there is only support for two repos chained together - I want to start simple.

Breaking Changes

If you have existing code, these are changes to be aware of:

  • Field storage symbol changed from @ to *
  • Pods must now have a "pod.fan" file
  • Most of meta-data in "build.fan" scripts moved into "pod.fan"
  • Facets must now be keyed by symbol
  • Facet reflection APIs now take Symbol instead of Str
  • Sys.homeDir is replaced by Repo.boot.home
  • Sys.appDir is sort of replaced by Repo.working.home
  • File structure for sys.props and flux config is moved to etc/symbols
  • Rework of JavaScript support from webappClient into sys and dom
  • Rename sys::Namespace to sys::UriSpace

Internally there are many fcode changes which shouldn't effect anyone if using a clean build:

  • fcode version was rolled
  • new symbol.def file in pod files
  • new symbolRefs.def in in pod files
  • facets now use symbolRef instead of name ref
  • increased depend size to from u1 to u2
  • new LoadSymbol opcode
  • new compressed timezone database format shaved off 20KB

Change Log

Build 1.0.45 (24 Jul 09)

  • Roll fcode version code 0x01_00_0034 => 0x01_00_0045
  • LoadSymbol opcode
  • Change field storage operator from "@" => "*"
  • fwt::Canvas support in IE using JavaFX
  • DateTime,TimeZone support for JavaScript
  • Fix Int.fromStr to work for signed 64-bit integers with radix 16
  • Split webappClient into sys and dom
  • Change all uses of javascript => js
  • Fix Str indexIgnoreCase/indexrIgnoreCase bug
  • Switch to new, more compressed timezone database format
  • #425: Separate pod install location
  • #558: DocCompiler - Facet Documentation
  • #564: Symbols
  • #606: Partial closure type inference?
  • #620: Dynamically controlled function types
  • #651: Type description of inferred function types
  • #657: Bug in docs with default arguments
  • #659: Rename sys::Namespace to sys::UriSpace
  • #663: wisp sluggish via apachebench
  • #664: Nullable params w/out name in func sig

tactics Fri 24 Jul 2009

Very nifty. I'll be playing around with this soon.

tompalmer Fri 24 Jul 2009

Going to have to try this one out.

Side note, something I forgot to bring up earlier, I wondered why you chose Symbol instead of Sym, since "sym" is still pronounceable and so on. I at first was taken aback by all the abbreviations in Fan (such as Obj, Str, sys, and so on), but then I started getting into it. Seemed like Symbol was outside that convention. I'm not dying one way or the other. I've just wondered about it.

jodastephen Fri 24 Jul 2009

In http://fandev.org/doc/docLang/Repos.html#symbols I believe the second example should have filenames ending with .fansym, not .fan.

I'll need to play with this to see how it feels. But, intuitively, I don't like the look of @hosts.val.each .... - the val looks wrong.

andy Fri 24 Jul 2009

Thanks Stephen - fixed.

qualidafial Sat 25 Jul 2009

If there is exactly one Symbol instance per declared symbol per VM, and the symbol's value is required only to be serializable (not immutable), doesn't that open the door to modify that object at runtime? e.g.

pod blah {
  virtual foo := Str[,]
}

@blah::foo.val.add("bar");

Or is the symbol's value deserialized every time val() is invoked?

qualidafial Sat 25 Jul 2009

Tagging symbols like @simple or @collection should have a default value of true so that simple tagging is possible, no?

@serializable
const class Distance
{
  const DistUnit unit
  const Float value
}

Distance d := Distance() { unit = DistUnit.cm, value = 10 }
os.writeObj(d) // Runtime error because d.type.facet(@simple) == false

Or does it simply depend on whether the facet is present, not on its value?

I had an idea that @serializable could have an encoder/decoder object as its value, with the default value being the default Fan serializer. This would allow mixing in various different serialization schemes into the same file--thus standard DSL types such as Regex or Matrix expressions could be embedded in serializable expressions.

qualidafial Sat 25 Jul 2009

Side note, something I forgot to bring up earlier, I wondered why you chose Symbol instead of Sym, since "sym" is still pronounceable and so on. I at first was taken aback by all the abbreviations in Fan (such as Obj, Str, sys, and so on), but then I started getting into it. Seemed like Symbol was outside that convention. I'm not dying one way or the other. I've just wondered about it.

I also thought Tag might be a nice concise name for symbols, but maybe that term is too overloaded.

tompalmer Sat 25 Jul 2009

Tagging symbols like @simple or @collection should have a default value of true so that simple tagging is possible, no?

The way it works today (if I understand) is the default value is the value you get for the facet if you don't apply it at all. As in:

// No @whatever facet here, so if you ask for the value of that facet, you get the default rather than say null.
Void someMethod() {}

To say just the facet name without a value means you are setting it to true:

// Same thing as @whatever=true, so this only works for Bools.
@whatever
Void anotherMethod() {}

I got confused at this at first, too, but it makes some sense. I haven't yet worked with it, so I can't claim to have a full feel for how it works in practice.

qualidafial Sat 25 Jul 2009

The way it works today (if I understand) is the default value is the value you get for the facet if you don't apply it at all. As in:

It was planned that way for a while, but not anymore. If the facet is not declared then the value is null. If the facet is declared but not explicitly given a value then the default value is used. e.g. @simple is the same as @simple=false since false is the default value for that symbol.

tompalmer Sat 25 Jul 2009

It was planned that way for a while, but not anymore.

Okay. Thanks much for the notice, and I see the docs saying the same thing. My bad missing the change.

jtobler Tue 28 Jul 2009

My Version 1.0.45 works fine when set to "java," but when set to "dotnet" I get this:

C:\JET\JetProjects\Fan>fan -version
System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
  at System.String.InternalSubStringWithChecks (Unknown Source)
  at System.String.Substring (Unknown Source)
  at Fanx.Tools.Tool.verifyDlls (Tool.cs:178)
  at Fanx.Tools.Tool.sysInit (Tool.cs:139)
Fan Launcher
Copyright (c) 2006-2009, Brian Frank and Andy Frank
Licensed under the Academic Free License version 3.0

.NET Runtime:
  clr.version: 2.0.50727.3074
  sys.version: 1.0.45

Fan Repos:
    boot:          file:/C:/User/ProgLang/Fan/fan-1.0.45/

Also, when I try to run the HelloFanWorld.fan program, below, while configured for "dotnet," I get the error reported below, also.

===== Start Program Listing =====

class HelloWorld
{
  static Void main()
  {
    echo("Hello Fan World!")
  }
}

===== End Program Listing =====

===== Start Error Message =====

C:\JET\JetProjects\Fan>fan HelloFan.fan
System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
  at System.String.InternalSubStringWithChecks (Unknown Source)
  at System.String.Substring (Unknown Source)
  at Fanx.Tools.Tool.verifyDlls (Tool.cs:178)
  at Fanx.Tools.Tool.sysInit (Tool.cs:139)
ERROR: cannot compile script
sys::UnsupportedErr: Not yet implemented
  sys::Map.ordered (Map.cs:252)
  compiler::PodDef.make (PodDef.fan:25)
  sys::FanObj.with (FanObj.cs:130)
  sys::FanObj.with (FanObj.cs:121)
  compiler::PodDef.make_ (PodDef.fan:25)
  compiler::PodDef.make (Unknown Source)
  compiler::InitInput.initPod (InitInput.fan:179)
  compiler::InitInput.run (InitInput.fan:46)
  compiler::Compiler.frontend (Compiler.fan:73)
  compiler::Compiler.compile (Compiler.fan:61)
  compiler::Main.compileScript (Main.fan:50)

===== End Error Message =====

Is it me or is it Memorex?

andy Tue 28 Jul 2009

Those are probably my issues. Its been a few builds since I've gone thru dotnet with a fine tooth comb. I'll make sure I look through it before our next build.

p.s. - to make all of that program listing part of the same <pre> block make sure every line is indented at least two spaces in your comment.

Login or Signup to reply.