enhanced the MLIST syntax - '(obj:message arg1 arg2)'
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
32
lang.txt
32
lang.txt
@ -8,7 +8,7 @@
|
||||
for static cleases, super.var-name can be allowed.
|
||||
for dyna-clases, the super prefix is now allowed for varibles. it's allowed for method calls only.
|
||||
double-check symbol and dsymbol resolution in set, set-r, defun, defclass to decide how to make it more logical and reasonable
|
||||
change syntax for MLIST -> currently (: receiver method arguments...) -> can change this to (receiver:method arguments...) or use . or -> instead?
|
||||
|
||||
implement module -> ::, ., or what notation?
|
||||
implement namespace -> ::, ., or what notation?
|
||||
review the . notation used for C-module loading... may have to change it
|
||||
@ -18,7 +18,7 @@
|
||||
u"..." or U"..." for an explicit unicode string constant notation?
|
||||
|
||||
make basic branded types to an object if possible.
|
||||
for example (: #[10 20] at 1)
|
||||
for example (#[10 20]:at 1)
|
||||
|
||||
|
||||
## dictionary list (DIC)
|
||||
@ -73,7 +73,7 @@
|
||||
; instance method. a method name must not collide with instance variable names and class variable names.
|
||||
; the name can be the same as method names of parent classes.
|
||||
(defun K (a b)
|
||||
(:self Y a)
|
||||
(self:Y a)
|
||||
(return (+ a b x y))
|
||||
)
|
||||
|
||||
@ -90,20 +90,20 @@
|
||||
)
|
||||
|
||||
(set r (object-new X))
|
||||
(:r Y 10)
|
||||
(printf ">>%d\n" (:X KK 77 99))
|
||||
(r:Y 10)
|
||||
(printf ">>%d\n" (X:KK 77 99))
|
||||
|
||||
|
||||
## method invocation
|
||||
|
||||
send the message aaa to the receiver
|
||||
(:self aaa)
|
||||
(self:aaa)
|
||||
|
||||
send the message aaa to the receiver but let it resolve the method in the superclass side.
|
||||
(:super aaa)
|
||||
(super:aaa)
|
||||
|
||||
send the message dump to the object pointed to by x with arguments 1, 2, 3.
|
||||
(:x dump 1 2 3)
|
||||
(x:dump 1 2 3)
|
||||
|
||||
## method types
|
||||
|
||||
@ -125,7 +125,7 @@ send the message dump to the object pointed to by x with arguments 1, 2, 3.
|
||||
(defclass X ::: P
|
||||
| x y |
|
||||
(defun ::* new (a b)
|
||||
(:super new)
|
||||
(super:new)
|
||||
x = a
|
||||
y = b
|
||||
(return self)
|
||||
@ -134,10 +134,10 @@ send the message dump to the object pointed to by x with arguments 1, 2, 3.
|
||||
(defun get-yy() y)
|
||||
)
|
||||
|
||||
(set t (:X new 10 20)) ;t is an instance of X
|
||||
(printf "%d %d %d %d\n" (:t get-x) (:t get-y) (:t get-xx) (:t get-yy)) ; must print 1 1 10 20
|
||||
(:t new 100 300) ;the x, y in the X part get reset to 100 and 300. doesn't create a new instance
|
||||
(printf "%d %d %d %d\n" (:t get-x) (:t get-y) (:t get-xx) (:t get-yy)) ; must print 1 1 100 300
|
||||
(set t (X:new 10 20)) ;t is an instance of X
|
||||
(printf "%d %d %d %d\n" (t:get-x) (t:get-y) (t:get-xx) (t:get-yy)) ; must print 1 1 10 20
|
||||
(t:new 100 300) ;the x, y in the X part get reset to 100 and 300. doesn't create a new instance
|
||||
(printf "%d %d %d %d\n" (t:get-x) (t:get-y) (t:get-xx) (t:get-yy)) ; must print 1 1 100 300
|
||||
|
||||
- instance method
|
||||
|
||||
@ -154,8 +154,8 @@ send the message dump to the object pointed to by x with arguments 1, 2, 3.
|
||||
|
||||
(set x (object-new X))
|
||||
|
||||
(:x (get-name-1) 100) ; must be same as (:x t1 100)
|
||||
(:x (get-name-2) 100) ; must be same as (:x t2 100)
|
||||
(x:(get-name-1) 100) ; must be same as (x:t1 100)
|
||||
(x:(get-name-2) 100) ; must be same as (x:t2 100)
|
||||
|
||||
## Something to look into..
|
||||
|
||||
@ -164,7 +164,7 @@ normal function call
|
||||
(rcv f arg1 arg2)
|
||||
|
||||
## dynamic method invocation???
|
||||
(:X (f) arg1 arg2)
|
||||
(X:(f) arg1 arg2)
|
||||
as long as f returns a symbol, it can also invoke a method??
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user