20230322
[shlib.git] / doc / UM.txt.en_US / 2.5.attr-attribute-variable.txt
blob71761b47c9a2f25fd5667483445a874c16ee61e8
1 [attr]
3 # concept
4 ========
5 attr/attribute/attr-var: it's the variable connect sub-string wit "::". and it is also an environment variable.
6 domain: the prefix of attr-var, to show the structrue of variable.
10 # introduction
11 ==========
12     attr is a type of variable used to exten tree-structrue of environment variable. it also can be orgnized as a list of variable under a domain.
13     one weekness of shell script is that it can not use structrued variable. all data is a string variable. attr-var provide a method to implement this featrue.
14     actually, it's not only structed by variable, functions also can be added. although they looks in a structured variable, but they are the seperated variable and functions.
15     for OOP, it need other featrues:
16 @ typedef for var.
17 @ invoke in a object domain.
18 @ virtual functions.
19 @ inherit.
20 @ virtual/friendly.
21 @ function defined with paramter name without type.
23     some of feature is not supported
24 @ pointer type. but it can operate like ::>, so that the attr after it is accessed by content of attr-var.
25 @ basical type of int/float and so on, only string variable.
26 @ static/const variable in struct.
28     attr-var can be used in two type. one is pure data struct, the other one is some featrue of OOP.
31 # API
32 ====
33 # there is no actual type could be defined, only a set of string variables under the 'type'.
34 # inherit.
35 attr_struct <tname> <attr-name-list>
36 # create var of vname by type of tname with current module(enearly eaqual to class) domain.
37 attr_create <tname> <vname>[ = <value> ]
38 # release var space under the attr-var/domain.
39 attr_release <name>
40 # create a ar as attr_create, but the domain is global. it is used in global var declaration.
41 attr_declare <tname> <vname> [ = <value> ]
42 # append the new attr to the attr-var dynamically.
43 append
44 # delete one of the attr under a domain.
45 attr_delete
46 # get the value of attr uder current domain. domain is current module, or setted by 'usig'.
47 attr_get <attr-name>
48 # set attr with a value. if the var is not exist, it will do nothing.
49 attr_set <attr-name> = <value>
50 # invoke functions under an domain. there are several type of function. one is defined by function with :: domain prefix, the other is attr-var stored a function/cmd name.
51 attr_invoke <domain::func-name> <param-list>
52
53 set_domain
54
55 using
56
57 attr_overload
58
61 # Usage
62 ======
66 # Variabe operation
67 ===============
68     typcal operation is create/release/declare/get/set/invoke. they are used to operate an attr-var.
69 # struct
70     struct is a typedef operation.
71 # reference
72     ::>, with type prefix like PrEFv_ or PrEFf_.
73     any attr operating with a ::> prefix is a reference operation.
74 # domain/global/local/module
75     
78 # OOP Cenception
79 ==============
81 # packae with function
83 # inherit
85 # virtual/friendly
87 # *try...catch..final...throw
88