Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust-like structs(without types) with implementations in tr-lang and Basic Enums #31

Open
kaiserthe13th opened this issue Feb 6, 2022 · 0 comments
Labels
enhancement | yükseltme New feature or request | Yeni özellik veya istek help wanted | yardım isteniyor Extra attention is needed | Ekstra dikkat gerekli todo | yapılacaklar something we are to do | yapacağımız bir şey

Comments

@kaiserthe13th
Copy link
Owner

A proposal to add Rust-like structs(without types) to the language. As in Turkish struct means yapı, which also means building. It may be a confusing name. Thus after some consideration I renamed them to şekil (shape). Enums have been directly translated into sayım. And here is the syntax proposal. methods are metot or yöntem and new is yeni

# A struct
şekil Human
  name
  age
  gender
son
# An enumeration
sayım Gender
  male female # at runtime assigned to 0 and 1
  # or instead of at runtime we turn it into this
  # blok Gender
  #   0 -> male
  #   1 -> female
  # son
  # thus enums can also be compared with numbers
son
# With this syntax you can only implement things in scope
metot is-male >> Human # methods have self thrown into them as a value when executed
  :gender = Gender:male ver
son
# Creating a member function that doesn't take self
bağlı işlev new-human >> Human -> gender -> age -> name
  yeni Human # initializer keyword: yeni
    name age gender
  son ver
son
@kaiserthe13th kaiserthe13th added enhancement | yükseltme New feature or request | Yeni özellik veya istek help wanted | yardım isteniyor Extra attention is needed | Ekstra dikkat gerekli todo | yapılacaklar something we are to do | yapacağımız bir şey labels Feb 6, 2022
@kaiserthe13th kaiserthe13th added this to Todo in kaiserthe13th/tr-lang via automation Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement | yükseltme New feature or request | Yeni özellik veya istek help wanted | yardım isteniyor Extra attention is needed | Ekstra dikkat gerekli todo | yapılacaklar something we are to do | yapacağımız bir şey
Development

No branches or pull requests

1 participant