<<28-09-2020>>

00:02:16*gmaggior quit (Quit: Leaving)
00:07:28FromDiscord<exelotl> @InventorMatt https://play.nim-lang.org/#ix=2yYx
00:08:36FromDiscord<exelotl> if you change `a` the program will fail to compile, but if you change `b` it will still compile, but raise an exception at runtime
00:09:59FromDiscord<exelotl> due to the static parameter, the overload resolution picks the first template if the value is known at compile time, or the second template otherwise.
00:10:16FromDiscord<InventorMatt> thanks, that helps a lot
00:10:55FromDiscord<exelotl> (these could totally be procs instead of templates, idk why I picked template)
00:43:16bungis there workaround fix this? https://play.nim-lang.org/#ix=2yVe
00:58:36leorize[m]no, varargs is essentially openarray which has to borrow the memory from the caller
00:59:28leorize[m]since async transform the code into a closure iterator which doesn't rely on the stack, the borrowing can't be done safely (yet)
01:00:01leorize[m]your best bet is to use a seq
01:05:36*thomasross quit (Read error: Connection reset by peer)
01:20:40*noonien quit (Quit: Connection closed for inactivity)
01:24:27*apahl quit (Ping timeout: 260 seconds)
01:25:57*apahl joined #nim
01:28:40*krux02 quit (Remote host closed the connection)
01:45:24bungleorize, ty! I manually change it to sync and callback version, result same.
01:56:20*lritter joined #nim
01:56:49bungI move proc body to async proc accept seq and wrap a sync proc accept varargs
03:00:07*muffindrake quit (Ping timeout: 240 seconds)
03:02:34*muffindrake joined #nim
04:06:01*supakeen quit (Quit: WeeChat 2.9)
04:06:34*supakeen joined #nim
04:07:38silvernode[m]Is there a way to do mixed type seqs?
04:07:58FromDiscord<UNIcodeX> json?
04:11:18FromDiscord<Elegant Beef> Well similar to how json does it, you box the data into object variants
04:13:55FromDiscord<Elegant Beef> silvernode here is an example of how https://play.nim-lang.org/#ix=2yZ9
04:14:36FromDiscord<Elegant Beef> It works like inheritance so you cannot access strval on a object with the kind of bkString
04:14:46FromDiscord<Elegant Beef> (edit) 'bkString' => 'bkInt'
04:16:00silvernode[m]wow that is fairly easy but I figured it would be a bit easier than that.
04:26:01FromDiscord<Elegant Beef> Well nim is statically typed, so the data needs to be the same type
04:27:11FromDiscord<shad0w> gratz on the 10k stars @github team. 👑
04:44:55*solitudesf- joined #nim
04:49:56FromDiscord<Bub_Lite_63_Jr (JosephTLyons)> Is there a command to update nim to the newest version?
04:50:05FromDiscord<Bub_Lite_63_Jr (JosephTLyons)> (edit) 'Is there a command to update nim to the newest ... version?' => 'Is there a command to update nim to the neweststable'
04:50:10FromDiscord<Elegant Beef> If you have choosenim installed it's `choosenim stable`
04:50:41FromDiscord<Bub_Lite_63_Jr (JosephTLyons)> Great, its reporting 1.2.0 on my system and that that is the newest stable version
04:51:56ForumUpdaterBotNew thread by Jiyinyiyong: Is there a concept like "equality of refs" in Nim?, see https://forum.nim-lang.org/t/6865
04:52:39FromDiscord<Elegant Beef> alternatively `choosenim update stable`
04:53:31FromDiscord<Bub_Lite_63_Jr (JosephTLyons)> Ahh, that actually did the updating
04:53:35FromDiscord<Bub_Lite_63_Jr (JosephTLyons)> 1.2.6 now
04:53:40FromDiscord<Bub_Lite_63_Jr (JosephTLyons)> Thanks @Elegant Beef
04:53:48FromDiscord<Elegant Beef> No problem
04:59:34*waleee-cl quit (Quit: Connection closed for inactivity)
05:00:51*justsomeguy joined #nim
05:38:42*narimiran joined #nim
05:51:30*justsomeguy left #nim (#nim)
05:52:33*bunbunbunbunny joined #nim
05:54:33*kenran joined #nim
06:39:23*narimiran quit (Ping timeout: 256 seconds)
06:42:10*narimiran joined #nim
06:48:56*Vladar joined #nim
06:51:21*PMunch joined #nim
06:54:33*bunbunbunbunny quit (Quit: Lost terminal)
08:03:47*kinkinkijkin quit (Ping timeout: 240 seconds)
08:14:48Araqping alehander92
08:30:14FromGitter<alehander92> yes sorry
08:30:15FromGitter<alehander92> morning
08:37:59Araqtoo late, missed the meeting
08:38:39*kinkinkijkin joined #nim
08:44:08*hnOsmium0001 quit (Quit: Connection closed for inactivity)
08:47:42*Kai0Shin joined #nim
08:47:48Kai0ShinHi
08:48:00Kai0Shintemplate n_vec2* (x,y:float64):vec2= vec2(x:x,y:y)
08:48:10Kai0ShinWhy does this throw an error
08:48:45FromDiscord<lqdev> what error?
08:48:48Kai0ShinIt says Undeclared field <Error>
08:48:52Araqbecause templates don't understand (x: x)
08:49:01Kai0Shin/root/nim-lang/sdl2/src/inc/vec/vec2.nim(14, 13) Error: identifier expected, but found '10'
08:49:04Araqthey replace the 'x' in both places!
08:49:04Kai0Shinmake: *** [Makefile:45: bin/debug/base] Error 1
08:49:15Araquse an inline proc instead
08:49:30Kai0Shinwhat is an inline proc
08:49:40Araqit's a common gotcha but it cannot be fixed because it's also a feature of templates and used
08:50:02Kai0Shinso i just replace names of variables
08:50:13Araqproc n_vec2*(x,y: float64): vec2 {.inline.} = vec2(x: x, y: y)
08:50:26Araqyou can pick different parameter names in your template, yes
08:50:44Araqbut generally we advise you to use inline procs over templates
08:50:50Kai0Shinokay so it just replaces the code there rather than calling the proc
08:50:57Kai0Shinthanks
08:52:14PMunchKai0Shin, yeah that's what templates do
08:52:33Kai0ShinI meant for the {.inline.} method
08:52:41PMunchThey just replace the call with whatever is in the template body
08:53:18PMunchAh {.inline.} tells the C compiler to try harder to inline the call. And inline means to replace the call with the body
08:53:45PMunchAnd I say "harder" because he C compiler already tries to inline things when it thinks it's a good idea to do so
08:54:45Kai0ShinThe same would go for cpp
08:58:31*superbia2 joined #nim
08:58:47*abm joined #nim
09:00:47*superbia1 quit (Ping timeout: 240 seconds)
09:02:21PMunchYeah
09:05:13*superbia2 quit (Quit: WeeChat 2.9)
09:13:54Araqer
09:14:08Araqpragmas for parameters are ignored?
09:14:14Araqproc p(x {.noalias.}: openArray[char]) =
09:14:14Araq discard
09:14:21Araqcompiles for me! :-(
09:14:45Araq!proc p(x {.noalias.}: string) = discard
09:14:55Kai0Shinwhat is !proc
09:15:07Araqwhat's Nimbot's syntax again?
09:15:57FromDiscord<Rika> !eval
09:15:58FromDiscord<Rika> i think
09:16:36Araq!eval echo "hi"
09:16:38NimBothi
09:16:42Araqah, thanks
09:17:02Araq!eval proc p(x {.noalias.}: openArray[char]) = discard
09:17:03NimBotCompile failed: /usercode/in.nim(1, 10) Error: identifier expected, but found 'x {.noalias.}'
09:17:17narimiran!eval echo NimVersion
09:17:19NimBot1.2.6
09:17:33Araqthank god. :-)
09:17:53Kai0Shin!eval echo hostOS
09:17:56NimBotlinux
09:18:18Kai0Shin!eval echo hostCPU
09:18:21NimBotamd64
09:18:47PMunch!eval echo staticExec("uname -a")
09:18:49NimBotCompile failed: /usercode/in.nim(1, 16) Error: 'staticExec' can only be used in compile-time context
09:18:58PMunch!eval echo static: staticExec("uname -a")
09:19:00NimBotCompile failed: /usercode/in.nim(1, 24) Error: 'staticExec' can only be used in compile-time context
09:19:03*kenran quit (Quit: leaving)
09:19:08FromGitter<alehander92> Araq yes: forgive me, i woke up later: elif/[] remaining
09:19:10PMunch!eval echo(static: staticExec("uname -a"))
09:19:12NimBotCompile failed: /usercode/in.nim(1, 1) Error: type expected
09:19:15FromGitter<alehander92> i'll stream a bit
09:19:19PMunchMeh
09:19:21FromGitter<alehander92> to focus
09:19:24narimiranPMunch: static: echo maybe
09:19:24Araqok
09:19:47PMunch@narimiran, don't think that would work as the bot doesn't show compile-time output
09:19:54narimiranPMunch: ah, ok
09:20:40FromDiscord<haxscramper> !eval import osproc; echo execCmdEx("uname -a").output
09:20:44NimBotLinux 328f2f99e925 4.15.0-118-generic #119-Ubuntu SMP Tue Sep 8 12:30:01 UTC 2020 x86_64 Linux↵
09:21:50PMunchHmm "static:" behaves really weird
09:22:11FromDiscord<Yardanico> Did anyone try out https://plugins.jetbrains.com/plugin/15128-nim yet?
09:22:14FromDiscord<Yardanico> I'll do it later
09:22:29FromDiscord<Yardanico> Seems like they support Nim partial case insensitivity
09:22:40PMunch@flywind mentioned it over in offtopic earlier today, not sure if they tried it though..
09:23:50Kai0ShinIs there a discord server I can join
09:24:23FromDiscord<Yardanico> Yes
09:24:28FromDiscord<flywind> I have tried it, still immature, but seems an official jetbrains plugin I think.
09:24:32FromDiscord<Yardanico> discord.gg/nim
09:30:31FromDiscord<iWonderAboutTuatara> We're on the discord right now actually
09:30:41FromDiscord<Yardanico> He knows :)
09:30:41FromDiscord<haxscramper> There is no way to limit number of type mismatch errors, right? I can only use `--showAllMismatches:on|off` to show absolutely everything
09:30:46FromDiscord<iWonderAboutTuatara> Oh lol
09:31:00FromDiscord<Yardanico> Bridge name in IRC is "FromDiscord"
09:31:18FromDiscord<haxscramper> But if I want to filter out things I just have to do some text filtering manually?
09:31:20*Trustable joined #nim
09:31:36FromDiscord<brainbomb> > Did anyone try out https://plugins.jetbrains.com/plugin/15128-nim yet?↵@Yardanico Does it work with the community versions of the IDEs too?
09:31:52FromDiscord<Yardanico> I don't know, you can try :)
09:34:23*Kai0Shin quit (Quit: leaving)
09:34:50FromDiscord<brainbomb> "Compatible with IntelliJ IDEA, Android Studio, AppCode, CLion, DataGrip, GoLand, PhpStorm, PyCharm, Rider, RubyMine, WebStorm"
09:40:36FromDiscord<Rika> !eval const test = staticExec("uname -a"); echo test
09:40:39NimBotLinux db9e6db77742 4.15.0-118-generic #119-Ubuntu SMP Tue Sep 8 12:30:01 UTC 2020 x86_64 Linux
09:41:10FromDiscord<Yardanico> we already figured this out :P
09:41:31FromDiscord<brainbomb> !eval const test = staticExec("id"); echo test
09:41:34NimBotuid=65534(nobody) gid=65534(nobody)
09:41:42FromDiscord<Rika> does it look like i did it for you
09:48:39FromGitter<alehander92> :)
09:51:31FromDiscord<alehander42> ok, streaming in discord #general a bit
09:52:09FromDiscord<Yardanico> if you stream on twitch people from irc will be able to see too :)
09:52:29FromDiscord<alehander42> yeah but for some reason
09:52:46FromDiscord<alehander42> i have problems with my obs hardware encoding
09:52:57FromDiscord<alehander42> so it's slow and
09:53:17FromDiscord<alehander42> for some reason sharing my screen/mic on discord seems to be more lightweight
09:53:20*crem joined #nim
09:53:34FromDiscord<Yardanico> because the quality is worse?
09:54:13FromDiscord<alehander42> maybe not great
09:54:19FromDiscord<alehander42> but it seems i can see the code well
09:54:21FromDiscord<alehander42> even on discord
09:55:04FromDiscord<alehander42> i have to debug my system & the open broadcast thing
09:55:14FromDiscord<alehander42> probably some kind of codec issue
09:55:44FromDiscord<alehander42> another + for discord is that
09:55:52FromDiscord<alehander42> if someone wants to say something, he can just join
09:55:59FromDiscord<alehander42> in twitch i need a .. mumble or stuff
09:57:06*Trustable quit (Read error: Connection timed out)
09:57:29*Trustable joined #nim
09:58:42*dv-^_^6 quit (Quit: The Lounge - https://thelounge.chat)
10:01:50PMunchHmm, is there a way to turn a file descriptor into a Nim file?
10:03:47*apahl quit (Ping timeout: 240 seconds)
10:06:11*apahl joined #nim
10:27:55FromDiscord<Yardanico> Yes
10:28:17FromDiscord<Yardanico> File is just importc of C's FILE
10:28:47FromDiscord<Yardanico> Well, ptr of it
10:28:48FromDiscord<Yardanico> https://github.com/nim-lang/Nim/blob/devel/lib/system/io.nim#L21
10:29:18FromDiscord<Yardanico> And there's c_fdopen
10:30:50FromDiscord<Yardanico> Ah wait
10:31:27FromDiscord<Yardanico> @PMunch https://nim-lang.org/docs/io.html#open%2CFile%2CFileHandle%2CFileMode
10:31:53PMunchHmm, okay
10:32:42Araqplease don't rely on it, we're looking forward to a new io module that doesn't use C's legacy
10:33:44PMunchDon't worry, this is only for a small test script I'm writing
10:33:52PMunchBut I need to read from a UDP socket as a stream
10:34:03PMunchAh, it didn't like peek..
10:36:02Araqbtw today I solved borrow checking for Nim. Now only the documentation and implementation is lacking...
10:41:11FromDiscord<Yardanico> borrow checking for openarrays or it can be used for other stuff too?
10:43:14Araqfor "view types"
10:43:26Araqlent/var/openArray
10:44:32FromDiscord<exelotl> Aw heck yeah
10:45:45FromDiscord<Clyybber> Araq: Nice, what was the problem ?
10:48:49*waleee-cl joined #nim
10:49:19AraqNim's semantics were off
10:49:36Araqbut we can recover from it easily
10:50:56Araqwe need to allow proc `[]`(x: Container): var T
10:51:05Araqnote the absense of 'var Container'
10:51:13FromDiscord<Clyybber> Huh
10:51:24Araqthen we also need two overloads to do the same
10:51:29Araqer
10:51:38Araqthen we also do not need two overloads to do the same anymore
10:52:02FromDiscord<Clyybber> But that allows me to get var T from a immutable seq[T]?
10:52:18FromDiscord<Clyybber> Don't we need proc [](x: Container): lent T instead?
10:52:23Araqyeah, borrow checking then enforces you don't mutate the seq
10:52:51FromDiscord<Clyybber> hmm, but why can't we use lent T instead?
10:52:51Araqbut the type signature finally stops lying (it doesn't mutate the seq, it allows for a seq mutation!)
10:53:07Araqbecause it's not the same thing, 'lent' doesn't allow for mutations
10:53:24FromDiscord<Clyybber> yeah, but why should we allow for mutations if we want to enforce they dont happen
10:53:42FromDiscord<Clyybber> if possible I think preventing mistakes with the type system is preferred over borrow checking
10:54:13AraqI'm quite certain I got it right :P
10:54:24FromDiscord<Clyybber> it sounds quite broken to me :D
10:54:44Araqlook at a[i] = x
10:54:51Araqwhere a is a good old array
10:55:42Araqwe know that it mutates an element but a[i] itself is no mutation
10:56:04Araqwe currently model this with two overloaded [] accessors
10:56:36Araqbut that's not correct. there is one accessor and it allows for mutations, done by the '='
10:56:53*neceve joined #nim
10:57:42Araqour way of modelling says "if the var overload is picked assume a mutation"
10:57:54Araqbut that's not good enough for strict funcs, see
10:57:57FromDiscord<Clyybber> But we don't have to assume that
10:58:09FromDiscord<Clyybber> We can have the compiler check for actual modifications
10:58:23FromDiscord<Clyybber> but I agree that we might be conflating two things here
10:58:40FromDiscord<Clyybber> passing on something mutable might be worth it to seperate from actual modification
10:59:01Araqhttps://github.com/nim-lang/Nim/blob/devel/lib/impure/nre.nim#L377
10:59:42FromDiscord<Clyybber> is that needed because the var overload was chosen?
11:00:16Araqyes
11:00:31FromDiscord<Clyybber> but why does that count as a sideffect
11:00:33FromDiscord<Clyybber> pattern is local
11:00:40FromDiscord<Clyybber> and name isn't passed as a var param?
11:03:43FromDiscord<Clyybber> and result isn't modified afterwards
11:03:53FromDiscord<Clyybber> Araq: ping
11:12:11Araqpattern is connected to the parameter 'pattern'
11:12:29Araqit's confusing code, I know
11:12:50Araqbut the compiler's analysis is correct (except for the language design problem)
11:13:34Araqthe parameter is not a 'var'
11:13:55Araqand so for all the compiler can tell this could mutate an object reachable from the pattern parameter
11:14:16FromDiscord<KaiOShin> I am getting some error in an almost perfect program
11:14:17FromDiscord<KaiOShin> https://pastebin.com/bvY9qep6
11:14:42FromDiscord<Yardanico> Makefile?
11:14:56Araqadd a loadExtensions() call as the first statemnt of your main .nim file
11:15:47FromDiscord<KaiOShin> Makefile output :
11:15:48FromDiscord<KaiOShin> Compiling: src/inc/vec/vec2.nim -> bin/debug/base↵nim -o:bin/debug/base cpp --opt:size src/main.nim
11:16:03*konkrrrrrr joined #nim
11:16:41*kinkinkijkin quit (Ping timeout: 244 seconds)
11:18:00FromDiscord<KaiOShin> still shows the error @Araq[IRC]
11:18:41FromDiscord<KaiOShin> Araq where do you mean
11:19:09FromDiscord<Clyybber> Araq: How could it? The local pattern variable is immutable?
11:20:08FromDiscord<Clyybber> ah, Refex is a ref object :/
11:20:37FromDiscord<KaiOShin> It does not show the error after removing loadExtensions()
11:26:48FromDiscord<KaiOShin> It works after I used some functions from opengl
11:34:25Oddmongerlet's say i have: var foo:tuple[ idx:int, bag:array[10, ptr string] ]
11:34:59Oddmongeris it possible to initialize it, starting idx at 9 for example ?
11:35:24FromDiscord<Rika> instead of putting 10, put 9..<19
11:35:26Oddmongerlike var foo… = (9, [0..9,0] ) ?
11:35:37FromDiscord<Clyybber> Araq: Hold on, is the var overload chosen?
11:35:53PMunchIs there a way to see the raises of a procedure?
11:36:15PMunchI get this error, which isn't very useful.. http://ix.io/2z0u
11:37:02FromDiscord<Clyybber> Disregard that
11:37:19Oddmongerah i see what you mean Rika, but my example was not well chosen
11:37:35Oddmongerlet's say i want to initialize the tuple with an arbitrary value for idx
11:38:09FromDiscord<Rika> wdym?
11:38:30FromDiscord<Rika> array indices are decided at compile time i think?
11:39:21Oddmongeri mean something like this: var ufos:tuple[ list:array[50,ptr orxOBJECT], index:int, index_max:int] = (array[50,orxOBJECT],0,50)
11:39:39Oddmongerit's for initializing index_max at creation
11:40:16*lritter quit (Ping timeout: 246 seconds)
11:40:32Oddmongerthe «array» part in the init is wrong, i don't know how to init this part at blank values (or just skip it)
11:40:37FromDiscord<Rika> array[N, T] is an alias for array[0..<N, T] afaik so max int is always gonna be array.high
11:41:03Oddmongerah fine
11:41:18PMunchHmm, I also have an issue with tags..
11:41:24Oddmongerthank you Rika
11:41:51PMunchI'm trying to implement streams for a socket
11:42:48PMunchBut the socket procedures have various effect tags that aren't listed by the streams "interface"
11:43:03FromDiscord<Clyybber> Araq: I think i have a solution for the problem
11:43:09FromDiscord<Clyybber> Since with strictFuncts non-var params are deeply-immutable
11:43:12FromDiscord<Clyybber> The local pattern variable is deeply-immutable too
11:43:16FromDiscord<Yardanico> You'll have to cast @PMunch
11:43:16FromDiscord<Clyybber> If the analysis is aware of that we have solved the problem
11:43:29FromDiscord<Yardanico> Not sure how safe it is, but you can strip these tags with casts
11:44:13PMunchAha
11:47:30*d10n_ is now known as d10n
11:47:30*d10n quit (Changing host)
11:47:30*d10n joined #nim
11:49:36PMunchUgh, I'm using a backwards setPosition.. This means I have to implement a socket stream properly..
12:06:02*supakeen quit (Quit: WeeChat 2.9)
12:06:39*supakeen joined #nim
12:10:44*xace quit (Ping timeout: 256 seconds)
12:11:55*NimBot joined #nim
12:41:36FromDiscord<dom96> I wonder if you can `{.tags: [].}:`
12:41:46FromDiscord<dom96> in the same way you can use `gcsafe`
12:41:55FromDiscord<dom96> if not it would be a great feature (CC Araq)
12:43:49*xace joined #nim
12:44:41*arecacea1 quit (Remote host closed the connection)
12:45:04*arecacea1 joined #nim
12:52:35*xace quit (Ping timeout: 240 seconds)
12:55:22*konkrrrrrr quit (Ping timeout: 244 seconds)
12:55:29*kinkinkijkin joined #nim
12:55:47FromDiscord<mratsim> lying about gcsafe is OK, but lying about exceptions?
12:57:21FromDiscord<fwsgonzo> does anyone have a bog-standard CMake script for building with Nim using either C or C++ backend?
12:57:48FromDiscord<fwsgonzo> if not, will there be an argument you could pass to nim that would output in a way that simplifies CMake builds?
12:58:21FromDiscord<fwsgonzo> (edit) 'does anyone have a bog-standard CMake script for building with Nim using either C or C++ backend? ... ' => 'does anyone have a bog-standard CMake script for building with Nim using either C or C++ backend?GLOB disqualified'
12:58:37*kinkinkijkin quit (Remote host closed the connection)
12:59:04*kinkinkijkin joined #nim
13:00:59FromDiscord<mratsim> Building Nim the compiler or building a Nim program/application?
13:05:13*Trustable quit (Remote host closed the connection)
13:28:02disruptekzevv: npeg 0.23.0 doesn't work on 1.0.6
13:28:35Zevvso how did 1.0.6 get through CI
13:29:19Zevvit's the new move in system.add[T](seq T, openArray T)
13:29:25Zevvor is it
13:31:53*gmaggior joined #nim
13:38:44*xace joined #nim
13:44:05*xace quit (Ping timeout: 240 seconds)
13:49:27*xace joined #nim
13:56:45PMunchUgh, implementing a stream for sockets is such a pain..
14:01:27*FromDiscord quit (Remote host closed the connection)
14:01:43*FromDiscord joined #nim
14:05:25disruptekno, expectIdent doesn't exist.
14:10:59FromDiscord<dom96> mratsim: tags != raises
14:11:29FromDiscord<dom96> also, you can say the same about `cast`
14:15:34FromDiscord<Vindaar> To me the difference would be that I'm aware that a `{.gcsafe.}` block is screaming "unsafe" and so does `cast`. The same (to my intuition) wouldn't apply to a `{.tags: [].}`
14:17:31FromDiscord<Rika> why would it not
14:17:47FromDiscord<Rika> its the same notation as gcsafe
14:18:55FromDiscord<Vindaar> because I'm not educated about it I guess?↵Oh, is that supposed to be a block as well? In my head I attached it to a proc, same as `raises`
14:19:24FromDiscord<Vindaar> if it's a block, ok. At least that would make me stop and look up what it's supposed to do
14:19:27FromDiscord<Rika> thats what it said in the message
14:19:37PMunchWhat's weird about `gcsafe` is that it does different things in different contexts
14:19:49FromDiscord<Vindaar> oh I agree with that PMunch
14:19:59FromDiscord<Vindaar> @Rika in what message?
14:20:22FromDiscord<Vindaar> oh, you mean that was what dom meant by adding the colon at the end? yes, possibl
14:20:32PMunchPlace it as a pragma on a procedure and that procedure will be checked and guaranteed to be GC-safe. However put it as a block statement and it now does the opposite, allows you to do GC-unsafe things without a check
14:21:18disrupteksilly.
14:21:21Araqyeah, that has been said elsewhere too and we can change it to
14:21:31Araq.assumeGcSafe
14:21:41FromDiscord<Vindaar> I'd +1 that
14:21:44FromDiscord<alehander42> disruptek
14:21:45PMunchSame
14:21:48Araqor maybe something else that screams "I know what I'm doing"
14:21:57Araqsuggestions are welcome
14:22:29disruptekjust make it a warning that we can push off.
14:22:43disruptekthat's a senantic everyone knows how to use.
14:22:55FromDiscord<lqdev> {.pleaseNimCompilerISwearIKnowWhatIAmDoing.}
14:23:26FromDiscord<Vindaar> {.pleaseNimCompilerISwearIKnowWhatIAmDoingExceptIReallyDontAndPrayMyCodeStillRuns.} you mean?
14:23:27disruptekas the compiler gets smarter, it will warn less.
14:23:33FromDiscord<lqdev> or perhaps {.dontBullyMe.}
14:23:42Araq.stopPokingMe
14:23:51FromDiscord<Rika> gcunsafe
14:23:53FromDiscord<Rika> lol
14:23:54Prestige+1 for dontBullyMe
14:24:37Araq.enforceGcSafe
14:24:40Araq?
14:24:49Araqkeep in mind we have the same now for .noSideEffect
14:25:07Araq.enforceNoSideEffect is quite a pragma name :-/
14:25:33FromDiscord<Rika> what about force instead of enforce
14:25:42Araqmaybe if we remove the vowels, nfrcnsdffct
14:25:49Prestigelol
14:25:58Araqnow that's something for unix
14:26:12Prestigeonly keep the vowels Araq
14:28:28FromDiscord<lqdev> eoeoiee
14:31:54AraqforceGcSafe ?
14:33:47FromDiscord<dom96> Huh? You want to make it unenforced by default?
14:33:50*evanj joined #nim
14:34:03Araqno, I'm talking about giving the override *blocks* better names
14:34:09FromDiscord<dom96> oh lol
14:34:35FromDiscord<dom96> I guess that can work
14:34:37Araqmaybe we should make it a general mechanism
14:34:50Araq{.enforce: gcsafe, noSideEffect.}: ...
14:34:50FromDiscord<dom96> yeah
14:35:03FromDiscord<dom96> {.forcePush.}?
14:35:14FromDiscord<dom96> or just `force` really
14:35:38FromDiscord<dom96> good word, it implies lack of safety
14:35:43Araqbut 'enforce' cannot be mistaken for a noun
14:35:44FromDiscord<dom96> or maybe `ignore`?
14:35:55FromDiscord<dom96> {.ignore: gcsafe.}
14:35:58Araq(I'm also not talking about 'push')
14:36:05FromDiscord<Rika> ignore is good
14:36:15Prestigethat looks good actually
14:36:27Araqdom96: add the colon so that I know we're talking about the same thing
14:36:45Araqonce again, I'm talking about {.gcsafe.}:
14:36:58FromDiscord<dom96> yes, the colon is implicit in all my messages
14:36:59Araqabout {.gcsafe.}: <block here>
14:37:02Araqok
14:37:13FromDiscord<dom96> {.ignore: gcsafe.}: myGlobalVar = 23
14:37:21Araqyeah
14:37:35AraqI like 'enforce' better than 'ignore' though
14:37:46Araqor maybe 'override'
14:37:52Araq{.override: gcsafe.}: ...
14:38:19Prestigedoes that just mean gcsafe doesn't apply?
14:38:33Araqit means "shut up, compiler"
14:38:50PrestigeI think ignore is more concise
14:39:09*skyler joined #nim
14:40:50Araqwell 'force' is even shorter but they are all acceptably short IMO
14:41:26Araqmaybe we should re-use 'cast' for grepping conveniences
14:41:40Araq{.cast: gcsafe}: global = 12
14:43:05FromDiscord<dom96> hmmm, not a bad idea
14:43:15FromDiscord<dom96> a keyword in a pragma may be weird though
14:45:07*krux02 joined #nim
14:46:10FromDiscord<dom96> I like the consistency though 🙂
14:46:27disruptekkinda makes sense.
14:46:39Araqwow, people agree
14:46:52Araqdoesn't happen that often for trivia
14:47:21disruptekgive it time; we'll find something wrong with it.
14:47:28*hnOsmium0001 joined #nim
14:47:39FromDiscord<Yardanico> Well, it makes sense - you're kind of casting a code block to enforce a pragma
14:47:54FromDiscord<Yardanico> The same as you add gcsafe to procs via casts
14:48:31Araqbefore we had these blocks, casting to a different proc type was common
14:48:39Araqso yeah, it makes lots of sense
14:48:42disruptekit puts the on/off spec into the pragma name, though.
14:49:07disrupteklike, it doesn't solve the problem here.
14:50:45Araq*shrug* we can always come up with 'ungcsafe', but I have no idea what 'cast: ungcsafe' means
14:51:03*xace quit (Quit: leaving)
14:51:24FromDiscord<dom96> Shouldn't it be: {.cast: [].} then? i.e casting to no pragmas
14:51:46disruptekwell, time for a new pragma then.
14:51:55FromDiscord<Rika> what if you only wanted to remove gcsafe but not tags
14:52:03FromDiscord<dom96> I suppose it will get annoying to always list the pragmas that you want a proc to have, when you may just want it to be gcsafe
14:52:07disruptekor, .uncast
14:52:16Prestigethat's what I liked about ignore @Rika
14:53:00Araq{.cast: tags: [].} :P
14:53:14FromDiscord<dom96> It looks like making the cast block consistent with the cast expression will turn it into something that is a little annoying to use
14:53:27Araq{.cast: tags: [], raises: [ValueError], gcsafe.}
14:53:40Araqor maybe
14:53:48Araq{.cast: (tags: [], raises: [ValueError], gcsafe).}
14:54:17FromDiscord<dom96> or `{.cast: {.tags: [], raises: [ValueError], gcsafe.}.}` 😛
14:54:27Araqor
14:54:43Araq{.cast: tags: [], cast: raises: [ValueError], cast: gcsafe.}
14:55:40FromDiscord<dom96> btw while we're doing this, can we also make it possible to have a way to exclude specific tags/exceptions rather than just giving an absolute list?
14:56:25Araqlike?
14:56:33FromDiscord<dom96> {.tags: [not IORead].} # statically ensures that IORead is not present in the tags for this proc (but any other tag is fine)
14:56:45Prestigeignore/exclude pragma?
14:57:03Prestigeor that, seems decent
14:58:38FromDiscord<Recruit_main707> can you pass an overriden method as a function pointer? the base method is always being called, (because it properly fits the argument `ref Root` rather than `ref Child` i guess)
14:59:00FromDiscord<dom96> I guess for exceptions it's tricky, since the compiler cannot guarantee that an `Exception` is not actually a more concrete `IOError` which I have excluded via `{.raises: [not IOError].}`
15:00:27Araqyep
15:00:38FromDiscord<dom96> you could be conservative here though
15:00:58FromDiscord<dom96> I would say that most use cases would involve that proc including a try catch that explicitly handles `IOError`
15:01:01Araqin my personal universe there is only .raises and .noraises and the exact exception types are not tracked
15:01:10Araqlike Swift does it
15:01:32Araqbut whenever I bring it up the world is gonna end with coarse grained exception tracking
15:01:33*mmohammadi98129 joined #nim
15:05:18FromDiscord<alehander42> cant we do that
15:05:19disruptekmaybe this should be tied to a specific scope.
15:05:21FromDiscord<alehander42> and see how well it works
15:05:47FromDiscord<alehander42> a bit more experimental lang-design in branches with +/- analysis
15:23:41*njoseph quit (Ping timeout: 272 seconds)
15:24:03*njoseph joined #nim
15:26:30*abm quit (Read error: Connection reset by peer)
15:35:09*abm joined #nim
15:41:23FromDiscord<alehander42> ok Araq
15:41:34FromDiscord<alehander42> if/elif/else should be more stable now
15:42:42FromDiscord<alehander42> i have cleanup to do, but basically whenever you have time take a look at the `nkIfStmt, nkIfExpr` case in `check`: if it's understandable , most of the stuff should be ok
15:42:43FromDiscord<alehander42> imo
15:44:26*qwertfisch quit (Quit: ZNC - http://znc.in)
15:45:09*qwertfisch joined #nim
15:49:44*Trustable joined #nim
15:49:49*skyler quit (Quit: WeeChat 2.9)
15:52:19*mmohammadi98129 quit (Quit: I quit (╯°□°)╯︵ ┻━┻)
15:53:24*mmohammadi9812 joined #nim
16:05:25FromDiscord<alehander42> ok `checkIf` *
16:05:52FromDiscord<alehander42> about the speed: i know, i'll optimized it tomorrow, trying to finish the feature fixes today
16:15:47*zedeus quit (Ping timeout: 240 seconds)
16:17:44*zedeus joined #nim
16:24:51*arecacea1 quit (Remote host closed the connection)
16:25:21*arecacea1 joined #nim
16:37:49FromDiscord<haxscramper> How hard it would be to write own static analyser for nim which would do some simple checks like detecting `a == a` (equal expressions on each side). Nothing really serious. And if it can be done which compiler modules I should look into for something like that? Aside from `parser` of course
16:38:19*PMunch quit (Quit: leaving)
16:40:22leorizeasts
16:40:59leorizemainly passes
16:41:09leorizefor static analysis you might want to compile the module
16:41:27leorizeso register a pass that runs after sem to get access to the typed ast
16:41:37leorizethen, uh, you got the ast now so do whatever :p
16:42:21leorizeyou should probably ask Araq though, I only have limited experience with this (from reading nimsuggest)
16:44:31FromDiscord<haxscramper> I will start with this one + I remembered that there is a `dust` - https://github.com/disruptek/dust/blob/master/dust.nim which should ba good starting example (probably, not sure about that though)
16:50:33*Jesin quit (Quit: Leaving)
16:50:50*buyfn joined #nim
16:58:23disruptekhaxscramper: the earlier dust commits are more "lean" while the later ones pull in more and more of the compiler.
16:59:40disruptekthe early ones seem more like what you want to look at.
17:00:02disruptekie. a custom pass.
17:01:03*a_chou joined #nim
17:10:01*nature joined #nim
17:18:12Zevvdisruptek: did you mean 1.0.6 or 1.2.6?
17:22:12*m4r35n357 joined #nim
17:23:02*m4r35n357 quit (Read error: Connection reset by peer)
17:23:25*m4r35n357 joined #nim
17:28:46*vicfred quit (Quit: Leaving)
17:31:35*def- quit (Quit: -)
17:33:12*buyfn quit (Quit: buyfn)
17:34:09*buyfn joined #nim
17:35:04*def- joined #nim
17:36:22*buyfn quit (Client Quit)
17:37:16*Jesin joined #nim
17:49:10*a_chou quit (Ping timeout: 246 seconds)
17:52:05*Northstrider[m] quit (Quit: killed)
17:57:48*a_chou joined #nim
18:00:43*tane joined #nim
18:00:44*Northstrider[m] joined #nim
18:06:37*apahl quit (Ping timeout: 260 seconds)
18:07:19*apahl joined #nim
18:08:25*neceve quit (Ping timeout: 246 seconds)
18:16:08FromDiscord<alehander42> a linter? 😮
18:16:22FromDiscord<alehander42> that would be interesting
18:33:22*vicfred joined #nim
18:34:00*xace joined #nim
18:41:46Araqinteresting, https://github.com/nim-lang/Nim/pull/15423/files
18:41:47disbot➥ 3Clean out WIP
18:41:53Araqdo we have an RFC that covers it?
18:55:35FromDiscord<XeroOl> is there a way to run a nimscript file with just a shebang, and not a file extension?
18:55:40*mmohammadi9812 quit (Ping timeout: 246 seconds)
18:55:58*a_chou quit (Remote host closed the connection)
18:56:56FromDiscord<haxscramper> You mean treating `.nim` file as nimscript?
18:57:06FromDiscord<XeroOl> I mean treating a file with no extension as nimscript
18:57:32FromDiscord<XeroOl> ie, on the command line, I want to type just the filename
18:57:43FromDiscord<haxscramper> Maybe `#!/usr/bin/env -S nim e`
18:58:44FromDiscord<haxscramper> Oh, no `Error: not a NimScript file: /tmp/test`. Adding `nims` fixes it
19:00:12FromDiscord<XeroOl> I was hoping I could use nim as a replacement to shell scripting
19:01:41FromDiscord<haxscramper> And `.nims` extension stops you from doing so?
19:01:57FromDiscord<XeroOl> well, I'm trying to write a script to put in my path
19:02:35FromDiscord<XeroOl> I guess I could just write it in nim, and then compile it into an executable lol
19:02:37FromDiscord<XeroOl> instead of nimscript
19:03:27FromDiscord<haxscramper> You can write `script.nims` and then just `ln -sf script.nims as-command`. And use `#!/usr/bin/env -S nim e` as shebang in script itself
19:04:15FromDiscord<haxscramper> And then use `as-command` in shell. This approach also allows you to switch nimscript for compiled version if you want
19:05:02FromDiscord<XeroOl> yeah, that's actaully a good way to do it
19:05:09FromDiscord<XeroOl> thank you very much
19:18:41natureAnybody has experience using nim on nixos ?
19:19:58FromDiscord<dayl1ght> sent a code paste, see https://play.nim-lang.org/#ix=2z4s
19:20:53FromDiscord<dayl1ght> the process gets stuck in the last line (`process.outputStream.readLine()`), and it also gets stuck if I call `process.hasData()`
19:21:17FromDiscord<dayl1ght> what is wrong with this snippet of code?
19:22:09FromDiscord<XeroOl> you should be reading from the inputstream and writing to the outputstream
19:22:35FromDiscord<XeroOl> wait, I'm being stupid, nevermind
19:23:28FromDiscord<dayl1ght> oh maybe I'm missing a \n
19:23:46FromDiscord<dayl1ght> ok that wasn't the problem
19:25:07FromDiscord<haxscramper> I had similar problem with `inputStream()` where I had to call `.close()` manually, otherwise it would get stuck
19:25:29FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2z4u
19:27:12FromDiscord<dayl1ght> `pid` is a `Process` instance in your snippet, correct?
19:27:21FromDiscord<haxscramper> Yes
19:27:53FromDiscord<dayl1ght> I tried that and it's not stuck anymore, but I get a `unhandled exception: cannot read from stream [IOError]` when trying to read from outputStream after closing inputStream
19:28:20FromDiscord<haxscramper> https://play.nim-lang.org/#ix=2z4w
19:30:01FromDiscord<haxscramper> Although I'm not sure about `{poEvalCommand, poUsePath, poEchoCmd}` part - I use just `{poEvalCommand}`
19:30:29FromDiscord<dayl1ght> Thanks for that, I'll try it out
19:30:53FromDiscord<dayl1ght> I might have to change it a bit because I want to send to stdin and read from stdout in sequence multiple times (while keeping the process open)
19:52:08FromDiscord<haxscramper> I had some progress with passes, but now I'm completely stuck on how to supply path to nim stdlib. The code - https://gist.github.com/haxscramper/8821819221b1d73866e4aed306147f0c , using `compiler/1.2.6` and it fails with `Error: cannot open '/mnt/workspace/github/hax-nim/hack-test/system.nim'` - tries to search for `system.nim` in the same directory as project.
19:53:19FromDiscord<Elegant Beef> Nature i know ldlework has but no clue if they're going to get this message 😄
19:59:44FromDiscord<shashlick> @haxscramper how do you tell it where the compiler is
20:00:49FromDiscord<haxscramper> I should? Probably with `findExe "nim"`
20:02:05FromDiscord<haxscramper> And I also found `ConfigREf.libpath` which is used in `modules.compileSystemModule`
20:04:25*narimiran quit (Ping timeout: 240 seconds)
20:06:14FromDiscord<haxscramper> Yes, now It fails with `.choosenim/toolchains/nim-1.2.6/lib/system.nim(275, 25) Error: invalid pragma: unchecked`
20:21:50*dv-^_^6 joined #nim
20:29:50FromDiscord<alehander42> all
20:29:53*Vladar quit (Quit: Leaving)
20:29:55FromDiscord<alehander42> static values are calculated
20:30:00FromDiscord<alehander42> before end of sempass2 right?
20:36:31Araqright
20:36:49FromDiscord<alehander42> awesome
20:37:45FromDiscord<alehander42> so my last plan for now is to just support collection[<static value>] for now: one can always add additional logic later
20:43:43FromDiscord<alehander42> cool, this sem .. to work
20:45:13*solitudesf- quit (Ping timeout: 264 seconds)
20:45:26*solitudesf joined #nim
20:53:08FromDiscord<shashlick> @haxscramper use `--path:$nim`?
20:55:14FromDiscord<haxscramper> @shashlick Yes, I already figured it out with `.libpath` - not I'm trying to figure out why it cannot open ` Error: cannot open file: system/fatal`. I updated the gist
20:56:08FromDiscord<haxscramper> now*
20:56:09FromDiscord<shashlick> Your command line seems more relevant
20:56:53FromDiscord<haxscramper> I don't pass cmdline arguments right now
20:57:14FromDiscord<shashlick> Like you are using the wrong lib dir with the wrong compiler version
20:57:21FromDiscord<shashlick> Your cfg file then
20:59:18Araqhaxscramper: simply use a github clone and use it for everything
20:59:35Araqit's what I do, no need for choosenim, no multiple outdated stdlib dirs
20:59:39Araqworks
21:00:17FromDiscord<alehander42> Araq should i add
21:00:23FromDiscord<alehander42> tests for known false positives
21:00:34Araqlike?
21:01:07FromDiscord<alehander42> e.g. `a[b].field # warning here` even if its possible to improve the analysis one day
21:01:17FromDiscord<alehander42> so `a[b].field # no warning` one day
21:06:36Araqyeah, add these
21:06:41FromDiscord<haxscramper> Araq: the same error - cloned Nim & compiled with devel version
21:07:15Araqhow can it still fail with
21:07:16Araq`.choosenim/toolchains/nim-1.2.6/lib/system.nim(275, 25)
21:07:25Araqwhen you don't have choosenim anymore? :P
21:08:11FromDiscord<haxscramper> Well, yes `/mnt/workspace/github/hax-nim/hack-test/pass/here/lib/system/assertions.nim(2, 11) Error: cannot open file: system/fatal` - it pointed it to cloned nim. The only thing different is the path for `assertions.nim`
21:11:30Araqwell maybe you need a system/fatal.nim file
21:18:20FromDiscord<alehander42> ok, night night
21:18:33FromDiscord<alehander42> tomorrow i should wake up at ~6:45
21:19:16FromDiscord<alehander42> Araq ok, i've added the tests and impl
21:19:18FromDiscord<alehander42> for brackets
21:19:19FromDiscord<alehander42> for now
21:19:47FromDiscord<dayl1ght> `process.outputStream.hasData` gets stuck (i.e. never returns) when there's no data to read from the stdout of a process started with `startProcess`
21:19:53FromDiscord<dayl1ght> isn't it supposed to return false?
21:24:29FromDiscord<dayl1ght> oops I meant process.hasData
21:26:53FromDiscord<dayl1ght> https://play.nim-lang.org/#ix=2z5f this reproduces the issue
21:39:14Araqmeh, iirc, interprocess communication is inherently prone to deadlocks
21:39:19FromDiscord<dayl1ght> ok so I think this is the problem
21:39:20FromDiscord<dayl1ght> https://github.com/nim-lang/Nim/blob/version-1-2/lib/pure/osproc.nim#L1376
21:39:27FromDiscord<dayl1ght> shouldn't the last argument to select be a timeout of zero?
21:39:45FromDiscord<dayl1ght> from the manpage of select(2):
21:39:51FromDiscord<dayl1ght> sent a code paste, see https://play.nim-lang.org/#ix=2z5j
21:40:06Araqcreate a PR
21:40:15FromDiscord<dayl1ght> cool, I can do that
21:40:19FromDiscord<dayl1ght> do you think this should be configurable?
21:40:27FromDiscord<dayl1ght> i.e. add a new optional timeout parameter to hasData
21:40:55*solitudesf quit (Remote host closed the connection)
21:41:00AraqI don't know but also see the git history, we didn't always use 'select' for this
21:41:44*Trustable quit (Remote host closed the connection)
21:41:56*tane quit (Quit: Leaving)
21:42:47*solitudesf joined #nim
21:43:19FromDiscord<dayl1ght> ok! I'll work on the PR later today
21:43:41Araqty
21:43:53FromDiscord<dayl1ght> ideally I can also add a test to prevent this from coming up again, but I'm not sure on the best way to do that (i.e. assert that hasData returns in less than n seconds)
21:44:53FromDiscord<dayl1ght> sent a code paste, see https://play.nim-lang.org/#ix=2z5m
22:12:35*nature quit (Ping timeout: 240 seconds)
22:32:38*solitudesf quit (Ping timeout: 260 seconds)
22:47:36FromGitter<ynfle> Any ideas for simple plotting libraries?
22:54:01*vqrs quit (Ping timeout: 246 seconds)
23:08:06FromDiscord<Vindaar> what do you mean? existing plotting libs in Nim?
23:08:22FromGitter<ynfle> yup
23:08:46FromGitter<ynfle> Found ggplot. The syntax seems easier than plotly for what I need
23:09:02FromDiscord<Vindaar> sent a long message, see http://ix.io/2z5J
23:09:06FromGitter<ynfle> (I think you made it so 👍 )
23:09:28FromGitter<ynfle> Yup
23:09:39FromDiscord<Vindaar> Aside from those 3 there's a wrapper for gnuplot somewhere and it's easy to interface with matplotlib using nimpy
23:10:49FromGitter<ynfle> Thanks sounds good I'll check them out tomorrow
23:10:55FromDiscord<Vindaar> in any case. Those 3 should cover most of your needs. If something is lacking, get in touch. plotly can be extended easily to support anything that plotly natively can do. Everything that isn't there, simply is missing because no one needed it so far
23:11:28FromDiscord<Vindaar> and extending ggplotnim is a bit of work of course, but I'll prioritize stuff people want
23:19:44*lritter joined #nim
23:20:20*vqrs joined #nim
23:21:07*sagax quit (Read error: Connection reset by peer)
23:23:09*arecacea1 quit (Remote host closed the connection)
23:23:33*arecacea1 joined #nim
23:36:00*gmaggior quit (Quit: Leaving)
23:45:34evanj /join #hare
23:45:39evanjfuck
23:45:56FromDiscord<Clyybber> :)
23:49:05*lbart quit (Ping timeout: 272 seconds)
23:53:06*lbart joined #nim
23:53:06*lbart quit (Changing host)
23:53:06*lbart joined #nim