-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Way to split code into multiple files #40
Comments
Yes, we definitely want an import system. I think I'll just follow Haskell here, starting with an unqualified
That's a good place to start for now, but I think we'd ideally have a dedicated serialization format (or two) rather than actually executing Dex code containing mostly literals. You'd still load it as if you were importing a module, but our implementation would just need to parse it and put the data in memory, rather than compile and execute it. I'm imagining two formats: textual and binary. The textual one might be a subset of Dex syntax (like JSON is a subset of javascript). The binary one could be close to Dex's internal runtime data structures, so that it could just be memmapped. |
Some time this week, I intend to write a few slides explaining that seperating files from namespaces, and
The short is: I think should have an I think a binary formay would be good. |
Implementing This still isn't a good way to load data, since compiling huge literals will be very slow (several LLVM instructions per scalar). I'll keep this issue open until we have a dedicated text or binary serialization solution. |
A change also needs to be made to WebOutput.hs, |
This means we can efficiently(ish) load "dex object" files and write them to memory directly rather than compiling them as huge LLVM literals (see #40). It's still not very fast: loading a length-100k vector of integers takes 4 seconds. It doesn't hit LLVM, but it still uses the general program parser and type inference. We can probably make it faster with literal-specific ones.
Seems fun. |
I think |
Per brief discussion at NeurIPS.
Sometime Input is not really IO,
In that it is deterministic, e.g. the loading of data.
So just code in another format, in another file.
This kind of input is thus actually more closely linked to metaprogramming than normal IO.
But right now, we can't actually load code in the Dex language, from another file. AFAIK.
I propose the additional of
:include file/path.dx
as a command allowed to occur at top level.
Then I will do some metaprogramming in some other language (obs. Julia), in order to generate some Dex code that contains my data.
Which I will
:include
at the top of my script.I don't want to put it directly in my script as it's probably going to be thousands of lines long.
Also I might want to regenerate it.
A possible generalisation of this would be
includeby::(String->AST)->Path->Nothing
Which would take in a function to do the metaprogramming.
But I don't think we are anywhere near there yet?
The text was updated successfully, but these errors were encountered: