Akuli / jou

Yet another programming language
MIT License
11 stars 4 forks source link

Platform if statements inside class #497

Open Akuli opened 4 months ago

Akuli commented 4 months ago

I want to put if WINDOWS inside class to create windows specific method, useful when method only needed on one platform.

import "stdlib/io.jou"

class Foo:
    def bar(self) -> None:
        printf("bar\n")
        if WINDOWS:
            self->do_windows_thing()

    if WINDOWS:  # <---- Error :(
        def do_windows_thing(self) -> None:
            printf("lol\n")

def main() -> int:
    f = Foo{}
    f.bar()
    return 0