Record.from( path ) -> from( path : string, Type = Record )
Type.shared -> shared( Type )
We're keeping the Collection.Refs type so far.
These modifiers could be used in place of type(), and could potentially lead to better code in TypeScript.
@type( Collection.subsetOf( '~users' ) ).as users : Collection<User>
@subsetOf( '~users' ).as users : Collection<User>
@type( User.from( '~users' ) ).as user : User
@from( '~users' ).as user : User
@type( User.shared ).as user : User
@shared( User ).as user : User
In regular JS, it will lead to cleaner annotations as well
@define class X extends Record {
static attributes = {
s : subsetOf( '~users' ),
r : from( '~users' ),
sh : shared( User )
}
}
It will lead to cleaner ownership semantic (type means aggregation). It could allow taking attribute metatype and change its ownership scheme. Also, it could allow for splitting relations to the separate assembly.
It should be implemented as primary mechanics at stage 1 with backward compatibility fallbacks.
All ownership modifiers should be replaced with functions like
type( Ctor )
.Collection.subsetOf( path )
->subsetOf( path : string, Type = Collection )
Record.from( path )
->from( path : string, Type = Record )
Type.shared
->shared( Type )
We're keeping the Collection.Refs type so far.
These modifiers could be used in place of
type()
, and could potentially lead to better code in TypeScript.In regular JS, it will lead to cleaner annotations as well
It will lead to cleaner ownership semantic (
type
means aggregation). It could allow taking attribute metatype and change its ownership scheme. Also, it could allow for splitting relations to the separate assembly.It should be implemented as primary mechanics at stage 1 with backward compatibility fallbacks.