Talk:Uniform access principle: Difference between revisions

Content deleted Content added
Assessment: Computer science (Start/Low) (Rater)
m Task 70: Update syntaxhighlight tags - remove use of deprecated <source> tags
Line 31:
: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..