Talk:Reflective programming: Difference between revisions

Content deleted Content added
No edit summary
remove
 
(12 intermediate revisions by 9 users not shown)
Line 1:
{{Talk header}}
{{WikiProject Computing |class=C |importance=Low |software=y |software-importance=Mid}}
{{WikiProject banner shell|class=C|
{{findsourcesnotice|Reflection|("object oriented" OR "programming (language OR paradigm)" OR "computer (programming OR science)")}}
{{WikiProject Computing |class=C |importance=Low |software=y |software-importance=Mid}}
}}
==Is eval reflection?==
 
I don't think eval should be considered in creating examples of reflection in programming languages. Few programs would ever use eval, and none would use it to hack around language limitations.
 
==Python Example==
Line 123 ⟶ 128:
 
<div class="boilerplate" style="background-color: #eeffee; margin: 2em 0 0 0; padding: 0 10px 0 10px; border: 1px dotted #AAAAAA;"><!-- Template:polltop -->
:''The following discussion is an archived debate of the {{{type|proposal}}}. <fontspan colorstyle="color:red;">'''Please do not modify it.'''</fontspan> Subsequent comments should be made in a new section on the talk page. No further edits should be made to this section. ''
 
{{{result|The result of the debate was}}} '''move'''. &mdash;[[User:Nightstallion|<span style="font-variant:small-caps">Nightst</span>]]<font color="green">[[User:Nightstallion/esperanza|<span style="font-variant:small-caps; color:green;">a</span>]]</font>[[User:Nightstallion|<span style="font-variant:small-caps">llion</span>]] [[User talk:Nightstallion|''(?)'']] <sup>[[Wikipedia:WikiProject Elections and Referenda|''Seen this already?'']]</sup> 07:49, 1 April 2006 (UTC)
==Requested move==
 
* [[Computational reflection]] → '''[[Reflection (computer science)]]''' &#133;… Return to previous name now blocked by history, more standard practice to disambiguate a term with the discipline name in parentheses. — [[User:Jon Awbrey|Jon Awbrey]] 04:52, 27 March 2006 (UTC)
----
:''Add *'''Support''' or *'''Oppose''' followed by an optional one-sentence explanation, then sign your opinion with ''<nowiki>~~~~</nowiki>
*'''Support''' --[[User:Soumyasch|Soumyasch]] 05:03, 27 March 2006 (UTC)
 
:''The above discussion is preserved as an archive of the debate. <fontspan colorstyle="color:red;">'''Please do not modify it.'''</fontspan> Subsequent comments should be made in a new section on this talk page. No further edits should be made to this section.''</div><!-- Template:pollbottom -->
 
== Example applications? ==
Line 172 ⟶ 177:
As someone unfamiliar with reflection, this article does a poor job of explaining what it is. I have a decent idea from the example section, but the rest of the article reads like an editorial on reflection, not a description. I think for starters the summary could be improved. It doesn't need to be so long, and it only needs to summarize what reflection is in a short and concise way. It also contains some confusing grammar. For example, "More generally, reflection is an activity in computation that allows an object to have information about the structure and reason about its own computation." Information about the reason about its own computation? I have no idea what that is supposed to mean. It would be great if someone with the knowledge could make this article more clear to people not familiar with the topic. --[[User:JRavn|JRavn]] 15:07, 14 August 2006 (UTC)
:: Agreed. The description is not clear for someone unfamiliar with reflection. [[User:Praslisa|Praslisa]] ([[User talk:Praslisa|talk]]) 21:02, 17 February 2011 (UTC)
:: Indeed, the article doesn't explain anything. This is what's called 'cyber rub bish'. Also, the correction was asked in 2006. It hasn't been done by 2011. Now it is 2018 some 11.5 years later - nothing changed. Now this is why the whole wikipedia is cyber rubbb ish. <!-- Template:Unsigned IP --><small class="autosigned">—&nbsp;Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/115.70.29.185|115.70.29.185]] ([[User talk:115.70.29.185#top|talk]]) 03:53, 22 January 2018 (UTC)</small> <!--Autosigned by SineBot-->
 
== Weak examples ==
All the code examples of reflection just regard what's [[dynamic dispatch]], but reflection is ''much more''. Better example needed. <span style="color: #800000; background-color: #FFFF80; padding: 1px 2px 3px 2px">''Said: [[User talk:Rursus|Rursus]] [[User:Rursus/OTHITPWMEEENAE|☺]] [[User:Rursus|★]]''</span> 17:10, 2 June 2007 (UTC)
 
[[WP:SOFIXIT]] :D --<span style="background-color: #Fda;">''[[User:Soumyasch|<fontspan colorstyle="color:#ff6633;">soum</fontspan>]]'' [[User talk:Soumyasch|(0_o)]]</span> 12:27, 3 June 2007 (UTC)
 
== C# Example doesn't fit ==
Line 222 ⟶ 226:
 
Truly reflective language, worth mention! The original example:
<sourcesyntaxhighlight lang="rebol">
foo: make object! [
hello: does [print "Hello"]
Line 232 ⟶ 236:
; with reflection
do get in foo to-word "hello"
</syntaxhighlight>
</source>
 
Fully featured example:
<sourcesyntaxhighlight lang="rebol">
foo: func [/local name code start-mark end-mark] [
name: ask "What is your name?^/"
Line 251 ⟶ 255:
)
]
</syntaxhighlight>
</source>
Running the code:
<pre>
Line 346 ⟶ 350:
==Reflection in BASIC==
 
Would functions in BASIC be considered a form of reflection with def fn? Since functions themselves are defined in BASIC and can (depending on the implementation be redefined). [[User:ZhuLien|ZhuLien]] ([[User talk:ZhuLien|talk]]) 11:52, 6 March 2018 (UTC) <!-- Template:Unsigned IP --><small class="autosigned">—&nbsp;Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/118.127.112.218|118.127.112.218]] ([[User talk:118.127.112.218#top|talk]]) </small> <!--Autosigned by SineBot-->
 
==Compile time reflection==
 
The article begins with:
 
"In computer science, reflection is the ability of a computer program to examine, introspect, and modify its own structure and behavior at runtime."
 
However, e.g. Heron and C++ communities know the concept of compile-time reflection. I think the scope of the article should also include these since they're used in similar ways as runtime reflection.
 
Sources:
* http://www.drdobbs.com/windows/compile-time-reflection-metaprogramming/228700607
* https://www.gnu.org/software/gcc/projects/cxx-reflection/
* http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0385r0.pdf
* https://rly.sexy/post/basic-reflection-in-pure-cpp17
 
The P0385R0 document has the following definition for reflection:
 
"In the context of computer science, the term reflection refers to the ability of a program to examine and possibly modify its own structure and/or behavior.
 
When combined with metaprogramming, this can include modification of the existing or the definition of new data structures, doing changes to algorithms or changing the way a program code is interpreted"
 
[[Special:Contributions/2001:14BA:1AFC:72F0:0:0:0:E18|2001:14BA:1AFC:72F0:0:0:0:E18]] ([[User talk:2001:14BA:1AFC:72F0:0:0:0:E18|talk]]) 03:39, 5 March 2019 (UTC)
 
::I agree with this. The [https://davidchristiansen.dk/david-christiansen-phd.pdf PhD dissertation by David Christiansen] on the reflection system of [[Idris (programming language)|Idris]] also defines reflection similarly, does not limit it to runtime. [[User:TuXie|TuXie]] ([[User talk:TuXie|talk]]) 18:21, 25 April 2019 (UTC)