4 ms·
I agree with the layout example and would add that prototype based languages that unify method calls with attribute lookups (through message sends) give you bot
by richcollins 17y ago
I agree with the layout example and would add that prototype based languages that unify method calls with attribute lookups (through message sends) give you both:
SomeController := Controller clone do(
layout := "template"
)
SomeController := Controller clone do(
layout := method(
if(params at("foo") == "bar", "foo-template", "template")
)
)
This way the framework would send the layout message to the cloned SomeController object and get the proper layout name for either case.
- deleted 17y ago[deleted]
- bensummers 17y agoObjective-C 2 could be quite nice for this too. It's a nice mix between static and dynamic languages, and a function of this nature can be implemented as a property or as a receiver of a message.