Talk:Uniform access principle: Difference between revisions

Content deleted Content added
Implementing WP:PIQA (Task 26)
 
(2 intermediate revisions by 2 users not shown)
Line 1:
{{WikiProject Computerbanner scienceshell|class=Start|importance=}}
{{WikiProject Computer science |importance=Low}}
}}
Decided to change this page to include more information, more language samples, and hopefully a less ruby vs python feel. Both have features which make them "close" to "proper" UAP, but neither gets it completely right. I think this is, mostly, because Bertrand's idea of "right" is emboddied in the [[Eiffel programming language]], which no one else has stolen enough of (sic) to get UAP completely in another language.
 
Line 31 ⟶ 33:
:After studying the previously appearing Common Lisp example some more, I would say that it does, at least partially, implement the original UAP. The syntax of directly setting an attribute or of invoking a function which sets the attribute (and does other stuff) looks to be the same. Anyone more experienced in Common Lisp care to chime in? --[[User:Aflafla1|Aflafla1]] ([[User talk:Aflafla1|talk]]) 09:21, 17 October 2013 (UTC)
:: what looks the same, is quite different:
<sourcesyntaxhighlight lang="lisp">
(setf (weight *egg*) 16.9) ;; using the accessor function
(setf (slot-value *egg* '%weight) 16.9) ;; accessing the slot directly
</syntaxhighlight>
</source>
::they only look similar because lips syntax is so minimalistic.
::the point of UAP is that you can replace the direct access to an attribute with a function to intercept that access without changing the code that accesses it..