Bot Libre Dev Sign In : Sign Up

Self programming

by eavinash1983 posted Mar 14, 23:11

1. Self definies many utility classes as said in the documentation.Language , Date and Util are the ones mentioned there.Are there are any other classes definied in self. Where can I get the entire list of classes that I can use in Self script.

2. Can you elaborate more on Symbol in self.The documentation says 'The Symbol operator create a new primitive symbol representing the meaning of a word'. What exactly mean by primitive symbol and defines meaning?

3. Variable can be used in a case variable.It means that the variable should be definied before using in the case ?

In the documentation there is an example explaining state and there I found these lines

state repeatState { case someWord goto repeatWordState;

someword was not definied anywhere ? So ideally it should be defined in order to be used in Self ? or is it defined on the fly as javascript does ?
In the below variable declaration for digits the meaning is number (: what does double colon symbolize over here) var digits { meaning : :number; } var number { instantiation : #number; }

by admin posted Mar 16, 8:32
1 - We will have a new user manual released soon that details the Self classes and functions. There is also this FAQ post,

2 - Symbol is just a JavaScript function that we are reusing for symbol/primitive objects in Self. You can define any global object using a #myobject syntax as well. This will define the object in the bot's database so you it from any script, similar to a global variable. I think there is also a toSymbol() function you can call on a string object to create a symbol with its text.

3 - Variables are auto defined, so you do not need to declare them. When you declare them you can add constraints, like the variable will only match instantiation of #number, etc. Without constraints the variable will match any word or object.

The :: is just a typo/left over from our old Self 1.0 syntax. You no longer need to prefix variables with :

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 284, today: 1, week: 1, month: 20

Id: 16416063
Posted: Mar 14, 23:11
Updated: Mar 16, 8:26
Replies: 1
Views: 218, today: 1, week: 1, month: 20
I'm sure