-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use $ for meta-tags everywhere #43
Comments
We could have both work, in theory. In the "service" case, if we see a prefixed attribute, it's the new syntax. In the "dependency" case, if we see an unprefixed attribute, it's the new syntax. We should probably avoid supporting it forever, bu I'm not sure... I hate having to update because dependencies... |
There are some edge cases to consider: plugin:
baz:
$class: My::Plugin::Baz
foo:
$class: My::Plugin::Foo
class:
$class: My::Plugin::Class If I ask for There are also straight-up ambiguities. But we don't want to get into a Makefile situation... I'm tempted to, if someone reports a problem, allow a backcompat option to the constructor that will allow old containers to work. |
I think if we're extremely careful and precise and well-tested, we can make this work, and then remove it for 2.0 |
I don't like the ambiguity of mixing meta tags and non-meta tags, so just force meta tags everywhere. This means that plain values do not need a meta tag. We might be able to repurpose |
I've flip-flopped on mixing meta and non-meta tags, because allowing multiple ways of specifying a service is nice. In this example, we can specify a service as a string, as a hashref, or as a full object. source: /foo/bar/baz source:
url: /foo/bar/baz source:
$class: Cradle::Source::Svn
url: /foo/bar/baz # script.pl
my $wire = Beam::Wire->new( ... );
my $source = $wire->get( 'source' );
if ( !ref $source ) {
$source = Cradle::Source::Git->new( url => $source );
}
elsif ( !blessed $source ) {
$source = Cradle::Source::Git->new( %$source );
} This makes the config files more powerful and easier to write for end-users. |
Turns out, we can support this new way and the old way at the same time. There are likely some ambiguities, but we'll address those as they come up. |
We've got two weird things:
When declaring a service, we use "class", "args", "method", "sub", etc... but when declaring a dependency, we use "$class", "$args", "$method", "$sub", etc... I think we should use the "$prefix" version everywhere.
If we do that, we don't need to use "$args" if the object's constructor takes key-value arguments.
Would become:
And
$args
only needs to be dragged out when it isn't key/value pairs (an array, arraryref, or hashref)The text was updated successfully, but these errors were encountered: