changed the syntax for clarity - attribute list to use a tuple, class variable list to use a normal parenthesized list

This commit is contained in:
2025-09-15 01:41:43 +09:00
parent ef293d35d4
commit 37b652ead6
10 changed files with 140 additions and 148 deletions

View File

@ -13,7 +13,7 @@ fun Number: ~= (oprnd) { return (~= self oprnd) }
set t (
class {
var x
fun(#ci) make() { x := 1234; return self; };
fun[#ci] make() { x := 1234; return self; };
fun get-x() { return x };
}
);
@ -43,7 +43,7 @@ else { printf "OK: value is %d\n" v };
class X0 {
var a b c d
fun(#ci) new() {
fun[#ci] new() {
return self;
}
@ -72,7 +72,7 @@ else { printf "OK: value is %d\n" v }
class X1 {
var a b c
fun(#classinst) new () {
fun[#classinst] new () {
self.a := 20
return self
}
@ -115,11 +115,11 @@ class F {
class X2 {
var a b c
fun(#classinst) new () {
fun[#classinst] new () {
| j |
self.a := 20
j := (self.a * 2)
fun(#class) F:get_x() { return (j * j) }
fun[#class] F:get_x() { return (j * j) }
return self
}
}
@ -131,7 +131,7 @@ else { printf "OK: value is %d\n" v }
## --------------------------------------------------------------
class X3 {
fun(#ci) new (a b) {
fun[#ci] new (a b) {
fun X3:sum() { return (fun(j) { return (j + (a + b)) }) }
return self;
}
@ -143,15 +143,15 @@ else { printf "OK: value is %d\n" v }
## --------------------------------------------------------------
class X4 {
fun(#class) t() {
fun[#class] t() {
| X5 |
class X5 { ## this X5 isn't the local variable X4
fun(#class) t() {
fun[#class] t() {
X6 := (class {
fun(#class) t() {
fun[#class] t() {
| X7 |
X7 := (class { ## this X4 is the local variable X4
fun(#class) t() { return 60 }
fun[#class] t() { return 60 }
})
return 40
}
@ -186,7 +186,7 @@ else { printf "OK: value is %d\n" v }
## --------------------------------------------------------------
class X10 {
var x
fun(#ci) make() { x := 1234; return self; };
fun[#ci] make() { x := 1234; return self; };
fun get-x() { return x };
}