I've implemented the shorthand, Python-style construction calling syntax based on the previous proposal. This feature is orthogonal to the construction/with-block issues, which I'm not ready to tackle since an elegant solution seems elusive.
This particular change is just for the shorthand sugar to omit explicitly calling make:
The new syntax rocks! Since it is convention, I've updated the entire codebase to use it. I think the shorthand syntax really removes a lot of noise from the code, especially with exceptions.
The updated section in the Methods chapter:
Construction Calls
Fan supports a special syntax called construction calls with the syntax Type(args). These calls are resolved as follows:
bind to Type.fromStrif there is exactly one Str argument andType.fromStr exists (see simple literals)
otherwise bind to Type.make
The construction operator works on static methods or constructors. So you can use it when make is a constructor or when make is a factory method. The method of construction call Foo(...) must return Foo.
Convention is to always prefer a construction call to using make explicitly:
brian Fri 25 Jul 2008
I've implemented the shorthand, Python-style construction calling syntax based on the previous proposal. This feature is orthogonal to the construction/with-block issues, which I'm not ready to tackle since an elegant solution seems elusive.
This particular change is just for the shorthand sugar to omit explicitly calling make:
The new syntax rocks! Since it is convention, I've updated the entire codebase to use it. I think the shorthand syntax really removes a lot of noise from the code, especially with exceptions.
The updated section in the Methods chapter:
Construction Calls
Fan supports a special syntax called construction calls with the syntax
Type(args)
. These calls are resolved as follows:Type.fromStr
if there is exactly one Str argument andType.fromStr
exists (see simple literals)Type.make
The construction operator works on static methods or constructors. So you can use it when
make
is a constructor or whenmake
is a factory method. The method of construction callFoo(...)
must returnFoo
.Convention is to always prefer a construction call to using
make
explicitly:tompalmer Fri 25 Jul 2008
Great news.
alexlamsl Fri 25 Jul 2008
I think we all have concensus on this part of the discussion ;-)