Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 04 12:26
    @dom96 banned @acroobat
  • Mar 03 2017 15:52
    @dom96 banned @Octopoda7
  • Feb 12 2017 23:57
    @dom96 banned @zzz125
  • Dec 23 2016 19:43
    @dom96 banned @Izrab
zetashift#2536
@_discord_77574388035100672:t2bot.io
[m]
usually what happens is you make a third module that exports that variable
Life Sucks#4999
@_discord_347345994217816066:t2bot.io
[m]
oh
kinda sucks
kaushalmodi#9581
@_discord_851561419848679434:t2bot.io
[m]
If you are on devel, import foo {.all.} might help. See the changelog.md changes in nim-lang/Nim#17706 .
zetashift#2536
@_discord_77574388035100672:t2bot.io
[m]
provides a surgical way for client code to access specific private symbols in a module. but why 😮
nvm I'm blind use cases are a lil bit down
Yehowshua Immanuel
@BracketMaster
I sometimes use castfoo
oops
cast[foo](bar)
where is this mentioned in the nim manual?
kaushalmodi#9581
@_discord_851561419848679434:t2bot.io
[m]
I have only needed to cast pointer types when working with C interop.
Otherwise TYPE(VAR) or VAR.TYPE works.
Yehowshua Immanuel
@BracketMaster
yes I know
kaushalmodi#9581
@_discord_851561419848679434:t2bot.io
[m]
Yehowshua Immanuel
@BracketMaster
but I'm wondering where cast is mentioned in the manual
kaushalmodi#9581
@_discord_851561419848679434:t2bot.io
[m]
I just opened the manual link and Ctrl+F "cast" to get the above link.
Yehowshua Immanuel
@BracketMaster
alright - that's on me
zetashift#2536
@_discord_77574388035100672:t2bot.io
[m]
dw happens to everybody from time to time
Yehowshua Immanuel
@BracketMaster
what's "dw"?
oh - don't worry
thx
zetashift#2536
@_discord_77574388035100672:t2bot.io
[m]
yup!
hamidb80#2337
@_discord_745944009918251010:t2bot.io
[m]
hey
discard readFile("./play.txt") # works find

for row in readFile("./play.txt").lines: 
  echo 1 # doesn't work
and something crazy happens with lines iterator
it prints all of the lines and gives me an IOError
can anybody test it?
hamidb80#2337
@_discord_745944009918251010:t2bot.io
[m]
nim 1.5.1
os: windows 10
oh
i lost my mind 😄
Elegant Beef
@beef331:matrix.org
[m]
"./play.txt".lines
hamidb80#2337
@_discord_745944009918251010:t2bot.io
[m]
yep, thanks
kaushalmodi#9581
@_discord_851561419848679434:t2bot.io
[m]
hamidb80 The key is in understanding the return type. readFile returns a string; not a seq of string: https://nim-lang.github.io/Nim/io.html#readFile%2Cstring
demotomohiro#9262
@_discord_288750616510201856:t2bot.io
[m]
This issue has been closed but I think this is a bug need to be fixed.
nim-lang/Nim#18325
zetashift#2536
@_discord_77574388035100672:t2bot.io
[m]
it got closed by the OP tho haha
timotheecour#6096
@_discord_427948629249228800:t2bot.io
[m]
re-opened
demotomohiro#9262
@_discord_288750616510201856:t2bot.io
[m]
thx
rockcavera[IRC]#0000
@_discord_709044657232936960_rockcavera=5b=49=52=43=5d:t2bot.io
[m]
should the two cases compile? https://play.nim-lang.org/#ix=3qWw
checkersai#1659
@_discord_202953368958795776:t2bot.io
[m]
Can I not make a generic distinct type?
type MyArr[N] = distinct array[N, int]

let arr = [1,2,3,4,5].MyArr[5]
This crashes
Elegant Beef
@beef331:matrix.org
[m]
It's a static type so it needs to be static int
Generics expect types so without it passing in a value causes an error
checkersai#1659
@_discord_202953368958795776:t2bot.io
[m]
ah that'll do it
thanks
checkersai#1659
@_discord_202953368958795776:t2bot.io
[m]

Another question, why doesn't this work?

type MyArr[N:static[int]] {.borrow: `[]`.} = distinct array[N, int]

It gives the error "only a 'distinct' type can borrow ." which doesn't make sense

Rika#2434
@_discord_259277943275126785:t2bot.io
[m]
Also the last [5] part should be [:5], without the colon it would be an indexing
fn[IRC]#0000
@_discord_709044657232936960_fn=5b=49=52=43=5d:t2bot.io
[m]
<Prestige> Hello