gavr123456789 / Niva

Smalltalk like programming language
https://gavr123456789.github.io/niva-site
41 stars 2 forks source link

New extend syntax #304

Open gavr123456789 opened 2 weeks ago

gavr123456789 commented 2 weeks ago

current:

extend Person [
  on kek = []
]
Person [
  kek = []
] // nope, its the same as for builders, and builders for Compose needs to start from the capital letter.
gavr123456789 commented 2 weeks ago

But maybe different type of brakets?

Person {
  kek = []
}

no, kinda stange that all other bodies are in []

gavr123456789 commented 2 weeks ago

Remove single declarations?

Person kek = [] // NOT POSSIBLE
// only
extend Person [
  on kek = []
]

nah, then its always one additional layer of indentation

gavr123456789 commented 2 weeks ago

Replace on keyword with |
kinda consistent with everything else

extend Person [
  | kek = [...]
  | birthday = [
    age <- age inc
  ]
  | newName: name::String = [
    name <- name
  ]
]

Maybe then remove extend?

| Person 
| kek = [...]
| birthday = [
  age <- age inc
]
| newName: name::String = [
  name <- name
]

kinda cool