zlacker

[parent] [thread] 2 comments
1. xigoi+(OP)[view] [source] 2025-12-05 13:06:07
It needs to be this way so that UFCS works properly. Imagine if instead of "a,b".split(','), you had to write "a,b".(strutils.split)(',').
replies(1): >>poloti+k1
2. poloti+k1[view] [source] 2025-12-05 13:14:32
>>xigoi+(OP)
ok I do not understand.

What is preventing this import std/errorcodes

from allowing me to use: raise errorcodes.RangeError instead of what Nim has?

or even why not even "import std/ErrorCodes" and having the plural in ErrorCodes.RangeError I wouldn't mind

replies(1): >>PMunch+z2
◧◩
3. PMunch+z2[view] [source] [discussion] 2025-12-05 13:21:49
>>poloti+k1
Nothing, and it fact this works. To move to an example which actually compiles:

    import math
    
    echo fcNormal
    echo FloatClass.fcNormal
    echo math.fcNormal
    echo math.FloatClass.fcNormal
All of these ways of identifying the `fcNormal` enum value works, with varying levels of specificity.

If instead you do `from math import nil` only the latter two work.

[go to top]