s
-.kt
n
Copy code
when(it) {
  "", "-h", "--help" -> printHelp()
}
would be a start
s
oh ok
k
I would extract the when portion into another function like
processOption(option: String)
Copy code
fun main(a: Array<String>) {
    if (a.isEmpty()) processSTDIN()
    else a.forEach {
       processOption(it)
   }
}
s
wouldnt that be redundant?
k
I like modularizing my code to make it more concise and more easily testable
s
oki
well i only need it for
main()
so... : P
plus it isnt like it is meant to be a full library version of a program like
git("--clone $URL")
or something, so i dont see a need to modulize its argument parsing nor add it to the library itself
but i love modularizing ^-^
n
How would you do the
a.size == 1
check in that case?
👍 1
s
one day i want to make a modularized VM lol
eg, where you can actually construct your own VM or create one from hardware presets
just like you would in the real world lol
that would be epic asf
but current VM's dont support this ;-; as they only focus on emulating a particular architecture
or the lack of flexibility of hardware the VM is based on, thus if you want to support a new or existing architecture the entire VM will need to be re-written to target that architecture
its just all super complicated and not user friendly lol
eg, id like it to be something like
Copy code
vm(
    cpu = cpu(
        architecture = "x86",
        model = "generic",
        cores = 4
    ),
    gpu = gpu(
        model = "generic",
        memory = 512,
        size = "MB"
    ),
    ram = ram(
        memory = "1"
        size = "GB"
    ),
    components(
        keyboard = generic,
        screen = generic,
        mouse = none
    )
).run(kernel)
👍 1
unfortunately the problem with that is hardware documentation vs ISA size
as ARM alone has about 700 instructions in its ISA
intel x86 about 1.2k i think
but its far from complete
k
That's awesome, keep working at it!!
s
i gave up on that lol
mainly due to lack of hardware documentation for the AMIGA systems required for emulation
that my chosen CPU runs on
(the CPU has roughly 100 to 102 instructions, and is capable of running the linux kernel with full memory managment (MMU) support)
in which a Memory Managment Unit is REQUIRED by linux in order to support running multiple programs, otherwise only one process can run at a time, including the kernel itself
anyway, its abandoned due to the extreme lack of documentation for the AMIGA hardware required for the VM to emulate the hardware that the cpu is compatible with
for example, did you know that almost EVERY hardware that at least has a CPU and RAM requires a memory map (as in what regions of RAM are dedicated to X component/hardware/software/whatever)