I have defined an enum type like:
    
    
    type
        myEnum = enum
            someValue = "str-Value"
            anotherValue = "another-Value"
    
    
    Run

with a `$` overload like:
    
    
    func `$`*(v: myEnum): string =
        case v:
            of someValue: return "one"
            of anotherValue: return "two
    
    
    Run

And all this residing in one distinct module.

(obviously, the above is just an example; albeit an accurate one...)

The question is two-fold:

**One:**

Let's say I import the module in a different one... shouldn't every 
`$(something-that-is-myEnum)` _always_ call the right `$` overload? (the one 
defined above)

At present, it feels mostly like random (basically, I have to try it every 
single time to make sure it doesn't output `someValue` & `anotherValue`... that 
is: totally ignoring my `$` function.

**Two:**

Based on the above, although a tiny bit unrelated, in the generated C code (and 
in the binary as well, obviously) all this string values are there 
(`someValue`, `anotherValue`)... What can I do to complete get rid of them for 
selected enums?

Reply via email to