Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. Rust
  2. - `cargo update` will update to newer patch levels but not minor or major versions
  3. - Statically determined constants that can't be set to a function return value
  4. - `let mut` defines a mutable variable
  5. - Shadowing with `let` keyword (useful for initial transformations to a later immutable, only way to change type)
  6. - Integer overflow causes panic in debug mode only
  7. - i32 default numerical type
  8. - Optional underscores in numeric literals, e.g. `100_000` == `100000`
  9. - Number literals allow a type suffix (except byte)
  10. - 0x (hex)
  11. - 0o (octal)
  12. - 0b (binary)
  13. - b'A' (byte, u8 only)
  14. - Scalar types
  15. - Integer: i/u 8, 16, 32, 64, 128, size (32 or 64 depending on CPU architecture)
  16. - Floating-point: f32, f64 (default)
  17. - bool
  18. - char, a four-byte Unicode Scalar Value!
  19. - Compound types
  20. - Tuple
  21. - Optional types declaration
  22. - Destructing
  23. - Element access with dot operator and index
  24. - Supports assignment
  25. - Array
  26. - let a: [i32; 5] = [1, 2, 3, 4, 5]
  27. - let a = [3; 5] sets all 5 elements to 3
  28. - Enforced bounds checks at runtime (no conpilation errors)
  29. - Define functions with `fn`
  30. - Statements do NOT return values
  31. - Blocks can have implicit return values if they end with an expression (no semicolon)
  32. - `if` is itself an expression
  33. - No parenthesis
  34. - Conditions must be strictly bool
  35. - Possible return types must all match
  36. - String::from("string literal
  37. - println! requires string literals
  38. - Ownership
  39. - Compile time memory management
  40. - Every value has exactly one owner variable and is dropped when the owner goes out of scope
  41. - Assignment doesn't deep copy, it moves (shallow copy followed by reference invalidation)
  42. - Inexpensive because shallow copy
  43. - Reference invalidation prevents double free
  44. - Stack-only types have the `Copy` trait and don't undergo reference invalidation
  45.  
  46. C++:
  47. - Macros (name ends with !)
  48. - Static methods (called associated functions)
  49. - Static type system with type inference
  50. - stdlib vector
  51. - Inline/block comment syntax
  52. - `drop` is similar to RAII
  53.  
  54. FP:
  55. - Variables immutable by default (safety and concurrency benefit)
  56. - `let` for variable assignment
  57. - Functions are expressions (as long as there's no ending semicolon)
  58.  
  59. Lisp
  60. - void represented by empty tuple
  61.  
  62. npm
  63. - cargo
  64. - `cargo update` updates `Cargo.lock` based on `Cargo.toml` (like `package.json` and `package-lock.json`)
  65. - Semantic versioning
  66.  
  67. PHP
  68. - Functions can be called before definition
  69.  
  70. Python
  71. - Destructuring tuples
  72. - Tuples with non-homogenous type
  73. - Snake case for functions and variables
  74. - Return type decvlared with ->
  75. - Ternary using if/else syntax as an expression
  76. - For loop as a for-in that is optimized for traversing an iterable
  77.  
  78. R
  79. - Match keyword runs different code blocks based on the return value of a function
  80. - Optional implicit returns
  81.  
  82. Sprak
  83. - Infinite loop with `loop` keyword
  84.  
  85. TypeScript:
  86. - Type hinting with colon after symbol name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement