<< 03-02-2019 >>

00:12:20oculuxwhich platform and setup are developers using for nim development? is there some sort of template like vagrant to bring up a ready development environment?
00:13:00oculuxi mean nimlang development - ie the platform and language itself
00:13:21shashlickfolks use Windows, Linux and OSX in the core dev team itself
00:13:49shashlickand work off of a git clone of the repo, but there's packages posted online for each OS if preferred
00:19:07oculuxto your knowledge are there "works on my machine" type issues at all?
00:19:30oculuxi'd like to get a setup that is as close to core devs as possible to minimise issues
00:20:58oculuxafter my time crypto mining I have two machines now ready to serve me in my next projects - hopefully with much nim
00:23:13shashlickno i've personally had minimal such issues
00:23:30shashlickthere's elaborate testing and regression done across OS to ensure reliability
00:26:09shashlickwhat OS are you working on
00:42:10*Sentreen quit (Ping timeout: 244 seconds)
00:57:48*xace quit (Read error: Connection reset by peer)
00:57:57*xace_ joined #nim
01:09:17*zachk quit (Quit: Leaving)
01:09:45*a__b__m joined #nim
01:13:18*a_b_m quit (Ping timeout: 250 seconds)
01:13:46*Marumoto quit (Remote host closed the connection)
01:15:52*a_b_m joined #nim
01:17:14*abm joined #nim
01:19:27*a__b__m quit (Ping timeout: 240 seconds)
01:20:14*a_b_m quit (Ping timeout: 250 seconds)
01:43:56*a_b_m joined #nim
01:46:26*abm quit (Ping timeout: 240 seconds)
02:01:44*Cthalupa quit (Ping timeout: 244 seconds)
02:02:45*Cthalupa joined #nim
02:13:15*darithorn quit (Quit: Leaving)
02:27:00*ghost64 quit (Quit: See you!)
02:29:49*darithorn joined #nim
02:31:04*darithorn quit (Client Quit)
02:31:23*ghost64 joined #nim
02:35:57*darithorn joined #nim
02:43:29FromGitter<irskep> How can I check if an object is of a certain type, and cast it to that type if so?
02:43:41FromGitter<irskep> e.g. in swift it would be "let x = y as? Foo"
02:47:25FromGitter<irskep> Alternatively, can I enforce a generic parameter to be a descendent of a certain object type?
02:48:03FromGitter<irskep> another swift example being, "let myDict = Dictionary<String, Foo>()"
02:49:37FromGitter<irskep> I guess a better swift example would be "func doFooeyThing<T: Foo>(x: T) { x.foomethod() }"
02:51:41*plushie joined #nim
02:52:32FromDiscord_<exelotl> I really like the way kotlin does it https://kotlinlang.org/docs/reference/typecasts.html
02:54:57leorizeirskep: `proc doFooeyThing[T: Foo](x: T)`?
02:56:22leorizeand we don't have `as?`, but you can also do: `let x = if y is Foo: Foo(y)`
02:57:13leorizeif you found yourself using that a lot then you can make a `as?` template?
02:58:34*theelous3 joined #nim
03:02:24*banc quit (Quit: Bye)
03:05:37*seni quit (Quit: Leaving)
03:17:53plushieirkskep: maybe something like this https://gist.github.com/qxxxb/7dcdbf9497480be4c2e756951dab618d
03:23:07*banc joined #nim
03:25:31*darithorn quit (Quit: Leaving)
03:26:17*Tyresc quit (Quit: WeeChat 2.4-dev)
03:26:33FromGitter<irskep> Thanks, that all helps! Trying things...
03:36:41FromGitter<irskep> Well, I got something that compiles, but now I'm getting a segfault and can't remember how to get a traceback for it :-)
03:37:16leorizecompile without `-d:release` :)
03:39:01FromGitter<irskep> Not currently using that flag
03:39:35leorizetry `import segfaults` in your project then
03:39:42FromGitter<irskep> Oh huh, this might be a compiler rash
03:39:43leorizeit'll install an event handler
03:39:48leorizeoh
03:40:06leorizewhat version of the compiler are you on?
03:40:18FromGitter<irskep> 1) 19.2
03:41:44leorizecan you make a small snippet that can crash the compiler?
03:43:59FromGitter<irskep> Maybe when I climb a couple levels out of a yak shave
03:46:54leorizewell, what were you trying to do?
03:47:23leorizewe might be able to give you an alternative that won't crash :)
03:47:33FromGitter<irskep> at a super high level, an entity-component system
03:49:15FromGitter<irskep> Here's a base type for a System which stores Component descendant types in a critbit tree https://github.com/irskep/nimrl/blob/master/src/rules/ecs_base.nim
03:49:25FromGitter<irskep> I just pushed what I had so it doesn't compile at the moment :-)
03:49:54FromGitter<irskep> Here's a descendant type of System for a specific Component https://github.com/irskep/nimrl/blob/master/src/rules/ecs_actor.nim
03:50:26FromGitter<irskep> I think what I'm trying to do at the type level is a bit much for where nim is at with generics
03:52:11FromGitter<irskep> The specific thing I've been trying to achieve since I started talking in this channel is to get `proc set(system, entity, component)` to automatically set `component.entity = entity` because it knows its component parameter is a Component
03:55:38leorizeif you're using inheritance, you wouldn't need to use generics
03:56:06FromGitter<irskep> Each inherited System type is associated with a different Component type, so I think I do, if I don't want to copy-paste all the methods for each system
03:56:16leorizejust put Component as the type for the last parameter of `set`
03:56:32leorizewell, I'll try to debug your code
03:57:06FromGitter<irskep> I'll push up something that compiles then
03:57:53*a_b_m quit (Ping timeout: 246 seconds)
03:58:29leorizeso what's crashing?
03:58:52leorizeI see, ecs.nim is crashing
03:59:08FromGitter<irskep> I just pushed the problem I actually would like solved, at a high level, if that helps
03:59:18FromGitter<irskep> The compiler isn't crashing anymore
04:00:57leorizeand you should use the built-in `result` variable
04:01:17FromGitter<irskep> isn't that just a style choice?
04:01:36leorizenope, the `result` variable does some return value optimization
04:04:47leorizewell, `return val` is equal to `result = val; return`
04:04:55leorizebut using result directly avoids copying
04:05:18FromGitter<irskep> I'll remember that when I'm writing performance sensitive code :-)
04:06:34FromGitter<irskep> The thing I can't understand right now, is I have a type with a generic parameter, System[T], and an inherited type `ActorSystem = ref object of System[ActorComponent]`, and yet `proc get*T (system: System[T], entity: Entity): Option[T]` doesn't return an `ActorComponent` when called on an `ActorSystem`
04:07:29FromGitter<irskep> LOL - figured out my issue
04:07:52leorize`ActorSystem = System[ActorComponent]` would solves all of your problem :P
04:07:58FromGitter<irskep> get() returns an Option, so I have to call get() on it. πŸ€¦β€β™€οΈ
04:08:07FromGitter<irskep> I was doing precisely that already
04:08:20FromGitter<irskep> That's why I was so confused
04:08:30FromGitter<irskep> But I forgot that System.get(...) returned an Option[T], not a T
04:09:13leorize:)
04:09:18leorizehttps://nim-lang.github.io/Nim/nep1#introduction-naming-conventions
04:09:36leorize^ I'd recommend naming your functions based on that guide
04:09:56FromGitter<irskep> Which rule did I violate here?
04:10:03FromGitter<irskep> using get() instead of []?
04:10:03leorize`get()`
04:10:06leorizeyea :P
04:10:22leorizefor your use case `[]` seemed more appropriate
04:11:19FromGitter<irskep> Yeah, I'm still working through keeping nim in working memory
04:12:59leorizemaybe you should rename the `all` iterator to `items`
04:13:19leorizethat will let you do: `for i in System`
04:13:28FromGitter<irskep> Funny how Nim doesn't have "interfaces" but it does need things like that
04:13:53leorizenot really imo
04:14:43leorizewell, vtref was in development, but seemed like the idea was dropped
04:16:27FromGitter<irskep> thanks for your help and tips, btw
04:18:07leorizenp :)
04:19:10FromGitter<irskep> if you ever actually got my program building, I would be kind of amazed, since I haven't really tried to set it up for other people
04:23:23leorizenimterop head is not building for me atm, but that's not your fault :P
04:23:46FromGitter<irskep> I asked the maintainer to make tagged releases a while ago and the response was basically "...nah" :-)
04:24:18leorizeshashlick: ^
04:25:20FromGitter<irskep> I'd tell you the hash I'm using but I don't think nimble stores that
04:26:01leorizeyea, it doesn't :P
04:29:54*oculux quit (Quit: blah)
04:30:27leorizeirskep: and I don't think you'd need a Makefile?
04:30:39leorizeyou can just add a new task to nimble :)
04:33:17*a_b_m joined #nim
04:38:07FromGitter<irskep> Yeah my makefile is totally redundant, I don't use it anymore
04:38:27FromGitter<irskep> although it does handle the occasional situation where I already have an instance running and kills the old one form e
04:39:13FromGitter<irskep> I did try to "do it right" through the whole project, so in theory it shouldn't be hard to get building, but it for sure only works on macOS because I didn't include the static binary for raylib for windows or linux
04:39:25leorizeand you can write a task for nimble :)
04:41:24*plushie quit (Quit: WeeChat 1.9.1)
04:44:51*oculux joined #nim
04:45:11*oculux quit (Client Quit)
04:45:41*oculux joined #nim
04:54:44*a_b_m quit (Ping timeout: 250 seconds)
05:04:51shashlickWe will be tagging, it's early times that's all
05:05:20shashlickWhat issue you seeing leorize
05:07:13leorizehttp://ix.io/1zSp
05:10:06shashlickchecking
05:12:31shashlickwhat OS / nim version?
05:13:09leorizegit hash: 07553034de5bd9ffa89df303bf789664f9cb8ed8
05:13:26leorizei'm running gentoo
05:20:32shashlickjust tested with that hash - worked for me
05:20:38shashlickbut i'm on ubuntu
05:21:23leorizethis is my nimble hash: e60ab125494a231c6db3c7cd5122868a0d204b58
05:22:32shashlickseems like mkdir didn't work
05:25:05FromGitter<timotheecour> NIMBLE_DIR=$HOME/.nimble_fake6 nimble install nimterop
05:48:32shashlickfigured it out
05:48:57shashlickquoteShell causing trouble
05:49:33*leorize quit (Ping timeout: 252 seconds)
06:02:31shashlickpushed a fix leorize, please let me know if you still have an issue
06:22:29*vlad1777d joined #nim
06:30:01*gangstacat quit (Quit: Ĝis!)
06:51:59*gangstacat joined #nim
06:56:04*nsf joined #nim
07:20:27*leorize joined #nim
07:20:33*theelous3 quit (Ping timeout: 268 seconds)
07:39:40*narimiran joined #nim
08:00:00*gmpreussner quit (Quit: kthxbye)
08:04:36*gmpreussner joined #nim
08:06:08*Trustable joined #nim
08:35:02*Trustable quit (Remote host closed the connection)
08:43:30*nsf quit (Quit: WeeChat 2.3)
08:44:53*dddddd quit (Read error: Connection reset by peer)
08:53:14*NimBot joined #nim
09:46:28*regtools quit (Quit: leaving)
10:00:02*regtools joined #nim
10:21:08*lritter joined #nim
10:34:26*Cthalupa quit (Ping timeout: 240 seconds)
10:35:55*nsf joined #nim
10:36:35*Cthalupa joined #nim
10:41:23*kapil____ joined #nim
10:46:17*stefanos82 joined #nim
10:59:30*nutfan joined #nim
11:41:28*nutfan quit (Remote host closed the connection)
11:46:57*Sentreen joined #nim
11:48:33*Zevv quit (Quit: Lost terminal)
11:53:37*Zevv joined #nim
12:05:53FromGitter<Clyybber> I can't seem to find uptodate nim docker images
12:06:13FromGitter<Clyybber> Or is this up to date? https://github.com/status-im/nim-docker
13:04:56*aguspiza joined #nim
13:30:07*kapil____ quit (Quit: Connection closed for inactivity)
13:34:45*Vladar joined #nim
13:52:45*narimiran quit (Ping timeout: 268 seconds)
14:01:52*dddddd joined #nim
14:34:22FromGitter<couven92> Uhm... since we're at FOSDEM, I actually tried to compile Nim from source again... On Windows, using VCC it still fails... -.- ⏎ `msgs.nim(85, 39) Error: ambiguous call; both tables. (t: var Table[[].A, [].B], key: A)[declared in ..\lib\pure\collections\tables.nim(372, 6)] and tables. (t: Table[[].A, [].B], key: A)[declared in ..\lib\pure\collections\tables.nim(349, 6)] match for: (Table[system.string,
14:34:23FromGitter... lineinfos.FileIndex], string)`
14:35:15FromGitter<couven92> https://github.com/nim-lang/Nim/issues/6229
15:06:13*a_b_m joined #nim
15:17:03*narimiran joined #nim
15:27:30FromDiscord_<exelotl> Here's my weird poor-man's coroutines/async/await library https://github.com/exelotl/ecolo
15:47:46*vlad1777d quit (Ping timeout: 250 seconds)
16:21:03*Marshallazora joined #nim
16:21:11*Marshallazora left #nim (#nim)
16:33:08*vlad1777d joined #nim
16:52:01*hoijui joined #nim
16:52:13shashlick@exelotl: nice - will check out
17:05:24*so quit (Ping timeout: 246 seconds)
17:10:11*so joined #nim
17:16:35*Vladar quit (Remote host closed the connection)
17:18:20FromDiscord_<exelotl> it's pretty barebones but it's exactly the machinery I need to get nice dialog/cutscene scripting in my gameboy advance game
17:38:04shashlickDo you need nimrtl.dll when using a Nim dll from a Nim program?
17:55:11ZevvI believe you do
18:00:04shashlickthanks - I guess i'll run into some crash once I start allocating/deallocating stuff in the plugin
18:17:14*hoijui quit (Remote host closed the connection)
18:23:37*kobi7 joined #nim
18:24:33kobi7Hello, I am facing an issue with a library I'm using. "Error: can raise an unlisted exception:" but then there is nothing afterwards.
18:24:54*Tyresc joined #nim
18:25:32kobi7if I remove the exception types in the raises pragma, it tells me of two types missing. but when I add them, I get the above msg
18:25:53kobi7not sure if it's a bug in the compiler
18:27:00kobi7but anyway it prevents compilation, and there is no hint if I did something to trigger it, because it didn't happen previously
18:31:51shashlicksnippet might help
18:32:05shashlickbut one of the procs you are calling is raising an exception not in your list
18:32:17shashlickso it isn't just the exceptions you raise but those of your callees too
18:33:18kobi7so only within the relevant proc, right?
18:33:42kobi7"underneath" the raises pragma
18:35:11kobi7shashlick: but why doesn't it mention the name of the exception if it can find something?
18:35:33kobi7I will try to make a small testcase
18:37:16shashlicki thought it did, but don't have detailed understanding onit
18:39:25kobi7can I msg you privately for you to try on your computer?
18:40:36*Ven`` joined #nim
18:41:07*lritter quit (Ping timeout: 240 seconds)
18:42:07kobi7basically nimble install yaml, then make a domain object, and a corresponding yaml file. then do: var fs = newFileStream(yamlFile) ; var x:YourDomainType and use the load* proc, load(fs, x)
18:42:54kobi7I get: /home/kobi7/.nimble/pkgs/yaml-#head/yaml/serialization.nim(159, 15) template/generic instantiation from here
18:43:02kobi7 /home/kobi7/.nimble/pkgs/yaml-#head/yaml/serialization.nim(146, 33) Error: can raise an unlisted exception:
18:44:32kobi7removing an exception type from the raises pragma (one that it raises) will tell me which exception. but adding it back and it still fails to compile.
18:50:11shashlickthat is a bug with yaml then
18:52:56shashlickbest to post here since others can also help
18:53:43shashlickwhat version of nim are you using
18:56:30kobi7latest nim
18:56:33*Vladar joined #nim
18:56:59kobi7Compiled at 2019-02-02
18:58:28kobi7I thought that since Nim is statically typed, the libs get checked, and there is no issue of sometimes triggering lib code that doesn't compile.
18:59:12shashlickit is checking the lib that's why you are seeing the errr
18:59:50kobi7will it error if I just import the lib but not use it?
19:00:51shashlicki think so
19:02:07kobi7I mean, it worked before, but I changed the format a little, and it fails now. it tries to build an object from the yaml, like a parser would
19:02:15kobi7maybe it's some template magic.
19:03:08kobi7the issue is that the compiler error message is not useful
19:03:50kobi7well, I'll work on something else, til I think straight :)
19:16:55*junland_ quit (Quit: Disconnected.)
19:17:38*junland joined #nim
19:19:13*kobi7 quit (Quit: Leaving)
19:35:25*vendethiel- joined #nim
19:37:08*Ven`` quit (Ping timeout: 245 seconds)
19:43:27*aguspiza quit (Ping timeout: 240 seconds)
19:52:09*vlad1777d quit (Remote host closed the connection)
19:53:15*vlad1777d joined #nim
19:56:27*nsf quit (Quit: WeeChat 2.3)
20:31:16*aguspiza joined #nim
21:03:38*theelous3 joined #nim
21:16:39*theelous3 quit (Remote host closed the connection)
21:19:06*Snircle joined #nim
21:27:14*aguspiza quit (Ping timeout: 268 seconds)
21:37:28*vendethiel- quit (Ping timeout: 246 seconds)
21:44:47*a__b__m joined #nim
21:48:05*leb joined #nim
21:48:44*a_b_m quit (Ping timeout: 250 seconds)
21:52:31FromGitter<MisterBianco> I would like to use syntax like:
21:52:54FromGitter<MisterBianco> ``````
21:53:20FromGitter<MisterBianco> If var: echo var
21:53:40FromGitter<MisterBianco> Is there a way to test "truthiness" of a variable?
21:55:04narimiranwhat is var? int?
21:56:34narimiranyou can use converters (https://nim-lang.github.io/Nim/manual.html#converters), but it might be better to be explicit
21:57:10FromGitter<MisterBianco> That looks good, can you explain the explicit comment?
21:58:20narimiran[m]expicit: 'if int > 0', implicit: 'if int'
22:01:18*narimiran quit (Ping timeout: 245 seconds)
22:05:55*a_b_m joined #nim
22:09:12*a__b__m quit (Ping timeout: 246 seconds)
22:13:05*Vladar quit (Remote host closed the connection)
22:14:50FromDiscord_<juan_carlos> var x = (try: 2 finally: echo 2)
22:15:15FromDiscord_<juan_carlos> It echo the variable if Ok, get the error if error. That for debug only.
22:17:32FromDiscord_<juan_carlos> var o = (try: 2 finally: echo"Variable is OK")
22:42:45FromGitter<riddl_gitlab> Hi again, short question. Is `[]` the only way to dereference a c pointer?
22:53:08Tyreschi, I am trying to display a 32 bit integer in binary form, right now I am using fmt"{int:#b}" to convert it but I am not getting the expected length any ideas?
23:15:10*leb__ joined #nim
23:15:15*leb quit (Read error: Connection reset by peer)
23:19:36FromGitter<riddl_gitlab> https://glot.io/snippets/f95p5tcbx0 ⏎ why for statement doesnt work with uints
23:57:10*vlad1777d quit (Ping timeout: 272 seconds)