Skip to content

Kernel for init all subsystems #1

@donutloop

Description

@donutloop

It would be more clear to have a kernel to init all subsystem then isn't necessary to call in each subsystem package a hidden register function

Prototype

Caller:

package main

func main() {
 kernel := kernel.Init()
}

Init Kernel:

package kernel

func Init() {
   k := new(kernel)
   k.RegisterSubsystem(new(subsystem.Memory))
  // soon on ...
}

Kernel:

package kernel

type Kernel struct {
    subsystems map[string]subsystem
}

func (k *kernel) RegisterSubsystem(s subsystem) {
    k.subsystems[s.Name()] = s
}

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions