Aktualizacja Diamond i zbudujemy wam własną aplikację dla systemu Android lub iOS
Bot Libre Dev

Self programming

w eavinash1983 wysłany Mar 14 2017, 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 2017, 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,
https://www.botlibre.com/forum-post?id=14527502

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: 2398, today: 2, week: 3, month: 26

Identyfikator: 16416063
Wysłany: Mar 14 2017, 23:11
Aktualizacja: Mar 16 2017, 8:26
Odpowiedzi: 1
Widok: 2034, dziś: 3, tydzień: 6, miesiąc: 30
0 0 0.0/5