agentscript0 icon indicating copy to clipboard operation
agentscript0 copied to clipboard

Should breeds inherit defaults?

Open bennlich opened this issue 10 years ago • 4 comments

I thought they used to, and that something changed, because now they don't. But I'm not positive they ever did. Do you know what was intended? E.g.

this.agentBreeds("cakes fish");
this.agents.setDefault("size", 5);

Should cakes and fish have default sizes of 5?

bennlich avatar Feb 26 '15 01:02 bennlich

Nope. AS clones the Agent class for each breed before defaults get a chance to be made.

Good point tho. I wonder if NL does this, it certainly makes sense.

If we convert from cloning classes for defaults/multimodel to shimming in a defaults layer, we could implement this behavior.

On Wed, Feb 25, 2015 at 6:59 PM, Benny Lichtner [email protected] wrote:

I thought they used to, and that something changed, because now they don't. But I'm not positive they ever did. Do you know what was intended? E.g.

this.agentBreeds("cakes fish"); this.agents.setDefault("size", 5);

Should cakes and fish have default sizes of 5?

— Reply to this email directly or view it on GitHub https://github.com/backspaces/agentscript/issues/83.

backspaces avatar Feb 26 '15 17:02 backspaces

K. Does order matter? Like if you set defaults and then create breeds? Ideally order would not matter, I think. On Feb 26, 2015 9:11 AM, "Owen Densmore" [email protected] wrote:

Nope. AS clones the Agent class for each breed before defaults get a chance to be made.

Good point tho. I wonder if NL does this, it certainly makes sense.

If we convert from cloning classes for defaults/multimodel to shimming in a defaults layer, we could implement this behavior.

On Wed, Feb 25, 2015 at 6:59 PM, Benny Lichtner [email protected] wrote:

I thought they used to, and that something changed, because now they don't. But I'm not positive they ever did. Do you know what was intended? E.g.

this.agentBreeds("cakes fish"); this.agents.setDefault("size", 5);

Should cakes and fish have default sizes of 5?

— Reply to this email directly or view it on GitHub https://github.com/backspaces/agentscript/issues/83.

— Reply to this email directly or view it on GitHub https://github.com/backspaces/agentscript/issues/83#issuecomment-76220112 .

bennlich avatar Feb 26 '15 20:02 bennlich

K. Does order matter? Like if you set defaults and then create breeds? Ideally order would not matter, I think.

​Not sure I understand. But I suspect you mean​

​"can I set defaults on agents, then on ​fish" .. will they inherit from each other? They would with our current clone stunt, I think. But because the breeds are created within the constructor, there's no way for them to do so .. the breeds get created with the vanilla Patch/Agent/Link classes before they can have any defaults applied.

So basically I think defaults are independent of Foo and a Foo breed. I think that is the way I'd expect it to work, given that Patch/Agent/Link are not really being subclassed by breeds, but just copied but with different "own" variables.

I think if we enforced the "own" variables ( i.e. agents.own("age weight height") ) it would make things much clearer .. and make it easier to convert between breeds .. and catch spelling errors etc. We could do it by making the individual agents non-extensible maybe.

backspaces avatar Feb 27 '15 00:02 backspaces

Hmm.. looking at the NL docs, I could only find set-default-shape. I thought you could default color, size etc but apparently not.

I'm having difficulty integrating the new typedColor into AS, partly due to how defaults currently work. If I go back to something like our earlier approach: adding an additional object shimmed into the class for the defaults, then we might be able to have the sorta expected behavior you mentioned.

On Thu, Feb 26, 2015 at 10:10 AM, Owen Densmore [email protected] wrote:

Nope. AS clones the Agent class for each breed before defaults get a chance to be made.

Good point tho. I wonder if NL does this, it certainly makes sense.

If we convert from cloning classes for defaults/multimodel to shimming in a defaults layer, we could implement this behavior.

On Wed, Feb 25, 2015 at 6:59 PM, Benny Lichtner [email protected] wrote:

I thought they used to, and that something changed, because now they don't. But I'm not positive they ever did. Do you know what was intended? E.g.

this.agentBreeds("cakes fish"); this.agents.setDefault("size", 5);

Should cakes and fish have default sizes of 5?

— Reply to this email directly or view it on GitHub https://github.com/backspaces/agentscript/issues/83.

backspaces avatar Feb 27 '15 03:02 backspaces