Skip to content

Commit f023a55

Browse files
juss example with comments
1 parent 87ace49 commit f023a55

File tree

1 file changed

+131
-0
lines changed

1 file changed

+131
-0
lines changed

examples/commentedExample.juss

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/* THIS IS HOW RESULT OF SERIALX (Juss) REAL LIFE IMPLEMENTATION MIGHT LOOK LIKE */
2+
3+
name = "app";
4+
5+
dependencies =
6+
{
7+
//This is scope, the Juss representation of ugp.org.SerialX.Scope!
8+
//Each scope can have its own variables with values and independant values!
9+
10+
//Every scope can read and write parent scopes variables however by changing them, it will only affect local one and not parents one!
11+
$name; //"app" ($ obtains value from variable, in this case "app")
12+
$name = "no longer app lol!";
13+
14+
composition-api = "1.0.0 (beta)", //This is one of the variables of this scope...
15+
bootstrap = "4.5.3",
16+
version = "2.3.4",
17+
something =
18+
{
19+
dataStorage =
20+
{
21+
//This is "dataStorage" (stored by variable "dataStorage") sub-scope aka nested skope of its parent scope "something" which is subscope of "dependencies",
22+
xml =
23+
{
24+
version = "2.8.0"
25+
},
26+
yaml =
27+
{
28+
version = "1.10.5"
29+
},
30+
josn =
31+
{
32+
version = "4.0.0"
33+
},
34+
serialx =
35+
{
36+
version = "The best version!"
37+
}
38+
},
39+
ppl =
40+
{
41+
//This is "ppl" (stored by variable "ppl") sub-scope aka nested skope of its parent scope "something" which is subscope of "dependencies".
42+
//All of these scopes are sub-scopes of "ppl", there can be infinite number of variables and independent values together in one Scope!
43+
vladimir =
44+
{
45+
age = 37;
46+
residence = "russia";
47+
},
48+
ivan =
49+
{
50+
age = 19;
51+
residence = "russia";
52+
},
53+
filip =
54+
{
55+
age = 17;
56+
residence = "slovak";
57+
},
58+
peter =
59+
{
60+
age = 17;
61+
residence = "slovak";
62+
},
63+
lukas =
64+
{
65+
age = 17;
66+
residence = "slovak";
67+
},
68+
hans =
69+
{
70+
age = 51;
71+
residence = "germany";
72+
},
73+
pierre =
74+
{
75+
age = 44;
76+
residence = "france";
77+
}
78+
}
79+
},
80+
"lololoolollool"; //This is independent value of this scope.
81+
},
82+
$dependencies.something.dataStorage.serialx.version; //Obtaining value of "serialx" variable in "dependencies" sub-scopes!
83+
84+
devDependencies =
85+
{
86+
//Variables in this scope have nothing to do with variables from "dependencies" because they are in diffrent scope!
87+
$name = "absolutely not app!";
88+
89+
composition-api = "1.0.0 (alpha)",
90+
bootstrap = "2.2.3",
91+
version = "1.2.3",
92+
something =
93+
{
94+
dataStorage = {},
95+
ppl = {}
96+
}
97+
};
98+
//Setting variable of scope from outer world (possible since 1.3.2)
99+
devDependencies.something.ppl.ludvig =
100+
{
101+
age = 60;
102+
residence = "russia";
103+
};
104+
105+
//Since 1.2.5 Serializer fully supports Json and JavaScript object!
106+
jsonCrossover =
107+
{
108+
"hello" : "Hello world I am Javascript object notation!",
109+
"jsonObject" :
110+
{
111+
name: "John",
112+
age: 31,
113+
city: "New York"
114+
},
115+
"jsonArray" : [1, 2, 3, 4]
116+
},
117+
118+
//$bullshit <-- No this is not possible, variable "bullshit" cannot be accessed here because it was not initialized yet!
119+
bullshit =
120+
{
121+
//This scope cant access variable that is stored by (bullshit), because variable is always created after its value (Scope in this case) is constructed!
122+
server = "service server",
123+
build = "service build",
124+
sql = "service sql";
125+
},
126+
$bullshit; //Now we can access variable "bullshit"
127+
128+
$name; //"name" is still "app" in this scope!
129+
130+
arr = {1, 2, 3, 4, 5}; //This is scope with only values! So lets call it... array I guess!
131+
superArr = {$arr, $arr, $arr, $arr::new /*creates clone of arr*/, {1, 2, 3, 4, 5}}; //Yes... this is completely normal and possible in Juss but keep in mind that first, second and third element will refere to same instance in this case!

0 commit comments

Comments
 (0)