Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
What happens during compilation is the two alias type gets merged since they're both just a pointer to an opaque type, and you end up with only the type for the first used symbol in the generated C++ code.
And if you reference VkImageView first instead of VkImage you'd see the reverse - the alias for the VkImageView vector would be present but not the one for the VkImage vector.
This causes the generated C++ to fail to compile, and means one has to resort to hacks like {.emit.} which produces other side effects - like now there's the need to define the std::vector interface for each aliased type in Nim.
I tested this and reproduced it on 1.4.8 and 1.5.1
Nim Compiler Version 1.5.1 [Windows: amd64]
Compiled at 2021-09-21
Copyright (c) 2006-2021 by Andreas Rumpf
git hash: 928ea6bb4c0cc791f1b81e55dbebd14d5c6a7315
active boot switches: -d:release
Let's say you have some C++ code like:
And you want to wrap it with Nim.
You'd define some type definitions and proc signatures like:
What happens during compilation is the two alias type gets merged since they're both just a pointer to an opaque type, and you end up with only the type for the first used symbol in the generated C++ code.
So instead of seeing:
in the generated cpp source, you will only see something like:
And if you reference
VkImageView
first instead ofVkImage
you'd see the reverse - the alias for theVkImageView
vector would be present but not the one for theVkImage
vector.This causes the generated C++ to fail to compile, and means one has to resort to hacks like
{.emit.}
which produces other side effects - like now there's the need to define thestd::vector
interface for each aliased type in Nim.Issue is blocking my Vulkan renderer / game which you can see some of the WIP code for here: https://github.com/zacharycarter/FRAG/blob/master/src/fragpkg/app.nim#L52-L56 - in fact this is the section of code I'm blocked from progressing further on (barring resorting to emit).
I tested this and reproduced it on 1.4.8 and 1.5.1