Bluish Coder

Programming Languages, Martials Arts and Computers. The Weblog of Chris Double.


2014-12-17

Changing Attributes in Self objects

A question came up in the Self irc channel today about how to change the 'comment' string for an object. Comments are stored as attributes on an object. These are accessed using mirrors.

A mirror for an object can be obtained using the asMirror method. The trait traits mirrors abstractMirror provides a number of methods that can be used to change the object via the mirror. This involves everything that is normally done through the programming environment. It includes adding, removing and changing slots, categories, attributes amongst other things. By drilling down in this trait you can see a programming category, which expands to include a changing annotation category and that holds a comments category. Within that you can find the methods for setting comments.

The video below shows the steps to find this from within the programming environment and demonstrates changing the comment on the initial shell object on the desktop. The code to change that comment is just:

self asMirror comment: 'hello world'

Tags


This site is accessable over tor as hidden service 6vp5u25g4izec5c37wv52skvecikld6kysvsivnl6sdg6q7wy25lixad.onion, or Freenet using key:
USK@1ORdIvjL2H1bZblJcP8hu2LjjKtVB-rVzp8mLty~5N4,8hL85otZBbq0geDsSKkBK4sKESL2SrNVecFZz9NxGVQ,AQACAAE/bluishcoder/-61/


Tags

Archives
Links