Talk:Create an object/Native demonstration: Difference between revisions
Content added Content deleted
(→wrong name?: new section) |
m (→wrong name?: explain) |
||
Line 10: | Line 10: | ||
I think this task might have the wrong name. It might be better to call it "immutable map" or something like that. It's not so much a demonstration of creating an object and "native demonstration" doesn't make sense to me. --[[User:Mwn3d|Mwn3d]] 22:31, 16 February 2011 (UTC) |
I think this task might have the wrong name. It might be better to call it "immutable map" or something like that. It's not so much a demonstration of creating an object and "native demonstration" doesn't make sense to me. --[[User:Mwn3d|Mwn3d]] 22:31, 16 February 2011 (UTC) |
||
:Sorry to causing misunderstanding. I think Ruby's demonstration match, and in fact correct, my idea. The object requirements should be 1. No new KEY could be added, and KEY set at initialization cannot be removed ; 2. VALUE can be modified and can be reset (by method delete/reset/clear etc. whatever appropriate in the language) to DEFAULT VALUE which has been set at initialization. But the object creation task is just a means to expose those Magic Method, which is the real goal of this task. For example, one can make a hash class object that access values by key by using a method '''getValueByKey''', or by using a Native(?) method, for example in D, '''opIndex'''. It is this '''opIndex''' that I called Magic Method. I cannot express my idea well :( [[User:Dingowolf|dingowolf]] 23:19, 16 February 2011 (UTC) |