Skip to content

Instantly share code, notes, and snippets.

@omentic
Last active December 10, 2023 22:26
Show Gist options
  • Save omentic/08cd36b7475d461d6291416381ce98ad to your computer and use it in GitHub Desktop.
Save omentic/08cd36b7475d461d6291416381ce98ad to your computer and use it in GitHub Desktop.
Compilation of suggestions from the Nim v2 thread

Suggestions for Nim v2

Note: this document is a collection of all proposals from the Nim v2 ideas thread. As such, it is/was not by any means reflective of intentions for 2.0: though I've updated this with accepted and implemented proposals.

Breaking changes

Features

  • kobi, exelotl, didlybom, solomonthewise, pdkoekfr, snej, apropos: Adopt Options module and make types not nil by default (discussion)
  • Zoom, apropos: Overhaul stdlib to work with view types and/or options/results for error handling
  • ElegantBeef, elcritch, apropos: Increase code reuse with concepts, openarrays, and distincts (details)
  • Zoom: Make slices return openarrays
  • kobi: Pick an interface library and stick with it so error messages are clear
  • exelotl: Destructors for files (RFC#316)
  • Sixte: Introduce visibility rules for types
  • [planned] jblin, apropos: Replace object variants with Rust/Haxe style algebraic data types (details, discussion: RFC#525, RFC#527)

Removals

  • Yardanico, exelotl, didlybom, JPLRouge, ingo: Remove backwards-compatible switches / deprecated features
  • sekao, didlybom, r3c, junelac, SunnyCorleone: Get rid of style insensitivity (discussion: RFC#456)
  • Clonk: Remove style insensitivity in keywords and module names
  • didlybom, cmc: Remove less used experimental features
  • [somewhat implemented] didlybom: Remove every memory option except orc, arc, none, go (related: RFC#177)
  • didlybom: Remove overlapping language features
  • ingo, stisa: Shrink stdlib (by creating "batteries" libraries?)
  • gcao: Move JavaScript (exists), WASM (doesn't exist) support to libraries (LLVM support is currently a library)
  • apropos, Derick: Remove %* JSON operator
  • cmc: Change pragma syntax to be easier on the eyes and the fingertips

Syntax

  • exelotl, didlybom, r3c, TiffanyR, apropos, elcritch: Comprehensive stdlib cleanup
  • markus_gritsch, TiffanyR: newSeq() and newString() ==> initSeq() and initString()
  • xigoi, namisboss: Change object initialization syntax to use = instead of : for consistency
  • xigoi: Allow using newlines instead of commas
  • xigoi: Make built-in types capitalized
  • [planned, iirc] xigoi: Require std/ for importing standard library modules
  • volodymyr: Consistent stdlib module naming (ex: plural vs. singular)
  • elcritch: Default enum scoped names
  • TiffanyR: Replace all usages of / with . (except for division)
  • apropos, Derick, Sixte: Replace * with pub as the public marker
  • planetis: Do over for loop syntax (details)

Potentially breaking changes

Features

  • Zoom, cumulonimbus: Get continuation-passing style (CPS) into the core (RFC#295)
  • Object construction:
  • Sixte: Introduction of existential types
  • kobi: Continue with flow sensitive typing
  • kobi, didlybom: Unify methods and procs
  • kobi: Popularize exception effects catching (raises pragma)
  • [implemented] solomonthewise: Strict funcs by default
  • volodymyr: Language support for a HashTable
  • cumulonimbus: Language features designed for parallelism
  • cumulonimbus: Do the least bad form of error handling
  • mildred: Transform the stdlib into a collection of approved Nimble packages (discussion: RFC#371)

Syntax

  • xigoi: Make object syntactic sugar for distinct tuple (RFC#321?)
  • xigoi: Make duck typing for generics opt-in
  • volodymyr: Language support for with
  • volodymyr: Language support for function piping/chaining
  • volodymyr: Support multi-position assignments without tuples
  • volodymyr: Extendible eager comprehensions (covered by sugar.collect?)
  • volodymyr: Container subsetting (R)
  • cumulonimbus: Explicit tail calls
  • hyl: Improve module/function disambiguity with UFCS

Improvements

  • Yardanico, gcao, exelotl, r3c, jasonfi, Zoom, SolitudeSF, carterza: Internal compiler refactoring
  • sky_khan: Rid compiler of globals and make it an object for being compiled as a dynamic library
  • r3c, stisa: Separate AST from codegen stage in the compiler
  • r3c: Improve stdlib performance
  • apropos: range improvements (details, discussion: RFC#172, RFC#541)

Non-breaking changes

Features

  • SFR0815, guzba, giaco, kobi, Clonk, zevv, apropos: Mutually recursive module imports and types (RFC#6)
  • Zoom, exelotl, didlybom, r3c, kobi, krakengore, cmc: Complete/polish implementations of Nim's nice features:
  • federico3, giaco, junelac, solomonthewise: Include more batteries
  • [implemented] guzba, slangmgh: Lock in --threads:on and --mm:arc/--mm:orc (planned (RFC#437): threads pr, mm pr)
  • giaco, deech, apropos: Official support for auto-generation of C wrappers (adopt Futhark) (manual wrappers still desired)
  • bather, didlybom, volodymyr: Add sugar to system (particularly -> and =>)
  • bather, didlybom, cblake: Add sugar to std/prelude and make prelude work as a regular import
  • didlybom, volodymyr, jblin: Official, robust support for pattern matching (discussion: RFC#537)
  • didlybom, solomonthewise, apropos: Official support for nimpy
  • JPLRouge, solomonthewise: Official GUI library
  • nimoid: Nested types (issue)
  • elcritch: Provide a SomeString type
  • elcritch: Module actions / triggers on import
  • gcao: Robust WASM, LLVM support
  • archnim: Data structure to hold mixed types (that isn't a JSON node)
  • SunnyCorleone: Improve Tables (see Python Dicts)
  • SunnyCorleone: GUI debugger
  • [implemented] treeform: Official support for overloadable enum names
  • pdkoekfr: Concurrency as a language primitive (details)
  • cmc: Expand type inference (try again for return types, sugar for variant types)
  • avandy: Move contract support into the stdlib

Syntax

  • markus_gritsch: Allow tabs for indentation (disallow mixing)
  • detla: "Weak imports" (don't warn unused by default, just ignore)
  • cblake: import foo {.used.}
  • nocturn9x: Allow redeclaring the same field in different object variant cases
  • xigoi: Make object variants declare the type for the discriminator (like sum types elsewhere)
  • didlybom, solomonthewise: Shorthand for defining sum types

Improvements

  • Zoom, slangmgh, didlybom, volodymyr, cumulonimbus, treeform, federico3, cmc: Robust concurrency/multithreading (Go)
  • coffeepot, sls1005: stdlib performance improvements with modern Nim features (ex. less Copy, more sink)
  • giaco, krakengore, didlybom, jasonfi, r3c, thadeudepaula, solomonthewise, murdohekku, pdkoekfr, apropos: Improve tooling (status: RFC#300)
    • detla: Better tooling for tracking where procs came from
    • thadeudepaula: Tooling should support user style (ex. snake_case vs. camelCase)
    • thadeudepaula: Better tooling around overloads
  • foderking, krakengore, thadeudepaula: Compiler error improvement
  • Zoom, giaco, kobi, treeform: Fix bugs!
  • sekao, treeform, jasonfi, mildred: Don't break things for the sake of breaking things!
  • r3c, solomonthewise, murdohekku, apropos: Better documentation, best practices, use cases
  • giaco, murdohekku, apropos: Solve the anti-virus false positives
  • 12398890: More powerful memory profiler
  • kobi: Bug fixes around methods
  • krakengore: Broadly improve includes and imports
  • krakengore, solomonthewise: Detailed compiler documentation/specs (see also: Internal compiler refactoring)
  • [implemented] thadeudepaula: Explicit roadmap and goals (RFC#437, RFC#543)
  • treeform: . and .= handling bugfixes
  • treeform: Import/iterator strangeness
  • treeform: Windows bugfixes
  • cmc: Easier metaprogramming
@planetis-m
Copy link

planetis-m commented May 11, 2022

Thanks for the compilation! Exceptions RFC: nim-lang/Nim#8363

You can remove the static thing.

SolitudeSF, planetis: Adopt ...

There are conflicting ideas like T() and =init() and default fields RFCs

@exelotl
Copy link

exelotl commented May 11, 2022

I'd like to add that Zoom's suggestion of making slices return openArrays seems like a really important one! (Not exactly sure if this has already been covered by one of the "view types" points above, but it's a suggestion that really stuck out to me as a good idea)

@omentic
Copy link
Author

omentic commented May 12, 2022

Even broken up into breaking / potentially breaking / not breaking changes, the list of suggestions was hard to parse, so I broke it up some more. The new categories are "features" (suggestions calling for a new feature or extending existing features), "removals" (suggestions calling for removals), "syntax" (suggesions relating to language syntax), and "improvements" (agreeable changes: ex. improve documentation).

You can view the uncategorized version in the revision history here. If I miscategorized anything, just let me know.

@c-blake
Copy link

c-blake commented May 12, 2022

Thank you very much for organizing all this!

@qaziquza
Copy link

Thank you very much for organizing all this!

Yes, it is truly quite awesome!

@GalaxySnail
Copy link

  • pdkoekfr: Concurrency as a language primitive (details)

It should be structured concurrency, which is different from traditional concurrency primitives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment