I have posted the new 1.0.56 build and updated the online docs.
Operator Methods
The biggest change in this build was ticket #604. This ticket has been around since May 2009 so its been sitting around a while on the docket. I probably should have tackled it sooner because it created several breaking changes, but the new design is much better.
Previously the methods such as "plus", "get", "set" were implicitly mapped to an operator symbol. Now you must explicitly annotate methods with the @Operator facet. Naming conventions are enforced to determine which operator symbol is used by the method:
prefix symbol degree
------ ------ ------
negate -a unary
increment ++a unary
decrement --a unary
plus a + b binary
minus a - b binary
mult a * b binary
div a / b binary
mod a % b binary
get a[b] binary
set a[b] = c ternary
The unary and set operators require the exact name specified above. The binary operators must only start with the given name. We now allow binary operators to be overloaded by parameter type. Many sys APIs have been enhanced to support this feature:
Date - Duration
DateTime - Duration
Num classes now overload arithmetic operators, for example Int + Float yields Float
As part of this change you might find that code which previously compiled fine now reports errors that an operator has ambiguous resolution. In most cases the fix is simply to insert an explicit case. Also note that string concatentatino only works now if left-hand side is actually a string.
For more information:
Ticket 605: full description of design and breaking changes
My favorite feature in this build is the ability to easily declare localization strings right in your source code:
Label { text = "$<app.title=My App Title>" }
The code above automatically generates a localization key "app.title", and calls sys::Pod.locale to use the localized string for that key. Now you have no reason not make your applications support localization ;-)
One interesting feature I've done in our commercial product SkySpark is add support for units directly into our scripting language. It is a core aspect of all numbers (sort of like Frink). As part of that feature I really put the Unit API thru its paces and decided it needed some changes:
Unit may be be keyed/found using multiple identifiers including its name and symbol
Unit.fromStr now looks up a unit by its key
Unit.define is now used to define a new unit in the VM (previously done by fromStr)
Unit database is now simple text file (versus fog file)
Initial support for multiplication and division
Facet Inheritance
Facets may now be inherited by annotating them as follows:
@FacetMeta { inherited = true }
facet class MyFacet {}
I beefed up support for serialization to support slot literals using normal Fantom syntax of Type#slot. I suspect this will be handy for people building meta-data frameworks.
Change Log
Build 1.0.56 (11 Nov 2010)
Redesign Unit to be keyed by arbitrary ids list including symbols
Redesign Unit definition: fromStr -> define, find -> fromStr
Redesign unit database as simple text file
Add Unit.mult, Unit.div
js: Full Charset and Stream support
compilerJs: Wrap CondExpr in parens to preserve grouping
Maybe the compiler still emitting obj[Range] as calls to slice instead of getRange?
champt0nTue 16 Nov 2010
Awesome!
The home page still links to build 1.0.55 though. Maybe I missed some other obvious download link, but I ended up going to fan.googlecode.com directly to grab 1.0.56.
yachrisTue 16 Nov 2010
@champt0n -- your browser (or an upstream provider) may have cached the page. I got 1.0.56 directly off the front page several days ago with no problem.
champt0nThu 18 Nov 2010
Damn you web page caching! Making me look like a n00b!! Oh well, it shows up correctly now.. LOL
brian Thu 11 Nov 2010
I have posted the new 1.0.56 build and updated the online docs.
Operator Methods
The biggest change in this build was ticket #604. This ticket has been around since May 2009 so its been sitting around a while on the docket. I probably should have tackled it sooner because it created several breaking changes, but the new design is much better.
Previously the methods such as "plus", "get", "set" were implicitly mapped to an operator symbol. Now you must explicitly annotate methods with the
@Operator
facet. Naming conventions are enforced to determine which operator symbol is used by the method:The unary and set operators require the exact name specified above. The binary operators must only start with the given name. We now allow binary operators to be overloaded by parameter type. Many sys APIs have been enhanced to support this feature:
Date - Duration
DateTime - Duration
As part of this change you might find that code which previously compiled fine now reports errors that an operator has ambiguous resolution. In most cases the fix is simply to insert an explicit case. Also note that string concatentatino only works now if left-hand side is actually a string.
For more information:
Localized Str Interpolation
My favorite feature in this build is the ability to easily declare localization strings right in your source code:
The code above automatically generates a localization key "app.title", and calls
sys::Pod.locale
to use the localized string for that key. Now you have no reason not make your applications support localization ;-)Further information may be found in docLang
Units
One interesting feature I've done in our commercial product SkySpark is add support for units directly into our scripting language. It is a core aspect of all numbers (sort of like Frink). As part of that feature I really put the Unit API thru its paces and decided it needed some changes:
Facet Inheritance
Facets may now be inherited by annotating them as follows:
As part of this change the sys::Serialization facet is now inherited. Also see docLang
Serialization - Slot Literals
I beefed up support for serialization to support slot literals using normal Fantom syntax of
Type#slot
. I suspect this will be handy for people building meta-data frameworks.Change Log
Build 1.0.56 (11 Nov 2010)
qualidafial Fri 12 Nov 2010
Very nice!
I am getting one compiler warning though:
For this line of code:
Maybe the compiler still emitting
obj[Range]
as calls toslice
instead ofgetRange
?champt0n Tue 16 Nov 2010
Awesome!
The home page still links to build 1.0.55 though. Maybe I missed some other obvious download link, but I ended up going to fan.googlecode.com directly to grab 1.0.56.
yachris Tue 16 Nov 2010
@champt0n -- your browser (or an upstream provider) may have cached the page. I got 1.0.56 directly off the front page several days ago with no problem.
champt0n Thu 18 Nov 2010
Damn you web page caching! Making me look like a n00b!! Oh well, it shows up correctly now.. LOL