~repos /plum

#treesitter#compiler#wasm

git clone https://pyrossh.dev/repos/plum.git

A statically typed, imperative programming language inspired by rust, python


4786888a pyrossh

1 year ago
add naming convention
Files changed (1) hide show
  1. readme.md +33 -0
readme.md CHANGED
@@ -280,6 +280,22 @@ assoc_list[:a]
280
280
  assoc_list["b"]
281
281
  ```
282
282
 
283
+ **Assignment Operators**
284
+
285
+ ```go
286
+ x := 5
287
+ y := 3
288
+ x += y // 8
289
+ x -= y // 5
290
+ x *= y // 15
291
+ x /= y // 5
292
+ x %= y // 2
293
+ x &= y // 2
294
+ x |= y // 3
295
+ x <<= y // 24
296
+ x >>= y // 3
297
+ ```
298
+
283
299
  **While statement**
284
300
 
285
301
  ```rb
@@ -441,6 +457,7 @@ fn add(items ...str) =
441
457
  ```
442
458
 
443
459
  **generics**
460
+
444
461
  ```
445
462
  fn add[T: int | float](a: List[T], b: List[T]): List[T] =
446
463
  pass
@@ -456,3 +473,19 @@ fn create_post_action(req: Request): Response =
456
473
  setSuccessMessage("Post created")
457
474
  redirectTo("/posts")
458
475
  ```
476
+
477
+ ### General naming convention
478
+
479
+ | Item | Convention |
480
+ | ----------------------- | ------------------------ |
481
+ | Modules | snake_case |
482
+ | Types | UpperCamelCase |
483
+ | Traits | UpperCamelCase |
484
+ | Enum variants | UpperCamelCase |
485
+ | Functions | snake_case |
486
+ | Methods | snake_case |
487
+ | General constructors | new or with_more_details |
488
+ | Conversion constructors | from_some_other_type |
489
+ | Local variables | snake_case |
490
+ | Constants | SCREAMING_SNAKE_CASE |
491
+ | Generics | single uppercase letter |