forked from sacalon/sacalon.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyle.html
More file actions
116 lines (109 loc) · 5.18 KB
/
style.html
File metadata and controls
116 lines (109 loc) · 5.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html>
<head>
<title>The Hascal Style</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/prism.css">
<script src="js/jquery.min.js"></script>
<script src="js/prism.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>*{max-width:100%;}</style>
<link rel="icon" type="image/x-icon" href="images/hascal-logo.png">
<link rel="stylesheet" href="./css/global.css">
</head>
<body>
<iframe src="./components/header.html" frameborder="0" id="header-section"></iframe>
<main role="main">
<br/>
<div class="container">
<div class="row">
<div class="col" style="font-size: large;">
<h1>The Hascal Style</h1>
<br/>
<br/>
<a href="#Whitespace">
<h2>
Whitespace
</h2>
</a>
<ul>
<li>One statement per line.</li>
<li>Use spaces instead of hardware tabs.</li>
<li>Each indentation level will be four columns.</li>
</ul>
<br/>
<a href="#Naming_Conventions">
<h2>
Naming Conventions
</h2>
</a>
<p>
Unless listedVariable names should be camelCased. So, names formed by joining multiple words have each word other than the first word capitalized. Also Function names should be split with an underscore(`_`).
<pre><code class="language-hascal">function myFunc()
var myLocalVar : int?</code></pre>
</p>
<p>
Module and package names should be all lowercase, and only contain the characters [a..z][0..9][_]. This avoids problems when dealing with case-insensitive file systems.
<pre><code class="language-hascal">use ctypto.sha256</code></pre>
</p>
<p>
The names of user-defined types should be PascalCased, which is the same as camelCased except that the first letter is uppercase.
<pre><code class="language-hascal">struct FooAndBar {
var x = 0
}
enum Colors{
red,
blue,
green
}</code></pre>
</p>
<p>
The names of constants should be CAPITALCASED.
<pre><code class="language-hascal">const PI : float = 3.14</code></pre>
</p>
<p>
If a name would conflict with a keyword, and it is desirable to use the keyword rather than pick a different name, a single underscore ‘_’ should be appended to it. Names should not be capitalized differently in order to avoid conflicting with keywords.
<pre><code class="language-hascal">enum Types{
string_,
int_,
float_
}</code></pre>
</p>
<br>
<a href="#Variable_Declaration">
<h2>
Variable Declaration
</h2>
</a>
<p>
Always assign a value to variables when you declare they and <b>decrease using nullable variable in your program</b>.
<pre><code class="language-hascal">var localVar : int = 12 // good
var localVar2 : int? // bad
localVar2 = 12
</code></pre>
</p>
<br/>
<a href="#Imports">
<h2>
Imports
</h2>
</a>
<ul>
<li>Local imports should be preferred over global imports.</li>
<li>Imports should be sorted lexicographically.</li>
</ul>
<br/>
<p>
We are not necessarily recommending that all code follow these rules but sent PRs to Hascal standard library should should use these rules.
<br/>
Do you have a suggestion to improve these rules or an idea for new rules? <a href="https://github.com/hascal/hascal/issues/new/">open an issue on Hascal's github repository.</a>
</p>
</div>
</div>
<hr>
</div>
</main>
<iframe src="./components/footer.html" frameborder="0" id="footer-section"></iframe>
<script src="./js/global.js"></script>
</body>
</html>