Open simon-curtis opened 1 year ago
I haven't started work on modules yet however there are a two approaches I've been considering:
The syntax would be something like import "./util.oxi"
and at an external level it would act as merging the two files together, somewhat like golang does.
This would need bit of time to implement for my language simply because such syntax isn't really used anywhere else but use abc::x
would look nice, there would be a need for a new Module map which would have keep track of these additional files and their exported values.
Before either of the approaches I'm adding the .
operator so that accessing exported values is possible
Have you seen how zig does it? It's quite nice. Have only seen it used on coding streams so far, not really had a chance to learn how it works properly.
I'm worried about how I'm going to implement it in my language as it seems to either be good for the developer or good for the compiler... never both 😕
I was curious as to how you're going to do modules? I've looked in a lot of places for inspiration, but cannot find any solid references