by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Mar 03 2017 15:52
    @dom96 banned @Octopoda7
  • Feb 12 2017 23:57
    @dom96 banned @zzz125
  • Dec 23 2016 19:43
    @dom96 banned @Izrab
Kaushal Modi
@kaushalmodi
hmm
btw just replace fmt to & did not make any difference, still fails
next, will use the let trick you suggested
Mamy Ratsimbazafy
@mratsim
@jrfondren there was too many unintentional errors with unary <10
now you should use ..< without space and unary < (previous) will be removed
From IRC (bridge bot)
@FromIRC
<nc-x> Araq: I will open an issue in a few minutes once I get a minimize the code
Kaushal Modi
@kaushalmodi
Araq: OK, that let trick worked: http://ix.io/1GrY
Ghost
@ghost~5b68e3cbd73408ce4fa3b6b0
I remembered that. I just wondered how I'm expected to learn that.
Mamy Ratsimbazafy
@mratsim
so 0 ..< 10 remains but 0 .. <10 is warned about
Kaushal Modi
@kaushalmodi
Araq: what's a simple explanation for that behavior? (so that I can put in my notes)
also, do you think that will be fixed?
Mamy Ratsimbazafy
@mratsim
the new deprecation indicates what is the replacement
deprecations*
you can do a PR to add that to <
From IRC (bridge bot)
@FromIRC
<Araq> @kaushalmodi: fields/fieldPairs is very special in the compiler, we have to unroll the loop in the frontend and we likely got it wrong :⁠P
Kaushal Modi
@kaushalmodi
looks like I hit the nail on the head with that issue title
I played with numerous fmts in for loops and got confused what was special about looping through objects :P
Mamy Ratsimbazafy
@mratsim
it's not a loop
Kaushal Modi
@kaushalmodi
i mean iterating through values yielded by fields/fieldPairs
Mamy Ratsimbazafy
@mratsim
yeah, I mean what's special is that it's not a loop :p
Kaushal Modi
@kaushalmodi
sorry, I am confused
you mean that the for behaves differently for fields/fieldPairs?
Ghost
@ghost~5b68e3cbd73408ce4fa3b6b0
the fields are statically known so the loop is fully unrolled, yeah?
Kaushal Modi
@kaushalmodi
so what is different that fields/fieldPairs doesn't work, while this works?:
import strformat
for i in @[1, 2, 3]:
  echo fmt"{i}"
Mamy Ratsimbazafy
@mratsim
in that case it's a real loop in the generated code
in the other case, Nim inserts as many "echo" as the number of fields in your objects
Kaushal Modi
@kaushalmodi
huh, really? TIL
Mamy Ratsimbazafy
@mratsim
And I'm pretty sure that the compiler then chokes on semantic type checking the formats
Kaushal Modi
@kaushalmodi
so that whole for key,val in foo.fieldPairs is a special construct?
Mamy Ratsimbazafy
@mratsim
yes
key/val only exists at compile time and the types is a weird compile-time polymorphic stuff
Kaushal Modi
@kaushalmodi
ok .. not sure how to note that down :P But for now I'll use fields/fieldPairs with caution
Mamy Ratsimbazafy
@mratsim
well it doesn't really cause problems in my experience, just hard to decipher error messages
also that means that if you want to test a condition on the keys, you need to use when to avoid type errors
like "when key is string:"
Kaushal Modi
@kaushalmodi
Thanks for all that info
From IRC (bridge bot)
@FromIRC
<narimiran> @kaushalmodi: see this also nim-lang/Nim#7533
<narimiran> "Warning: This really transforms the 'for' and unrolls the loop. The current implementation also has a bug that affects symbol binding in the loop body."
Mamy Ratsimbazafy
@mratsim
wow the error message is even worse that what I met so far
Kaushal Modi
@kaushalmodi
man, timotheecour is really missed here
narimiran, Araq: you guys should finally strike up some truce with him
From IRC (bridge bot)
@FromIRC
<livcd> oh noes fmt goes away?
Kaushal Modi
@kaushalmodi
narimiran: probably related to that system sub-module separation? cannot find fieldPairs in https://nim-lang.github.io/Nim/theindex.html
looks that most of what I am looking for in system is missing from the devel docs
:(
From IRC (bridge bot)
@FromIRC
<narimiran> yes, probably. look at iterators.nim:205 (and you'll see it is just a magic :⁠))
Kaushal Modi
@kaushalmodi
From IRC (bridge bot)
@FromIRC
<nc-x> Araq: nim-lang/Nim#11050
Kaushal Modi
@kaushalmodi
I had stopped using the stable docs for a while now .. can fixing the devel docs be bumped up in priority?
From IRC (bridge bot)
@FromIRC
<Araq> @nc-x, 'method'?