Hi Guys,
How are you? How is my favourite programming language? Congrats for the 0.14.2 release! I really hope that Nim will take off and will have the popularity it truely deserves!
I haven't followed the recent development of Nim, so I came here to ask for a quick update, if you don't mind. I brought a list of questions with myself (as usual if you remember me from before).
Feel free to say bad things about these questions (e.g., "we will never support this", or "%#@!@#??!").
By the way, I have a new job, and even less time, but I really would like to work on Nim again once I can free up some time.
Q1: Is there any improvement of channels? Is is possible to listen to multiple channels at the same time from one thread?
Q2: Is it possible to share data with channels without having the channel in global memory? In other words, can I spin off a thread, create a channel on-the-fly, and use it to communicate with the newly created thread?
Q3: Is there any update on the compiler front? Are strings still copied when passed to a function inside a tuple: f((a: myString))?
Q4: Is there a progress in the escape analysis? If yes, is it helping closures not to copy all the references (can the closure iterator decide whether the referenced object is on the heap or stack)? Are the closure references read-only?
Q5: Any update on sequtils? Any new map/filter/reduce magic? New container types? An iterator library?
Q6: Any changes about the iterators? Are inline and closure iterators got any closer to each other? I remember I had to check both type(a()) and type(a.iter()) to be sure (however, don't ask for more details, it was a long time ago).
Q7: Is there any way to make a read-only promise on refs in a function declaration? My motivation for this is the compiler itself: it uses pointers of the nodes (which is fast), but it is hard to tell which of the parameters will be modified by the given function.
Q8: Are destructors working? I understand that any random data may look like a pointer, therefore we cannot garantee to call every destructors. (I'm happy to talk about the motivation if interested.)
Q9: Any tune possiblities to the GC? Last time I checked the GC gave back memory to OS if it had 1 MB free.
Q10: Any new helper functions to write macros? E.g., create a proc with the given parameters and the given generics (wihout the fear that AST's structure will change in the future).
Q11: Is there an immutable string? I remember a long discussion, and maybe the result was that both immutable and mutable can be extremely useful (e.g., there is no need to copy an immutable string when used as a key in a dictionary).
Q12: Is "concept" in a better shape when they are used with templates? Can I create a Map[T,S] concept (like in Java), with multiple different implementation (like HashMap, TreeMap)?
I'll try to free up some time, and come back. However, it is clear that I won't have time for this in the next 3 weeks.
@v3ss0n Should I create issues on github? (Sorry, I didn't get the checkbox reference.) Some of these are already there, and some of these are not issues, but feature requests. It would take some time to track all of these. I can promise that I won't forget this list and keep bringing it up :)
Speaking about the topics, here is what I would do first. Q7 (adding "const" to refs) seems hard, so I would just take some files in the compiler and rename the variables of functions, e.g., n: PNode to n_const: PNode if I'm sure that n will not be modified in the function. This would make my life much easier. Then fixing Q12 (fixing concept) looks like a good task for me, and I really hope that others would start writing good concepst (all kind of containers with the same API, general database API where the server can be "list your favorite databases here", etc.).
Also fixing the destructor Q8 can have a big impact, because it can introduce smart pointers, which could help in sharing data between threads, or have a special list type, which looks mutable but a copying it wouldn't copy the elements unless it is necessary (R does that with data.tables).
My other dream is to write an AST->code converter. It looks like a task which is easy to test: we have lot of nim code, all I have to do is check "AST_generated_from(test.nim) == AST_generated_from(myCodeGenerator(AST_generated_from(test.nim))" is true or false. I understand that it is not possible in 100%, but I would like to try this, because it would make macro expansion live :)
The iterator/closure reference/promise not to change a pointer/immutable string look like the same to me. We need some extra smart logic in the compiler to track the variables (their life and place in memory). Definitely not an easy task.
Peter
GitHub Check Box is an Issue with Markdown in this form. If if others have write access to that issue they even can "check" by clicking on it.
To Do List:
* [x] Feature A
* [ ] Feature B
* [x] Feature C
* [ ] Feature D
See this Gist...