Open crgimenes opened 7 years ago
A **
operator for exponentiation would be nice.
I think you could use the switch
as pattern matching.
switch
: The word match
makes more sense in functional language
IMHO, it's better than || && !
Logical and: (and true true)
Logical or: (or true true)
Logical not: (not true)
I prefer operators ||,! and &&... it has more "operator like" for me :D but maybe I'm just used to it.
So ugly 😬. these operators is cool to languages with no have boolean value or system language, haha
(! true)
(&& true false)
(|| false true)
(&& (! true) true)
The beauty is in the eyes of the beholder... (a D&D Beholder)
Generally functional language use logical operators: and
Example:
I like a Scala approach that uses as we did
Assignment Operators
Operator | Description | Example |
---|---|---|
+= |
Add AND assignment operator, It adds right operand to the left operand and assign the result to left operand | (+= C A) A is equivalent to C = C + A |
-= |
Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operand | (-= C A) is equivalent to C = C - A |
*= |
Multiply AND assignment operator, It multiplies right operand with the left operand and assign the result to left operand | (*= C A) is equivalent to C = C * A |
/= |
Divide AND assignment operator, It divides left operand with the right operand and assign the result to left operand | (/= C A) is equivalent to C = C / A |
%= |
Modulus AND assignment operator, It takes modulus using two operands and assign the result to left operand | (%= C A) is equivalent to C = C % A |
<<= |
Left shift AND assignment operator | (<<= C 2) is same as C = C << 2 |
>>= |
Right shift AND assignment operator | (>>= C 2) is same as C = C >> 2 |
&= |
Bitwise AND assignment operator | (&= C 2) is same as C = C & 2 |
^= |
bitwise exclusive OR and assignment operator | (^= C 2) is same as C = C ^ 2 |
\|= |
bitwise inclusive OR and assignment operator | (\|= C 2) is same as C = C | 2 |
include
: load file .rum
this file point
test1.rum
(print "print test1")
main.rum
(package "main"
(print "start")
(include "test1.rum")
(print "end"))
output:
start
print test1
end
include
differs from import
, import
as object where it is possible to use as Object: ex (import test2) (print test2.Function)
Multi include (include "test1.rum" "test2.rum")
include like this?
yeah @marioidival
These are some ideas of, keywords and operators for the first beta of the language. Some of keywords we have not even defined the syntax. Please comment, suggests modifications, and if you're feeling inspired, implement :D
Operators: https://github.com/rumlang/rum/wiki/Operators Keyworkds: https://github.com/rumlang/rum/wiki/Keywords
All discussion should be made in this issue and updated on the wiki page