DEV Community

ringabout
ringabout

Posted on

2 1 1 1 1

My Nim Development Weekly Report (3/12)

Progress

chores

closes #16654; add a test case.

closes #20704; add a test case.

closes #6231; add a test case.

closes #8295; add a test case.

fixes sinkinference documentation, which has been disabled.

following up PRs

fixes quoted variables with typedesc types.

fixes explicit globals in macros.

fixes @[] and {} type inference as returns in generics

fixes #21377; fixes @[] and {} type inference as returns in generics.

  proc b[T](v: T): seq[int] =
    let x = 0
    @[]

  doAssert b(0) == @[]
Enter fullscreen mode Exit fullscreen mode

The type of @[] is incomplete, which is of seq[empty] type. By means of the return type of the generics, we could infer its type. Using top down type inference, we pass the expected type, namely seq[int], to the return expression. Finally, the return type is passed to the magic mArrToSeq, where we replace the incomplete type with seq[int].

Initialize all the missing fields when discriminator is assigned

fixes #21023; Segfault when mixing seqs, orc, variants and futures.

type
  Result = object
    case o: bool
    of false:
      e: int
    of true:
      v: float
Enter fullscreen mode Exit fullscreen mode

var x = Result(o: true) is now equal to var x = Result(o: true, v: 0.0). The v field is initialized to 0.0 so that it won't cause problems for ARC/ORC.

don't transform yields in the var section when introducing new local vars

fixes #21306; fixes #20485; don't transform yields in the var section when introducing new local vars.

fixes ambiguous calls compiles when module name are equal

fixes #21496; fixes ambiguous calls compiles when module name are equal.

- a
   - def.nim
- b
   - def.nim
- project.nimble
Enter fullscreen mode Exit fullscreen mode

The a/def and b/def shares the same owner, namely project which is the name of the nimble file. We cannot distinguish them by their owners.

if sym.kind == skModule and conflict.kind == skModule and sym.owner == conflict.owner:
Enter fullscreen mode Exit fullscreen mode

Instead, we need to use sym.position which stands for an unique index corresponding to the module's fileIdx for symbols with a skModule kind.

if sym.kind == skModule and conflict.kind == skModule and sym.position == conflict.position:
Enter fullscreen mode Exit fullscreen mode

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)

Participating in contributions

Following The Roadmap 2023 for community building , you could join us in the matrix space 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 for sponsoring me on GitHub.

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay