Closed Araq closed 1 year ago
"AST based overloading" -- Should be removed.
Not sure how I feel about this. Would this also imply removal of the same feature for NimNodes? I rather like that (i.e. specifying a CT proc is only for idents).
To be fair I didn't know this could be used with runtime procedures.
Find a way of allowing a syntax like of Value(let x, var y) and embrace an official pattern matching solution that makes use of this syntax.
Reminds me, default values for object fields was quite popular, is this planned as well? (just saw this higher up in the post) are any object variants improvements from many proposals going to be considered? I've also seen a lot of complaints about object construction, but I don't know which useful changes there are other than default values, if there was going to be a =init
I'm guessing it'll probably be more coherent for it to be similar to =destroy
instead of a complete override of initialization (after zeroing memory/initializing default field values).
The JSON module ... could be split up into:
Would json/builder
, json/lexer
be better (with a re-export of every submodule in a module named json
)? I remember this being discussed for other modules but vaguely something about it not working or being inconvenient. I believe it was proposed for the xml
modules and times
, but deemed problematic for os
.
Would json/builder, json/lexer be better
Yes, most people would like that better but I don't want to implement and support package.module.name
just for a refactoring so I'd go with the name prefixes.
"Void type" -- We should optimize away the "empty tuple" type in the backend and remove this feature.
So eventually, void
would be replaced by the empty tuple, so that e.g. proc test() = discard
would return ()
(like it is the case in Rust)?
So eventually, void would be replaced by the empty tuple, so that e.g. proc test() = discard would return () (like it is the case in Rust)?
No, for the return type and discard-checking there would still be a void
.
+1 for moduleGroup/module
instead of moduleGroupmodule
I don't want to implement and support package.module.name
why implementing and supporting package.module.name needed for package/module/name?
Update: Expanded the section on Nimble.
"Parallel & Spawn" -- Should be removed. Better done by external packages.
But stdlib keeps std/tasks
?,
I think a way to run multiple stuff at the same time in stdlib is useful !,
at least with a basic API, maybe think of removing Parallel and keep Spawn?
std/tasks
is a "building block", so it should stay.
+1 for
moduleGroup/module
instead ofmoduleGroupmodule
I don't want to implement and support package.module.name
why implementing and supporting package.module.name needed for package/module/name?
I believe that this is because import
only considers the last path component as the module name. The code from json/lexer import nil
allows accessing all exported routines/types in "./json/lexer.nim" through the lexer
symbol, not the expression json.lexer
.
If an expression like json.lexer
won't be supported, then the symbol "jsonLexer" may be preferable to "lexer", since "jsonLexer" is less ambiguous.
Update:
Would be nice to give the jsgen some love too!, at least improve jsgen a little, the JS stdlib improved a lot and wont produce Showstopper complex bugs, and the few JS bugs are actually jsgen related bugs actually so ... 🤔
What is policy for breaking changes in 2.0?
I see 2 extreme options:
gc:orc
is an exception.Some concrete examples I know:
[]
, []=
, delete
and different types (e.g. https://github.com/nim-lang/Nim/issues/16492). It would be great to unify it, but it's a significant breaking change of course.os.walkDir
silently ignores errors (see e.g. https://github.com/nim-lang/Nim/issues/10309 and references). It would be desirable to raise exception by default but we observed that it would break even some code inside Nim repo.docgen
don't preserve information about e.g. var
in parameter or type of optional parameter with default value (https://github.com/nim-lang/Nim/issues/12373). Fixing that would break previously made references to such anchors.We should fix as much as reasonable, but we need to have a good upgrade path. The worst thing continues to be subtle changes in runtime behavior. That means:
walkDir
and introduce something that makes sense. Can also be in a module of its own.Very cool, nice roadmap. What's the current status, what is the primary project being worked on?
The good news is that we have this tool already, it's nim check --navigate, the bad news is that its progress is tied to PR nim-lang/Nim#17814. Which is in the state "on hold" until version 1.6.2 is out.
1.6.2 is now out, but there hasn't been any updates to that PR. What's the status of it?
1.6.2 is now out, but there hasn't been any updates to that PR. What's the status of it?
I never know how to update these RFCs. 1.6.2 is out, next week work on 2.0 will begin.
There is nim-lang/threading which is official plus a couple of external packages that do it better than we could hope to. There are currently no plans to bring this into the stdlib for these reasons:
We merely offer the building blocks with destructors, atomics and std/tasks
.
Note for the checklist: guards & locks are in both experimental features to clean up and stable experimental features. Since guards were moved to the stable documentation, it can be marked under the stable experimental features section.
Some RFCs covered by the items:
A few simple non-breaking features that could be done at any time, but would be nice to have soon, probably also under 1.6 line:
There are also tons of RFCs related to default object fields and pattern matching but they tend to be larger in scope and discuss other things.
I think "optimize away empty tuple" will take a while compared to the steps for removing the other experimental features. But since it's not tied to a super well known experimental feature it should be fine if it's not 2.0.
Does the var
in of Value(let x, var y)
mean var y: T
or y: var T
? I don't think it should be the first one given for loops and proc parameters presumably don't have it for a reason. Second one is something the language could do that macros couldn't.
"Not nil annotation" -- Should be planned for Nim 2.x but removed from the "experimental" manual.
Don't understand this. Is it supposed to be kept in as experimental but undocumented?
I just got reminded, is there any chance marshal
will get removed from the stdlib for 2.0, or at least removing the VM support for it. Almost every json library made can be used at compile time without hard coded VM support, and as most know marshal is just a json serializer. https://github.com/nim-lang/Nim/blob/devel/compiler/vmgen.nim#L2057-L2065 can cause 10% slower compilation in compile time heavy code(macros included). Since every single call is done with two string searches to see if it's from marshal.
Alternative way is to support vmmarshal properly with callback if it is worth.
@beef331 wow... that should be fixed indeed. It doesn't necessarily mean we need to disable marshal on the VM though, it should simply either use its own opcodes or the existing callback mechanism.
A simple POC using callback mechanism: https://gist.github.com/xflywind/551d84567cb39d95d0ddcd71f8279e6a
Path related RFCs:
https://github.com/nim-lang/RFCs/issues/54 new path handling module that uses Nim's type system, using Path instead of string https://github.com/nim-lang/RFCs/issues/121 os module should have an "exists" function https://github.com/nim-lang/RFCs/issues/71 [compiler/pathutils] AbsoluteFile,AbsoluteDir,RelativeFile,RelativeDir is too complicated https://github.com/nim-lang/RFCs/issues/112 joinPath("foo", "/bar") should return "/bar"
Could we consider https://github.com/nim-lang/RFCs/issues/89 for nim V2?
A few options have been considered, eg the linked RFC, or deprecating naked except
s, all of them being better than the current status quo, imo
Version 2 or not, the guiding principle remains "no secret change in semantics" so we are deprecating except:
. We could make it not compile altogether for version 2 though.
In Python, naked except
is allowed, but most linters, IDEs, and tools will complain about it.
Any plans for nre/re? Removal of one or the other? Cleanup, speedup? (see https://forum.nim-lang.org/t/6008)
They should both be moved out of the stdlib, IMO.
Some tidbits from the forum thread mentioned up to this point for 2.0 breaking features ( https://forum.nim-lang.org/t/9132 ):
init/new(typedesc)
, ()
for types, changing :
to =
for object constructor fields.let a, b = 1
syntaxAlso a lot of discussion about stdlib organization and tooling/error messages, but these already seem to be a focus. Other non-breaking but commonly discussed stuff include sugar
as default import with more macros, and more concept use in stadnard library.
Suggestions for Nim v2 (thanks to @j-james)
ref https://forum.nim-lang.org/t/9132
https://gist.github.com/j-james/08cd36b7475d461d6291416381ce98ad
Whatever else happens, adding more things, specially more things that don't exist yet (such as random nice-to-haves from v2 forum threads) to 2.0 is a good way to never ship a good 2.0 - shipping orc/arc is already a massive undertaking: it fundamentally changes the way libraries / Nim code should be written (because they now need to think different about memory management, destructor ordering, performance profile, a fresh set of compiler bug workarounds etc etc).
Even enabling ORC/ARC for a simple, small codebase like the compiler itself has proven to be a major difficulty when trying to retain it's previous performance characteristics (or even keep it working without hitting bugs) - to get it across the finish line, the learnings from that ordeal need to be carried back to the standard library itself, which, as such, needs significant work if it is to not be terrible under the new memory regime, let alone to take advantage of the significant improvements and play well with them.
If anything, a line in the sand around further addtions and 100% focus on system.nim
to make that the best system possible in a post-2.0-language world would be key targets to look at, such that there emerges a small and stable core / foundation upon which further work can be done.
I would like to re-consider ideas proposed before this Nim 2.0 trend, like:
Slightly related to arne's point. In my quest to make code more reusable I did attempt to make parseutils use openarray[char]
but it's showed a few issues with openarray/string/cstring that will need to get resolved. Presently due to implicit conversion from string to cstring the following does not work.
proc doThing(oa: openarray[char]) = discard
proc doThing(str: cstring) = discard
doThing("hello")
Similarly the following perhaps should work. Where openArray[char]
is considered equivalent to string
in the case of converters.
type NotString = distinct string
converter toString(s: NotString): string = string(s)
proc doThing(oa: openarray[char]) = discard
doThing(NotString("hello"))
The Nim 2.0 can also be a good opportunity to make a decision about Nimble packages clean out, packages that do not exist anymore and give 404 errors, but they are still in the packages list, theres multiple issues open and closed in the repo about the problem, and removing the packages from the JSON looks like it is not allowed (?), but it is useless because the repo do not exist anymore, and sometimes the user also do not exist anymore or is not coding anymore since years ago.
"Parallel & Spawn" -- Should be removed. Better done by external packages
What about bootstrapping build systems/package managers that use threads? Will they need to supply their own implementation of threadpool?
No, package managers and bulid systems can use Nimble packages as dependencies if they do the "git clone" commands directly in the build script and/or can use git submodules. A package manager is not like a compiler, it doesn't have to "bootstrap" itself.
This is not possible in network-sandboxed environments, and support for them matters.
The sandbox would prevent nimble install nimble
just as it would prevent git clone depsThatNimbleRequires
.
I've successfully packaged lots of Nim libraries and programs for Gentoo, which package manager is network-sandboxed (this is the standard in *nix packaging). Neither git nor nimble are needed for it.
Seems like this discussion is off-topic and should be over.
Fine with me, you started the subdiscussion.
I like nim, but cross-compiling is inconvenient. I wish I could cross-compile directly like Golang or ziglang, which would attract more users
Just use a CI, cross-compilation won't let you run any tests anyway... I wish we would attract more users who understand software development.
Ok, I spent some time cross-compiling using CI:
- name: build-x86
image: dockcross/linux-x86
commands:
- nimble build --passL:-static -o:out-linux-x86 -d:release
- name: build-x86-64
image: dockcross/linux-x64
commands:
- nimble build --passL:-static -o:out-linux-amd64 -d:release
- name: build-linux-arm64
image: dockcross/linux-arm64
commands:
- nimble build --cc:env --os:linux --cpu:arm64 -o:out-linux-arm64 -d:release
- name: build-android-arm64
image: ghcr.io/tomasky/drones/arm64:nim
commands:
- nimble build --cc:env --os:android --cpu:arm64 -o:out-android-arm64 -d:release
Postponed:
--experimental:typeBoundProcs
. https://github.com/nim-lang/Nim/pull/20520Postponed:
I'm closing this since version 2.0 is effectively done, we'll only fix even more ORC bugs and release 2.0 in early 2023. The plan for 2023 will be published as an RFC here in the next couple of days.
I like nim, but cross-compiling is inconvenient. I wish I could cross-compile directly like Golang or ziglang, which would attract more users
https://github.com/enthus1ast/zigcc
Just use the Zig compiler 😉
It seems to come up regularly that people don't know where Nim is heading, where our focus of development is and what's the PLAN. I'm sorry for not communicating it well but the plan is solid, doesn't change much and it "only" takes longer than I hoped it would take.
Incremental compilation (IC) / nimsuggest / IDE tooling
This is a single point as for me it's a single thing. If we had a compiler that only recompiles the module that was touched the "nimsuggest" tool can be a simple command line tool that answers a single question like "where is symbol X used?".
The good news is that we have this tool already, it's
nim check --navigate
, the bad news is that its progress is tied to PR https://github.com/nim-lang/Nim/pull/17814. Which is in the state "on hold" until version 1.6.2 is out.IC is the most important thing for me personally. It's not scheduled for any particular release as it's not about the language nor about its library. Ideally IC will stabilize and be backported to the 1.6.x line.
Update: Good IC relies on refactorings of the compilation pipeline. We want to finish these refactorings, release version 2.0 and then finish IC in version 2.x.
Version 1.6.2
Version 2.0
Hard goals
For version 2.0 we will make
--gc:orc
,mimalloc
and--threads:on
the new defaults.--gc:orc
https://github.com/nim-lang/Nim/pull/20467 https://github.com/nim-lang/Nim/pull/19972--threads:on
https://github.com/nim-lang/Nim/pull/19368mimalloc
https://github.com/nim-lang/Nim/pull/20359Furthermore, we consider the following experimental features to be stable enough for version 2.0:
--experimental:strictEffects
https://github.com/nim-lang/Nim/pull/19380--experimental:unicodeOperators
https://github.com/nim-lang/Nim/pull/20444--experimental:overloadableEnums
https://github.com/nim-lang/Nim/pull/20298-d:nimPreviewFloatRoundtrip
https://github.com/nim-lang/Nim/pull/20195-d:nimPreviewDotLikeOps
https://github.com/nim-lang/Nim/pull/19598Stretch goals
Language
[x] Enforce "Definite assignment analysis" for all types, this is easy to do, removes an error-prone aspect of the language, makes the language more consistent and mitigates the problem with
nil
pointers. https://github.com/nim-lang/RFCs/issues/378. https://github.com/nim-lang/Nim/pull/20506[x] Deprecate 'unsafeAddr' and make 'addr' available for all addressable locations, see https://github.com/nim-lang/RFCs/issues/369 https://github.com/nim-lang/Nim/pull/19373
[x] Support
field = defaultValue
inside object declarations. https://github.com/nim-lang/RFCs/issues/252 https://github.com/nim-lang/Nim/pull/20480Cleanup of experimental language features
Stable experimental language features
These features are stable and should be part of the manual.
Library
Clean up the system module, move these submodules into their own modules:
Clean up the OS module, make it more type safe, split it in up in e.g.:
The JSON module is also in a poor shape, the API exposes public fields, sometimes is not intuitive (the
%*
operator) and has poor performance. It could be split up into:More of the standard library should be moved to external Nimble packages. How far we get with this is unclear.
Misc (in comments)
Version 2.x
Every stretch goal of 2.0 that didn't make it into version 2.0, should be considered a goal for version 2.x.
Hard goals
We should remove the requirement for forward declarations and allow for recursive module dependencies. Then we can remove these experimental features:
see also https://github.com/nim-lang/Nim/pull/18818
Stretch goals
static
values and stabilize the feature.of Value(let x, var y)
and embrace an official pattern matching solution that makes use of this syntax.Nimble
We hope to be able to ship a new Nimble with the 2.0 release but we are happy to ship it whenever it's ready. See https://github.com/nim-lang/RFCs/issues/398 for good ideas of how to further evolve Nimble. The most important missing feature of Nimble is "lock files" -- Nimble implements it, but not in a way that is compatible with the 1.6.0 Nim compiler.
How can you help?
The standard library cleanups should be rather easy to do.