I also found myself needing to override `virtual` C++ methods, but eventually I
gave up on the library (the MEGA API).
Thanks for clarifying. Up to now I have had to manually patch C++ vTables to be
able to override some C++ class method with a nim-generated proc. What I keep
wondering is if nim is going to add some kind of support for that ... i.e.
implementing or overriding virtual C++ class methods. In my cas
That was something that was in the manual as coming soon for about eight months
before being removed:
[https://github.com/nim-lang/Nim/commit/c671356d51488c96b4749a4d109b00d924e1f739](https://github.com/nim-lang/Nim/commit/c671356d51488c96b4749a4d109b00d924e1f739)
This should still be happening
@mratsim Since I have already written my own custom vTable mechanism with nim
macros and some emitted C++ code (in order to interop i.e. inherit with C++
base classes) ... I'm wondering what you meant by saying:
> In the future you will also be able to use concepts and VTables.
Is there somethi
Thanks everyone for the insight and the suggestions! Guess I'll design with
this constraint in mind then. Just one little thing, I'm not sure how I can get
"any" to work as recommended since I've tried it and it refused to work. Can
someone share some code please?
@cdome Plus it's not that handy when using with objects, as far as I know?
> type Any is the closest to what you want. It is also unsafe to use.
It seems like you want dynamic typing in a statically typed language.
The proper way for heterogeneous collection of objects currently is:
* with ref objects inheriting from the same base class.
* with object variants
In the future you will also be able to use concepts and VTables.
* ref \--- there is no such a thing. Reference always points at an entity of
a specific type.
* auto \--- it's not a type per se, it can just appear in several contexts a
type may appear.
* object \--- it's a kind of a type (as in: "this is an object type"), not
type per se
* any \--- we
How do I instantiate a hashtable in Nim that maps strings to objects of any
type? None of these seem to work:
import tables
var t = newTable[string, any]()
var t = newTable[string, ref]()
var t = newTable[string, auto]()
var t = newTable[string, object]()
I
10 matches
Mail list logo