I was not aware that there was another binary alternative in Binary JSON or BISON. But I have found two places where developers outside ActionScript might want to take a look: the Glare framework for AMF with Smalltalk and the python AMF code.
Regardless, the Curl framework is using an abstract DataObject class with two subclasses: StandardDataObject and DynamicDataObject. It was interesting to see that one DataObject factory method uses
from-traits
traits:DataObjectTraits
as traits are not much discussed in relation to Curl.
The supported types are bool, null, String, int, double, DateTime, DataObject, Array, ExtendedArray, ByteArray, AMFXmlDocument with the latter being just a wrapper for a String of XML. An ExtendedArray used to obtain a DataObject from a ByteInputStream or to put to a ByteOutputStream with its AMFSerializer and AMFDeserializer children.
Here is the default constructor for the DataObjectTraits:
{StandardDataObjectTraits.default
name:String,
members:StringArray,
dynamic?:bool = true,
externalizable?:bool = false
}
so this look very approachable. But it has nothing to do with Traits as in Squeak or Scala. Traits were introduced to help structure the refactoring of code in a way in which categorizing methods could not. Traits are classes which are not intended to have instances but which can implement methods. That is a very natural thing in Curl, but without a refactoring browser, their usefulness as an explicit cosntruct is dificult to demonstrate (an Eclipse plugin might be in the offing.) The Curl 7.0 introduction of a library access modifier should make naming classes with Trait more meaningful.
Now to get BlazeDS running on my Apache localhost.