Contribute to the Python-like Nim language
Tags: nim, opensource, contributorswanted, programming
Published: 2023-03-27 15:43:30

## Progress

### fixes the documentation of typeclasses

[closes #21536; fixes manual](https://github.com/nim-lang/Nim/pull/21552).

The parser has been changed, now you need to use `type RecordType = (tuple or object)` ro declare types classes starting with tuple or object instead of `type RecordType = tuple or object`.

### forbids using `system.any` for type conversions

[fixes #14255; Crash in compiler when using system.any by accident](https://github.com/nim-lang/Nim/pull/21562).

```nim
var a = newSeq[bool](1000)
if any(a):
  echo "ok?"
```

Now it gives proper an error message => "Error: illegal type conversion to 'any'".

### fixes templates with untyped parameters resolve private fields wrongly in generics

[fixes #3770; templates with untyped parameters resolve private fields wrongly in generics](https://github.com/nim-lang/Nim/pull/21554).

```nim
type
  Noice* = object
    hidden: int

template jjj*: Noice =
  Noice(hidden: 15)
```

```nim
# bug #3770
import m3770

doAssert $jjj() == "(hidden: 15)"  # works

proc someGeneric(_: type) =
  doAssert $jjj() == "(hidden: 15)"

someGeneric(int)
```

Now the example compiles.


### (WIP) adds compiler support for object construction shorthand

WIP [adds compiler support for object construction shorthand](https://github.com/nim-lang/Nim/pull/21559).

```nim
type
  Vector = object
    a: int = 999
    b, c: int

block: # positional construction
  ## It specifies all the unnamed fields
  var x = Vector(1, 2, 3)
  doAssert x.b == 2

block:
  ## unnamed fields can be mixed with named fields
  block:
    var x = Vector(a: 1, 2, 3)
    doAssert x.c == 3

  block:
    var x = Vector(1, b: 2, 3)
    doAssert x.c == 3

  block:
    var x = Vector(1, 2, c: 3)
    doAssert x.c == 3

block:
  ## Object variants support unnamed fields for tags, which should be known at the compile time.
  type
    Color = enum
      Red, Blue, Yellow
    Factor = object
      id: int
      case flag: Color
      of Red:
        num: int
      of Blue, Yellow:
        done: bool
      name: string

  block:
    var x = Factor(1, Red, 2, "1314")
    doAssert x.num == 2

  block:
    var x = Factor(1, Blue, true, "1314")
    doAssert x.done == true

  block:
    var x = Factor(1, Yellow, false, "1314")
    doAssert x.done == false


  type
    Ciao = object
      id: int
      case flag: bool = false
      of true:
        num: int
      of false:
        done: bool
      name: string

  block:
    var x = Ciao(12, false, false, "123")
    doAssert x.done == false

  block:
    var x = Ciao(12, flag: true, 1, "123")
    doAssert x.num == 1
```

## Weekly collection


https://forum.nim-lang.org/t/9908 (2/19)

https://forum.nim-lang.org/t/9940 (2/26)

https://forum.nim-lang.org/t/9970 (3/5)

https://forum.nim-lang.org/t/9989 (3/12)

https://forum.nim-lang.org/t/10024 (3/19)


## Participating in contributions

Following [The Roadmap 2023 for community building ](https://github.com/nim-lang/RFCs/issues/513), you could join us in [the matrix space](https://matrix.to/#/!ZmWXggMgfkKpcLbQkB:matrix.org?via=matrix.org) where we discuss how to build a community. We appreciate doable suggestions and helps, such as improving the workflow, implementing the roadmap, suggesting doable tasks, reviewing code from contributors. United we stand. We shall work together to make the community thrive.

## Sponsorship

Many thanks to Yepoleb, lenis0012, pietroppeter, Clonkk, mode80, Phil, CxPlanner, shirleyquirk, elcritch, geotre, thinkwelltwd, xrfez, enthus1ast, piertoni, Dnanilem, gemath for [sponsoring me on GitHub](https://github.com/sponsors/planety).