Not logged inOpenClonk Forum
Up Topic New relaunch rule

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to Sven2

> A setter SetInfinite would have worked in both cases even though it would simply replace a variable assignment in one.


Yes, that's why I'm advocating the use of a setter.

But the relaunch rule used Set(setting_name, value), and Set was basically defined as this[setting_name] = value;.

I'm not against having SetX functions for every property X. I'm just against having one generic Set function. We could as well remove all functions from an object and replace it by one big "Do" function. Like some_object->Do("Explode"). But there's no reason to build another layer of abstraction.

You are correct that foo->Set("setting_name", value) is probably better than foo.setting_name = value; because could put compatibility shims into such a generic setter (if (setting_name == "stack_count") do_something_special()). But in the long run, that will be pretty hard to maintain.

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill