参加ボットのリブレの パートナー、アフィリエイト プログラムや支援の無料のオープンなプラットフォーム
Bot Libre Dev

Self programming

による eavinash1983 掲載 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: 2395, today: 0, week: 0, month: 23

Id: 16416063
掲載: Mar 14 2017, 23:11
更新: Mar 16 2017, 8:26
回答: 1
眺望: 2030, 今日の: 1, 週間: 2, 月: 26
0 0 0.0/5