I added support for "simple literals" and "with blocks" which now make the Fan programming language a true superset of the serialization syntax. Both of these features are more powerful their serialization counterparts because they allow nesting of arbitrary expressions which likely capture state from their context scope.
An example simple literal:
Version("2.1")
Is syntax sugar for:
Version.parse("2.1")
An example with block:
base { a = 3; b = 4; c() }
Is syntax sugar for:
temp := base
temp.a = 3
temp.b = 4
temp.c()
If base is a type signature then it is syntax sugar for make:
brian Tue 28 Aug 2007
I added support for "simple literals" and "with blocks" which now make the Fan programming language a true superset of the serialization syntax. Both of these features are more powerful their serialization counterparts because they allow nesting of arbitrary expressions which likely capture state from their context scope.
An example simple literal:
Is syntax sugar for:
An example with block:
Is syntax sugar for:
If base is a type signature then it is syntax sugar for make:
There isn't actually a temp local - it is all done thru stack manipulation.
Unlike serialization, the compiler doesn't care about the Simple or Serializable facets - rather it only performs type checking for the substitutions.