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

Super-issue: Rethink / re-design "object-system" #605

Open
1 of 10 tasks
marzipankaiser opened this issue Sep 24, 2024 · 3 comments
Open
1 of 10 tasks

Super-issue: Rethink / re-design "object-system" #605

marzipankaiser opened this issue Sep 24, 2024 · 3 comments
Labels
epic Super-issue for a whole class of features requires-design

Comments

@marzipankaiser
Copy link
Contributor

marzipankaiser commented Sep 24, 2024

In general, we need to rethink / redesign the "object-system" anyways. Some aspects are:

See also

@marzipankaiser marzipankaiser changed the title Rethink / re-design "object-system" Super-issue: Rethink / re-design "object-system" Sep 24, 2024
@marzipankaiser
Copy link
Contributor Author

(Of course, feel free to add/edit/make sub-issues etc)

@b-studios
Copy link
Collaborator

b-studios commented Sep 24, 2024

I'd like to be able to allocate an object into a region (if it has mutable state).

new Foo(x, y) in {r}

or maybe

interface Foo {
  def op(): Unit
}

class Bar {r: Region} implement Foo {
  var field in r = 4

  def op() = { 
    r = r + 1; 
    this.helper() // it should be possible to invoke methods on the same object
  }

  // NOT part of the interface
  def helper() = println(r)
}

new Bar {global}

@jiribenes jiribenes added the epic Super-issue for a whole class of features label Sep 24, 2024
@jiribenes
Copy link
Contributor

jiribenes commented Oct 31, 2024

I'd like to be able to allocate an object into a region (if it has mutable state).

Would it also make sense to allocate a capability into a region? 🤔
(so that the return type is Counter at {r})

def makeCounter {r: Region} = {
  var count in r = 0
  try {
    println(c.get())
    c.increment()
    c.increment()
    println(c.get())
  
    c
  } with c: Counter in r {
//                  ~~~^
    def get() = resume(count)
    def increment() = { count = count + 1; resume(()) }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic Super-issue for a whole class of features requires-design
Projects
None yet
Development

No branches or pull requests

3 participants