holgerbrandl / kalasim

Discrete Event Simulator
https://www.kalasim.org/
MIT License
71 stars 10 forks source link

Provide a more declarative way to implement components #11

Open holgerbrandl opened 3 years ago

holgerbrandl commented 3 years ago

To create a custom component, currently, the user has to

val c = object : Component(){
    override fun process() = sequence { 
        hold(1)
    }
}

But it would be super-cool if she could just do something like

val c = object : Component(){
    hold(1)
}

However, it seems impossible to implement this feature because the underlying building would require multiple receivers (SeqeneceScope and this@Component) for functioning. This is not yet possible with kotlin, so this ticket is blocked by https://youtrack.jetbrains.com/issue/KT-10468.