Talk:Create an object/Native demonstration: Difference between revisions

(→‎wrong name?: and ...)
 
(8 intermediate revisions by 7 users not shown)
Line 8:
 
:: The [[Perl]] solution will need to use [http://perldoc.perl.org/perltie.html perltie] to tie a <tt>%hash</tt> to some <tt>$object</tt>, so that <tt>%hash{$key} = $value</tt> calls the magic method <tt>$object->STORE($key, $value)</tt>, and one writes code for <tt>STORE</tt>. If Perl has no perltie feature, I would omit this task from Perl. If Tcl has both dicts and objects, but Tcl has nothing like perltie, then one should omit this task from Tcl. --[[User:Kernigh|Kernigh]] 02:51, 17 February 2011 (UTC)
 
::: Hmm, I suppose I could use a trace on an array to stop someone from changing it (which would be similar in spirit to the perltie approach). Ugly as anything though. It's also not really what I'd call writing a ''native'' implementation of the “object”; it's layering a whole load off stuff over the top instead. Dictionary values work just as fine for non-modifiable (as Tcl's value-model is based on immutable values) but there I think it's violating the spirit of the task. –[[User:Dkf|Donal Fellows]] 12:19, 10 March 2013 (UTC)
 
:::: Just for the fun of it, I have added a Tcl implementation with variable traces. - [[User:Suchenwi|Suchenwi]] ([[User talk:Suchenwi|talk]]) 13:26, 7 May 2015 (UTC)
 
== wrong name? ==
Line 18 ⟶ 22:
:I am the author of the Ruby code in progress. I chose the name "fenced hash" in the Ruby code, but "fenced hash" might be bad name of page. I had trouble with two parts of the task description. First, I had to guess what "No new item can be added" does mean. For the Ruby code, I decided that no new KEY can be added. Second, I know what is "native hash", but I am not understanding what is "native way of object creation" or "native demonstration". The word "native" would have different meaning there. After I finish the Ruby code, I might edit the task description. After we fix the task description, we should drop "native demonstration" name. --[[User:Kernigh|Kernigh]] 02:51, 17 February 2011 (UTC)
:: And what do you think about the name ''"Emulating a native type"'' ? --[[User:Paddy3118|Paddy3118]] 05:12, 17 February 2011 (UTC)
::: More specifically, how about something in the direction of [[Associative Array/Emulation]]? That should relate well to [[Associative arrays/Creation]], and include a more specific hint as to what kind of native type is being emulated. --[[User:Short Circuit|Michael Mol]] 13:45, 17 February 2011 (UTC)
:::: I am not sure whether "Emulating an associative array" or "Emulating a native type" is better. I hate the names of the [[Associative arrays/Creation]] and [[Associative arrays/Iteration]] pages, because the slash suggests that these are subpages of an "Associative arrays" page, but there is no such page. (The [[Associative array]] page has no final "s".) --[[User:Kernigh|Kernigh]] 23:08, 21 February 2011 (UTC)
::::: Should we rename those by dropping the s?[[User:Markhobley|Markhobley]] 22:58, 6 July 2011 (UTC)
I agree this task needs a new name. What about Fixed Associative Map?
[[User:Garbanzo|Garbanzo]] ([[User talk:Garbanzo|talk]]) 20:31, 30 January 2021 (UTC)
==Changed wording==
I reworded the task based on the discussion above and the Ruby and D implementations. I tried to keep the meaning the same but it looks like not everyone had the same interpretation. I removed "magic methods" because none of the implementations mentioned it. Feel free to change it back or clean it up if I got something wrong.
[[User:Garbanzo|Garbanzo]] ([[User talk:Garbanzo|talk]]) 04:51, 31 January 2021 (UTC)
 
:I thought your changes might have been too much so added something back, as well as my own slant. What do you think?
:--[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 06:41, 31 January 2021 (UTC)
::Mentioning that the values can be modified is a good catch. For delete vs. reset, the original mentioned delete so that is less of a change but the semantics of using delete to restore values won't be idiomatic in many languages - maybe this could be left up to the implementers? For "magic methods", I wasn't sure what it was expecting. Is it operator overloading in this case? [[User:Garbanzo|Garbanzo]] ([[User talk:Garbanzo|talk]]) 08:08, 31 January 2021 (UTC)
125

edits