<< 28-09-2018 >>

00:04:45*renard_19 joined #nim
00:05:31*renard_19 quit (Remote host closed the connection)
00:08:16FromGitter<gogolxdong> what's the loading path of windows dll? I put SDL2.dll under the same directory with executable , could not load: SDL2.dll
00:08:44*gangstacat joined #nim
00:10:34*zzzeek4 joined #nim
00:12:44*darithorn quit (Quit: Konversation terminated!)
00:14:33*zzzeek4 quit (Remote host closed the connection)
00:19:59*skellock joined #nim
00:21:45*stefanos82 quit (Quit: Quitting for now...)
00:23:44*n0vafacing joined #nim
00:23:46*n0vafacing quit (Remote host closed the connection)
00:28:51FromDiscord<exelotl> dom96: hey, I can't post on the forums because I need to confirm my email, but the confirm link expired very quickly and there is no way to get another one.
00:46:17FromGitter<adam-r-kowalski> How come this won’t compile? ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ But I thought with concept refinement it should choose the most specific concept? [https://gitter.im/nim-lang/Nim?at=5bad79d94d320a463b050b38]
00:49:47Nolan[m]If I'm using importc to call a C function, what should the Nim proc's return type be if the C function returns `void *`?
00:57:36Nolan[m]Ah, looks like `pointer`.
01:05:24*smt joined #nim
01:05:43*smt quit (Max SendQ exceeded)
01:06:09*smt joined #nim
01:12:05*jokester12 joined #nim
01:12:23*jokester12 quit (Remote host closed the connection)
01:25:58*vostok428 joined #nim
01:26:36*vostok428 quit (Killed (Sigyn (Spam is off topic on freenode.)))
01:33:36*Aryton joined #nim
01:34:03*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
01:38:17*Aryton quit (Client Quit)
01:47:26AlexMaxHrm
01:47:34AlexMaxthis converted function wants a cStringArray
01:48:01AlexMaxis there any reason why I can't cast an array[5, cstring]?
01:50:54AlexMaxalso why can't I get the address of a const variable? Surely everything except temporaries have addresses?
01:53:17*vlad1777d quit (Ping timeout: 252 seconds)
01:53:24*lundibundi joined #nim
01:57:58*lundibundi quit (Remote host closed the connection)
02:05:12*abm quit (Read error: Connection reset by peer)
02:21:43cavariuxAlexMax a const variable is parsed by the compiler
02:22:03cavariuxand a cStringArray is a pointer to a cstring you can cast it
02:22:29AlexMaxYeah, so whatever is assigned to the const variable ends up in the data segment no?
02:22:42AlexMaxthat's addressible
02:23:16cavariuxconst variables can be optimized by the compiler so generally they are more into place for modification at compile time not at runtime
02:23:50cavariuxit's an rvalue to put it like like a more c++ way
02:25:25*chamar joined #nim
02:25:48AlexMaxso what you're saying is that a const variable can be, as an optimization, expressed solely as an rvalue in the resulting C source?
02:26:23cavariuxyep, if you want something const that has an addr you can use a let and use unsafeAddr
02:26:32AlexMaxso I could say `const x = 4; foo(x)`
02:26:40AlexMaxand it would end up as `foo(4)`?
02:26:49cavariuxonly if foo can be runned at compile time
02:26:51AlexMaxwell, wait, that's a bad example
02:27:03AlexMaxsince that's a function call and rvalues don't even enter into it.
02:27:30AlexMaxcavariux: I'm basically trying to expose an array of C strings to a wrapped C function
02:27:36AlexMaxBut without "allocating" them
02:28:03AlexMaxAnd the wrapped C function demands a cStringArray
02:28:11cavariuxthe library that you are wrapping manages the memory for you?
02:28:22cavariuxof the strings
02:29:10AlexMaxNot really?
02:29:34AlexMaxIt's a proceedure that takse a const char **items, int count
02:29:44cavariuxyou can pass a ptr cstring to that
02:30:02cavariuxor a ptr to the first object of an array of cstrings
02:30:21AlexMaxAnd in the C version of the demo, it passes this to the function:
02:30:23AlexMaxstatic const char *weapons[] = {"Fist","Pistol","Shotgun","Plasma","BFG"};
02:30:45AlexMaxso basically, a constant array of c strings
02:30:55cavariuxI guess you could pass the ptr to the first object of a cstring array
02:31:02cavariuxand in the count pass the len of the array
02:33:09AlexMaxso, this, essentially
02:33:11AlexMaxhttps://paste.ee/p/idKDJ
02:33:34AlexMaxThere's no function for it, so I just want to make sure I'm not invoking zalgo by doing this
02:33:46cavariuxyep, I think that would work
02:35:41FromGitter<kdheepak> Hi all. If I have a type that has multiple fields, and I want to initialize defaults for all but one, how can I go about doing that?
02:36:02leorize`var a: SomeType`
02:36:16leorizewill initialize all of them, ...
02:36:26leorizeWhat exactly do you want to do?
02:36:52cavariux`var a: YourType
02:36:52cavariuxa.oneIwant = whatever`
02:36:52cavariuxremember that nim doesn't have constructors
02:37:25leorizeor even `var a = YourType(whatIwant: value)`
02:40:12FromGitter<kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bad948c01fb5f4ae1335b77]
02:40:31FromGitter<kdheepak> If nim doesn't have constructors, then I think what I'm asking is not possible?
02:41:38leorizemake a proc called `newAnimal(s: string)`
02:41:44leorizethat returns an Animal
02:42:14*skellock quit (Quit: WeeChat 1.9.1)
02:42:26leorizethen you initialize your var with `var d = newAnimal("dog")`
02:42:49FromGitter<kdheepak> Got it. Presumably I can have multiple procs called `newAnimal`, right?
02:42:58FromGitter<kdheepak> As different "constructors"
02:43:19leorizeyes, proc overload will help you with that
02:43:44cavariuxAlexMax I just tested it and it worked
02:43:52leorizebtw, if it only creates object on the stack then name it `initAnimal()`
02:44:02leorizeSee https://nim-lang.org/docs/nep1.html for API naming convention
02:44:28FromGitter<kdheepak> Thank you!
02:46:31FromDiscord<Shield> after 3 hours of sleep I solved a problem I spent a full day on
02:54:46*dddddd quit (Read error: Connection reset by peer)
03:00:35AlexMaxcavariux: Thanks.
03:07:32shashlickI don't get it - exact same environment for c2nim works on my Windows laptop but fails to convert a file on appveyor
03:09:39*o123hallo22 joined #nim
03:17:18*o123hallo22 quit (Ping timeout: 268 seconds)
03:22:25*arecaceae quit (Remote host closed the connection)
03:22:43*arecaceae joined #nim
03:26:54*DEac-2 joined #nim
03:27:13FromGitter<7sDream> (https://files.gitter.im/nim-lang/Nim/J877/Xnip2018-09-28_11-26-41.jpg)
03:27:36FromGitter<7sDream> emmm, where is the nimpretty binary?
03:27:40*DEac-2 quit (Remote host closed the connection)
03:29:04leorizehave you built it?
03:30:07FromGitter<7sDream> I don’t know I need built it myself. It’s not a part of offical toolchain?
03:30:23FromGitter<7sDream> like nimsuggest
03:30:38leorizeare you on nim 0.19.0?
03:30:39FromDiscord<Shield> it seems that it's not automatically built
03:30:47FromGitter<7sDream> yes
03:30:49leorizeit should be a part. I've not checked though
03:30:57leorizeit's in Nim/nimpretty
03:33:33FromGitter<7sDream> Thx, will check it
03:34:21*chamar quit (Read error: Connection reset by peer)
03:50:05bozaloshtshso I updated to 0.19, and nimble to 0.9, and now it complains that it can't find the symbol 'task' in my nimble script
03:50:06*chemist69 quit (Ping timeout: 252 seconds)
03:50:14bozaloshtshit=nimble
03:50:38bozaloshtshseemed like an obvious fix, but import system.nimscript and permutations of that didn't do anything
03:51:50*chemist69 joined #nim
03:55:16dom96You probably have an old version of Nim hidden somewhere
03:56:25dom96or you're using an old nimble
03:56:34dom96Are you sure you're calling the 0.9 one?
03:56:48dom96As a workaround you can edit this file: https://github.com/nim-lang/Nim/blob/devel/lib/system/nimscript.nim#L322
04:03:51FromDiscord<Shield> is there a way to know the order of code executed using static
04:10:27bozaloshtshdom96: pretty sure. I pull from devel and compile manually so I doubt there's any old files sitting anywhere
04:10:42bozaloshtshnimble --version and nim --version both show up as latest
04:11:23bozaloshtshWas there any change that could even cause this? That's what I'm most confused about.
04:11:28dom96maybe try removing anything related to Nimble in /tmp
04:11:49dom96Shield: huh? Top to bottom?
04:13:03bozaloshtshremoved, same response
04:13:36bozaloshtshI'll try to reproduce in a clean env
04:15:11bozaloshtshok, I'm doing something stupid because it works with a clean environment
04:16:16bozaloshtshremoving the cache probably fixed it
04:18:43bozaloshtshnext question: from 0.18 to 0.19, I'm noticing that the map proc for seqs isn't dispatching correctly
04:19:07bozaloshtshit's calling the native `$` for my type even though I've defined a `$`. Is there some pragma I should define `$` with so that it's dispatched by map propeprly?
04:19:23bozaloshtshI'm reading through the changes but can't find anything related to this
04:25:16FromDiscord<Shield> is there a way to go around it? I have a function with a dynamic body that can be defined by adding more blocks to it, I'd like it if it takes all the blocks before actually constructing the function
04:26:32FromDiscord<Shield> I think the compiler can't guarantee the order of loading modules
04:27:23FromGitter<kayabaNerve> Why do objects have a `$` operator? I meant to ask.
04:28:08bozaloshtshkabayaNerve: not sure... now that you mention it I don't remember there being a default
04:28:41FromGitter<kayabaNerve> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5badadf9eba8e60bc65844c8]
04:28:46*nc-x joined #nim
04:29:21bozaloshtshit looks like (field1: val1, field2:val2, ...)
04:29:27FromGitter<kayabaNerve> Yeah
04:29:29FromGitter<kayabaNerve> That's the default
04:29:47bozaloshtshwhen was that added?
04:30:03FromGitter<kayabaNerve> I'm pretty sure it was introduced between 0.18 and 0.19. It prints each field and value. It annoys the hell out of me. I understand the debugging opportunities it offers but unless I define ``` `$`(y: x) ``` it shouldn't compile IMO
04:30:14FromGitter<kayabaNerve> If I want the debugging, I'll write the $.
04:30:21nc-xkayabaNerve: Well there *was* an RFC to remove default $ from objects.
04:30:23bozaloshtshit seriously screwed up my code, especially because map dispatches to the default instead of mine now
04:30:24nc-xhttps://github.com/nim-lang/Nim/issues/8023
04:30:44bozaloshtshcorrupted the state of my application hard, luckily I had a backup
04:32:25FromGitter<kayabaNerve> So it seems dom96 likes it but Araq agreed it should disappear. That said, the community like it.
04:32:35FromGitter<kayabaNerve> What if we forced it to be under a pragma/define?
04:33:13dom96bozaloshtsh: if you could figure out what caused that Nimble problem and report it on GitHub that would be a big help
04:33:18dom96Guessing others will run into this too :(
04:33:37nc-xi would have preferred it to be like Rust where you can print the debug representation but you need to provide pretty print yourself
04:35:27bozaloshtshdom96: I'll try. Perhaps a static message in nimble to remind the user to delete the cache is in order?
04:35:44dom96yep
04:36:38bozaloshtshok, now that I know that system.$ exists, how can I get map to resolve my $? I'm actually calling map FROM my $
04:38:03bozaloshtshbasically $(o: myobj) = o.listfield.map($) or base case
04:38:07bozaloshtshwhere o.listfield is seq[myobj]
04:38:27*nc-x quit (Ping timeout: 256 seconds)
04:39:12bozaloshtshI guess I could do mymodule.$ but I shouldn't have to cajole the compiler into calling the obvious function
04:39:54*nc-x joined #nim
04:40:38nc-xis your $ defined properly?
04:42:29bozaloshtshdefine properly.
04:42:48bozaloshtshproc `$`*(x: MyType): string {.inline, procvar.} =
04:44:03nc-xDoes mymodule.$ work? If yes, then try moving the $ to the file you are calling it from before you call $ (if it is not so already)
04:44:17FromGitter<kayabaNerve> I made a comment on a closed isssue and GitHub doesn't bump it up
04:44:19FromGitter<kayabaNerve> Damn ot
04:44:36FromGitter<kayabaNerve> dom96 Have a second?
04:45:33nc-xkayabaNerve https://github.com/nim-lang/Nim/issues?utf8=✓&q=sort%3Aupdated-desc+ shows it on the top
04:46:02FromGitter<kayabaNerve> Since you were in favor of system.$, mind reviewing my statement here: https://github.com/nim-lang/Nim/issues/8023
04:46:13bozaloshtshnc-x: mymodule.$ doesn't work, but $ is in the file I'm calling it from because it's recursive
04:46:28bozaloshtshmymodule.$ fails due to some type mismatch that I am currently reading
04:46:28FromGitter<kayabaNerve> Thanks nc-x
04:46:56nc-xbozaloshtsh: can you post the code in pastebin/ix/somewhere else
04:47:03bozaloshtshnc-x: I'm working on a minimum example
04:47:07bozaloshtshalso mapIt($it) works lol
04:47:30bozaloshtshIt's a bit weird because it requires recursive $ which means sum type
04:51:29*nc-x quit (Ping timeout: 256 seconds)
04:57:37leorizekayabaNerve: I think the discussion about $ for objects has been moved to https://github.com/nim-lang/Nim/issues/8149
05:03:53*miran joined #nim
05:03:56FromGitter<kayabaNerve> leorize: Posted there.
05:07:19*sagax joined #nim
05:08:07FromDiscord<Shield> https://github.com/golang/go/issues/26623
05:08:20FromDiscord<Shield> it's sad to see Nim missing from a benchmark
05:09:18cavariuxI truly wonder what is the difference between crystal and nim in terms of growth? what has crystal done better than nim in that aspect
05:11:24*nc-x joined #nim
05:11:48nc-xcrystal has many people of ruby background
05:12:14cavariuxnim would have many people of python and c background
05:12:31nc-xpython and c people have been resistant
05:12:51nc-xmany ruby people moved to crystal because it was too similar
05:13:28nc-xbut it is now biting their back though. because of their type inference, compilation is very slow.
05:13:52nc-xif they change to local type inference now. people will be angry. so they are stuck.
05:15:17nc-xbut anyways crystal is pretty good too. except that i am on windows and crystal is not
05:15:33cavariuxoh, isn't like more than 50% of developers on windows lol?
05:16:37nc-xnim needs projects with documentation and promotional websites.. Jester doesn't have one. Karax doesn't have one. I can't think of any project which has a promotional website.
05:17:00*leorize quit (Ping timeout: 252 seconds)
05:17:50*smt quit (Read error: Connection reset by peer)
05:17:55FromGitter<kayabaNerve> My project, not a lib, is building a site.
05:18:06FromDiscord<Shield> and libraries
05:18:08FromGitter<kayabaNerve> Turns out web devs are kinda hard to find.
05:18:29nc-xnim can have an advantage over crystal/rust if we get a dedicated developer for tooling - nimpretty/nimsuggest etc.
05:19:00nc-xbecause their alternatives to nimsuggest is pretty bad
05:19:20cavariuxtbh nim can beat by far go and rust
05:19:25FromGitter<gogolxdong> Is there any android or IOS development example?
05:19:28FromDiscord<Shield> I think Nim has the potential to go mainstream in gamedev, instead of starting with C and SDL/SFML nim was pretty smooth
05:19:34cavariuxsadly nim isn't backed up by a huge company
05:19:36nc-xrust's rls takes 5 seconds for me for even simple things like showing red error sqiggles
05:19:40FromGitter<gogolxdong> We might need native APP.
05:20:11nc-xI hope the new recruit can work on tooling
05:20:23FromGitter<gogolxdong> besides web.
05:20:41cavariuxShield exactly my thinking, nim is the most apropiate language for 90% of game dev projects except maybe bc tooling for AAA
05:22:55FromDiscord<Shield> weirdly enough godot's nim bindings are always up to date, but the way godot have it's weird, I got introduced to nim via a godot benchmark, then I went "why wouldn't I just use Nim without it?"
05:23:23cavariuxhaha good point, do you have a background in graphics programming?
05:24:55*nc-x quit (Ping timeout: 256 seconds)
05:24:57FromDiscord<Shield> only for 2d games
05:25:26*yuriwho21 joined #nim
05:27:26FromGitter<kayabaNerve> cavariux Status is one of the biggest Ethereum people.
05:27:40*yuriwho21 quit (Remote host closed the connection)
05:27:46FromGitter<kayabaNerve> *companies
05:27:55FromDiscord<Shield> just started learning about webdev
05:28:06cavariuxkayabaNerve yeah I guess but it starts slow and go has been backed up by google since the beginning and rust by mozilla
05:28:38cavariuxShield oh that's nice, are you using any nim libraries atm?
05:28:40FromDiscord<Shield> what do you think about mofuw?
05:28:45FromGitter<kayabaNerve> 108 Million dollars in one of the largest ICOs of all time.
05:30:02cavariuxoh well mofuw isn't actively in development I think
05:31:46FromDiscord<Shield> oh wow it got discontinued yesterday...
05:32:28FromDiscord<Shield> well, I couldn't use karakx when I had 0.18.0 but I guess it's usable after the update
05:36:10FromDiscord<Shield> I'd really appreciate if somebody updated the bindings for CSFML and the popular physics library
05:36:43*hoonetorg26 joined #nim
05:37:54*hoonetorg26 quit (K-Lined)
05:37:56FromDiscord<Shield> there's also Raylib which is easy to bind, i did it using c2nim
05:38:15FromDiscord<Shield> it'll be useful if it got added to nimble.directory
05:39:01*nsf joined #nim
05:39:01*RatRiot joined #nim
05:42:46*leorize joined #nim
05:44:34*RatRiot left #nim (#nim)
05:51:34*chemist69 quit (Ping timeout: 240 seconds)
05:51:43*rappet11 joined #nim
05:52:41*rappet11 quit (Remote host closed the connection)
05:52:57*chemist69 joined #nim
06:03:33*modrobert20 joined #nim
06:06:56*modrobert20 quit (Remote host closed the connection)
06:16:26*miran quit (Ping timeout: 260 seconds)
06:22:05*makii-42_ joined #nim
06:24:11*makii-42_ quit (Remote host closed the connection)
06:26:21FromGitter<kdheepak> How do you convert from a `char` to a `string` in Nim?
06:32:04FromDiscord<Shield> use $
06:35:39FromGitter<kdheepak> Is there a way to return a immutable object?
06:35:54FromGitter<kdheepak> Thanks @Shield
06:36:55*vlad1777d joined #nim
06:39:14FromGitter<codenoid> good night all
06:43:25leorizekdheepak: no, it's not possible to return an immutable object (yet)
06:43:45FromGitter<kdheepak> Thanks.
06:44:13FromGitter<kdheepak> If I set it to `let` and return it from a function, it is immutable only in the function scope?
06:44:34leorizewhat do you mean?
06:49:14FromGitter<kayabaNerve> leorize: have proc(): int. Have it `let a: 5; return a`. If I call the proc and set the result to X, is X mutable?
06:49:28leorizeyes
06:49:29FromGitter<kayabaNerve> I believe the answer is yes @kdheepak
06:49:49FromGitter<kayabaNerve> Yep Since they're not pointers, they copy the value.
06:49:58leorize`return a` is just -> `result = a; return result`
06:50:24FromGitter<kayabaNerve> That said @Quelklef built an awesome library to make sure object fields are only set oncw
06:50:37FromGitter<kayabaNerve> So you can create immutable object fields
06:50:45FromGitter<kayabaNerve> https://github.com/Quelklef/nim-finals
06:52:31FromGitter<kayabaNerve> I recommend only using `finalsd:` though. My app uses a ton of them and it cuts the performance 50%. Basically, define debug, make sure you don't find any runtime exceptions meaning you aren't treating the var as mutable, and then ship the final app in release.
06:53:19FromGitter<kayabaNerve> Eh. After I describe it, it seems much more limited in use case :/ I love it and use it in my project.
06:53:38FromGitter<kayabaNerve> I also just create a fricking ton of objects with it.
07:00:22FromGitter<narimiran> leorize: you don't have to `return result`, it is automatically returned at the end of your proc
07:01:02leorizeI know, was just trying explain `return <something>`
07:01:30leorizethat said, it should be `return` instead :P explain it the way I did create an infinite loop
07:06:37FromGitter<gogolxdong> Is the author of Reel Valley around?
07:15:26FromGitter<kdheepak> Is there a way to convert a string to a raw string?
07:19:31leorizewhat is a raw string?
07:19:47leorizethere is only `string`
07:19:47FromGitter<7sDream> raw bytes?
07:19:53FromGitter<kdheepak> https://nim-lang.org/docs/manual.html#lexical-analysis-generalized-raw-string-literals
07:20:12leorize`r"raw string here"`
07:20:14FromGitter<kdheepak> I have a character `\n`.
07:20:38leorizesee my msg above
07:20:56FromGitter<kdheepak> ```var c = '\n' ⏎ # TODO ⏎ echo c # should print `\n` and not `newline`.``` [https://gitter.im/nim-lang/Nim?at=5badd658aedb375b9c5bc9fc]
07:21:46FromGitter<kdheepak> @leorize, does that make sense? I know there's r"raw string" but how to do I use that for printing?
07:21:47FromGitter<narimiran> @kayabaNerve see if this helps: https://narimiran.github.io/nim-basics/#_special_characters
07:21:57leorize!eval echo '\\n'
07:21:58NimBotCompile failed: in.nim(1, 9) Error: missing final ' for character literal
07:22:18leorize!eval echo NimVersion
07:22:21NimBot0.18.0
07:22:23*apache216 joined #nim
07:22:33leorize!eval echo r"\n"
07:22:35NimBot\n
07:22:46FromGitter<narimiran> leorize: your single quotes are not the same character, it seems to me
07:22:59FromGitter<narimiran> !eval echo '\n'
07:23:01NimBot
07:23:04leorize!eval echo '\\n'
07:23:05*apache216 quit (Remote host closed the connection)
07:23:06NimBotCompile failed: in.nim(1, 9) Error: missing final ' for character literal
07:23:26leorizeis there some magic going on with my irc client?
07:23:28FromGitter<narimiran> again same thing. some autocorrect is happening on your end
07:24:01leorizeoh btw narimiran, my echo have 2 `\\`
07:24:17leorizelol it appears if you have those backticks
07:24:22FromGitter<narimiran> ooops, the above message with the link was not for @kayabaNerve but for @kdheepak
07:25:07FromGitter<kdheepak> @narimiran Thanks for the link. That almost answers it.
07:25:20FromGitter<kdheepak> I have the `var c = '\n'`
07:25:55FromGitter<kdheepak> Let's say I'm parsing a file, and store the character in `var c`.
07:26:06leorizeit's only a problem with literals
07:26:15leorizein variables it doesn't mean anything
07:26:21FromGitter<kdheepak> How do I then print it out without creating a new line?
07:27:13leorizeyou just print it
07:27:20leorizestdout.write
07:28:15leorize!eval var c = r"\n"; echo c
07:28:17NimBot\n
07:28:24leorizekdheepak: there
07:34:03FromGitter<kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5badd96bcdc5013172664ba7]
07:34:20FromGitter<mratsim> @Shield If you want to apply the transformation from a macro in another macro you need to use getAst
07:34:31FromGitter<kdheepak> @leorize does that question make sense?
07:35:06FromGitter<mratsim> @kdheepak someone asked the same the past week in the forum
07:35:27FromGitter<mratsim> use stdout.write or something like that
07:35:30FromGitter<kdheepak> I think the only way to do it is ⏎ ⏎ ```if c == '\n': ⏎ string_c = r"\n" ⏎ else: ⏎ string_c = $c ⏎ echo string_c``` [https://gitter.im/nim-lang/Nim?at=5badd9c2691dc567dbb6d29a]
07:35:31*Calinou joined #nim
07:35:40FromGitter<gogolxdong> Have you figured out why nim cpp faster than nim c?
07:35:43leorizekdheepak: so uh: `if c == '\n': continue?
07:35:44FromGitter<mratsim> no, don’t use echo
07:36:35FromGitter<kdheepak> I want to print out `\n` instead of a new line.
07:36:52FromGitter<mratsim> @kdheepak https://forum.nim-lang.org/t/4107
07:37:26FromGitter<mratsim> replace "\n" by “\\n"
07:37:30leorizekdhepakk: `r"hello\nworld"` ?
07:38:01FromGitter<mratsim> or “””Hello\nWorld””"
07:38:10FromGitter<mratsim> triple quote would escape everything
07:38:10FromGitter<kdheepak> @leorize I'm reading the string from a file, I can't change that.
07:38:27leorizeso yes, your way is correct, but don't use `echo` since it will add a newline
07:38:59FromGitter<kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5badda9353c31c1111787339]
07:39:49leorize!eval const s = "hello\nworld"; for i in s: if i == '\n': stdout.write r"\n" else: stdout.write c
07:39:50NimBotCompile failed: in.nim(1, 39) Error: complex statement requires indentation
07:40:07leorize!eval const s = "hello\nworld"; for i in s: (if i == '\n': stdout.write r"\n" else: stdout.write c)
07:40:08NimBotCompile failed: in.nim(1, 92) Error: undeclared identifier: 'c'
07:40:13leorize!eval const s = "hello\nworld"; for i in s: (if i == '\n': stdout.write r"\n" else: stdout.write i)
07:40:15NimBothello\nworld
07:40:34FromGitter<kdheepak> Yup! That's it!
07:41:02FromGitter<kdheepak> Now I have to do the same thing for tabs.
07:43:56FromGitter<mratsim> case tok of ‘\t’: stdout.write … of ‘\n’: stdout.write … else: ….
07:55:04FromGitter<narimiran> @kdheepak just to check: do you know you can iterate through a string directly? no need to use index (`for c in s: echo c`)
07:55:22FromGitter<kdheepak> Yes!
07:55:35FromGitter<kdheepak> Thanks for checking. I did discover that just recently haha.
07:57:16*Pharaoh_Atem10 joined #nim
08:01:02*Pharaoh_Atem10 quit (Remote host closed the connection)
08:03:42*gmpreussner joined #nim
08:04:37*gmpreussner_ quit (Ping timeout: 246 seconds)
08:09:06*tawr16 joined #nim
08:09:12*Calinou quit (Quit: http://quassel-irc.org - Discuter simplement. Partout.)
08:10:12*tawr16 quit (Remote host closed the connection)
08:16:09*PMunch joined #nim
08:19:06*Calinou joined #nim
08:19:30*Calinou quit (Remote host closed the connection)
08:30:04FromGitter<Bennyelg> Anyone familiar with nim html templating ? I am using the regular `? stdtmpl(subsChar = '$', metaChar = '#')` and i want to render the header just once for all of my pages
08:30:15FromGitter<Bennyelg> header is including all the js importing etc..
08:31:33Zevvhttps://github.com/drujensen/fib :)
08:39:43FromGitter<7sDream> I recently reread *Nim in Action* to regain my Nim skills, and found that many paragraphs were affected by the breaking changes of 0.19.0, especially the initial value changes of string and seq. Will we release a new version of this book too OvO? @dom96
08:40:17FromGitter<Bennyelg> Interesting Question, I guess a second edition is required
08:40:31FromGitter<7sDream> Or erratum page, at least
08:41:25FromGitter<7sDream> For the old readers who know the changes of 0.19, reading will not be difficult. But it is a bit unfriendly to new readers.
08:41:46FromGitter<7sDream> In particular, this is the only published book of Nim for now
08:42:05FromGitter<Bennyelg> Yea
08:43:15PMunchhttps://forum.nim-lang.org/t/3716
08:44:06PMunchZevv, yeah Nim is now fastest of the compiled static languages, and amongst the fastest in the optimized version :)
08:44:30PMunchBennyelg, not sure if I get what you mean
08:45:07*copelco__12 joined #nim
08:47:11*copelco__12 quit (Remote host closed the connection)
08:54:58*floppydh joined #nim
08:57:23FromGitter<mratsim> @7sDream, compile with -d:laxStrings it should revert to the old behaviour
08:58:24FromGitter<mratsim> but I’m surprised, the only thing that changed should be that there is no “isNil” proc anymore, and you don’t need to do `var fooStr = “”` or `var a = @[]`
08:59:21FromGitter<7sDream> > The nil state for strings/seqs is gone. Instead the default value for these is "" / @[]. Use --nilseqs:on for a transition period.
09:00:00FromGitter<7sDream> some code in *Nim in Action*:
09:00:07FromGitter<7sDream> ``````
09:00:17FromGitter<gogolxdong> Does fib benchmark mean we'd better compile Nim with cpp in production?
09:00:17FromGitter<7sDream> ```proc discarded: string = ⏎ discard "I will not be returned”``` [https://gitter.im/nim-lang/Nim?at=5badeda1fe377811100da851]
09:00:31*Jumpforce5 joined #nim
09:00:33FromGitter<7sDream> ```assert discarded() == nil```
09:00:45FromGitter<7sDream> will raise exception
09:00:47*leorize quit (Ping timeout: 240 seconds)
09:01:17Araqgogolxdong: yeah, probably
09:04:08FromGitter<gogolxdong> Got it, strange, nim cpp faster than nim c
09:04:25FromGitter<mratsim> I think it’s constant propagation
09:04:42*seni joined #nim
09:04:55FromGitter<mratsim> the C++ code makes it easier to propagate constants? Otherwise it’s the C++native exception handling
09:05:03*Jumpforce5 quit (Remote host closed the connection)
09:05:53FromGitter<mratsim> anyway I have an idea for a 0s bench.
09:06:08FromGitter<mratsim> just add static(fix(46)) :P
09:06:12FromGitter<mratsim> fib*
09:10:32*aramiscd25 joined #nim
09:11:25*TheLemonMan joined #nim
09:11:52TheLemonMan'grats everybody for this release
09:12:01FromGitter<mratsim> congrats to you
09:13:54*aramiscd25 quit (Remote host closed the connection)
09:16:04TheLemonManhey, I said that first!
09:16:32Araqyeah, you deserve special fame, TheLemonMan
09:18:45TheLemonManyou're far too kind, I just fix stuff (and break some other stuff)
09:19:16FromGitter<mratsim> static fibonacci was a false dream “interpretation requires too many iteration”, though the memoized version might work
09:21:57AraqTheLemonMan, but that's what we need the most, people who just fix stuff instead of messing around with macros/concepts/destructors :P
09:22:42FromGitter<mratsim> add generics and static to that list :P
09:23:02Araqand now that you've fixed so many bugs... what do you consider the worst part of Nim?
09:23:11FromGitter<mratsim> Aka we need Rob Pike? :P
09:24:03Araqmaybe we need a fixed Rob Pike who doesn't believe in pathetic stringly typed solutions.
09:24:12*fbred0 joined #nim
09:25:17FromGitter<mratsim> Nice quote about Go “simplicity”: https://news.ycombinator.com/item?id=16102260
09:26:45TheLemonManthe worst parts are (IMO) sigmatch (very complex & too many intertwined moving parts) and statics (you can really feel they've been bolted on the original type system)
09:26:51*a____ptr29 joined #nim
09:28:11*leorize joined #nim
09:28:15FromGitter<mratsim> What is sigmatch used for?
09:28:40*fbred0 quit (Remote host closed the connection)
09:30:43*a____ptr29 quit (Remote host closed the connection)
09:30:59Araqmratsim: Overloading resolution.
09:31:21FromGitter<mratsim> so it’s the cause of that? https://github.com/nim-lang/Nim/issues/9093
09:31:38Araqno.
09:32:32TheLemonManI'd say the root cause of that is the separation between procs and iterators
09:33:34FromGitter<mratsim> but during overloading resolution, the op body is not in a “for loop” context so it shouldn’t resolve to an iterator
09:35:11*jouni_28 joined #nim
09:35:24TheLemonMansince you're in type() the compiler doesn't care
09:39:34*jouni_28 quit (Remote host closed the connection)
09:41:06FromGitter<ephja> one step closer to working concepts https://gist.github.com/ephja/b613cb3b1e9d59e2e88032328a8b3628
09:43:38AraqI think we need a real 'typeof' proc that takes a parameter enum preferIter, preferProc
09:49:57FromGitter<mratsim> I’ve been using concept in Arraymancer to workarounds bugs in inheritance + Generics :D - https://github.com/mratsim/Arraymancer/pull/283/files#diff-98b751fdce8a137129df204fdd9ad971R62
09:50:20FromGitter<mratsim> in non-ref object inheritance*
09:50:24*Gogh4 joined #nim
09:50:47*Gogh4 quit (Remote host closed the connection)
09:50:54FromGitter<mratsim> I’m surprised you can even use block expression in concept with a for loop on the concept fields
09:50:56*dgurney4 joined #nim
09:53:27*Calinou joined #nim
09:53:51*dgurney4 quit (Remote host closed the connection)
09:55:49FromGitter<tim-st> maybe this is quicker with main proc? https://github.com/drujensen/fib/blob/master/fib_mem.nim
09:56:53FromGitter<mratsim> yeah, but for some reason author removed the main proc in the very first Nim PR: https://github.com/drujensen/fib/pull/8#issuecomment-399680340
09:56:57FromGitter<mratsim> i.e. bench needed
09:57:46FromGitter<tim-st> ok, I think nim should add an "unvisible" main proc if this improves performance and variable is local scope
09:58:12*tzui joined #nim
09:58:22cremWas something done for better destructor support recently (last year)?
09:59:07FromGitter<tim-st> @mratsim do you think that would be a good idea?
09:59:07leorizeyes, a lot recently
09:59:12*Calinou quit (Quit: http://quassel-irc.org - Discuter simplement. Partout.)
09:59:16cremIn 0.19?
09:59:27*Calinou joined #nim
09:59:52leorizetim-st: IIRC Araq once talk about doing automated transformation for that, but he said there were more serious bugs to fix
10:00:01FromGitter<mratsim> @tim-st, not sure, the main impact is the life-time of global variables, and triggering finalizers and destructors
10:00:16leorizecrem: yes
10:00:22FromGitter<tim-st> ok, thanks
10:00:22*tzui quit (Read error: Connection reset by peer)
10:00:34FromGitter<ephja> do futures have to allocate? :p
10:00:47cremleorize: cannot find anything related in changelog..
10:01:35leorizeit's better to look here https://github.com/nim-lang/Nim/commits/master
10:01:49*Calinou quit (Remote host closed the connection)
10:02:03*Calinou joined #nim
10:02:46*Calinou quit (Remote host closed the connection)
10:03:00*Calinou joined #nim
10:09:28*Calinou quit (Quit: http://quassel-irc.org - Discuter simplement. Partout.)
10:09:45*Calinou joined #nim
10:10:00*Calinou quit (Remote host closed the connection)
10:10:27*Calinou joined #nim
10:12:02*Calinou quit (Remote host closed the connection)
10:12:16*Calinou joined #nim
10:12:32FromGitter<mratsim> @ephja yes
10:12:50FromGitter<mratsim> closure iterators allocate and Future are built on top
10:15:28FromGitter<kaushalmodi> !eval const s = "hello\nworld"; for i in s: echo i.repr
10:15:30NimBot'h'↵'e'↵'l'↵'l'↵'o'↵'\10'↵'w'↵'o'↵'r'↵'l'↵'d'
10:16:02FromGitter<kaushalmodi> @kdheepak ^ Use `repr`
10:17:59FromGitter<kaushalmodi> !eval const s = "hello\n\tworld👋"; for i in s: echo i.repr
10:18:01NimBot'h'↵'e'↵'l'↵'l'↵'o'↵'\10'↵'\9'↵'w'↵'o'↵'r'↵'l'↵'d'↵'\240'↵'\159'↵'\145'↵'\139'
10:20:56FromGitter<kdheepak> Thanks @kaushalmodi that seems to print `\10`.
10:21:05FromGitter<kdheepak> I guess I'll have to make do with that.
10:25:21FromGitter<kaushalmodi> That's the ascii; time to recognize the ascii codes :)
10:26:43FromGitter<kaushalmodi> `man ascii`
10:27:12FromGitter<kaushalmodi> ^ that's the command to type in the terminal
10:27:14leorizethat wouldn't work if you're not on Linux :P
10:27:23FromGitter<kaushalmodi> He's on Mac
10:27:44FromGitter<kaushalmodi> For Windows users: http://man7.org/linux/man-pages/man7/ascii.7.html
10:27:50leorizeand Mac is not Linux
10:28:05leorizeIt's a part of Linux Programmer's Manual for a reason :P
10:28:13*FirstLoveLife joined #nim
10:28:54*FirstLoveLife quit (Client Quit)
10:29:07FromGitter<kaushalmodi> @kdheepak `repr` prints *\\DECIMAL_ASCII* for non-printable chars.
10:29:29FromGitter<kaushalmodi> And the decimal ascii of newline or linefeed(LF) is 10.
10:31:09FromGitter<kaushalmodi> leorize: touché I wouldn't have known.. I assumed macOS (derived from BSD, I guess) would include such critical mans
10:31:36FromGitter<zacharycarter> https://github.com/drujensen/fib#natively-compiled-statically-typed :D
10:31:38FromGitter<kdheepak> Thanks @kaushalmodi ! I'm aware of the ascii codes, I meant to say that I want it to be more user friendly, i.e. I want it to print `\n`
10:31:50FromGitter<kaushalmodi> Well then, if that doesn't work on Mac, use the url.
10:32:04FromGitter<kdheepak> (It's 4:30 am here :) excuse my brevity)
10:32:46FromGitter<kaushalmodi> @kdheepak at least you have multiple solutions now. :)
10:33:09FromGitter<zacharycarter> not that the benchmark is useful - but it's nice to see Nim on top
10:38:56*leorize quit (Ping timeout: 260 seconds)
10:41:16*Guest85232 joined #nim
10:42:29*Guest85232 quit (Remote host closed the connection)
10:43:20*fishwithapipe joined #nim
10:46:23*fishwithapipe quit (Remote host closed the connection)
10:49:21*elrood joined #nim
10:52:41*krux02 joined #nim
11:03:43*eft4 joined #nim
11:07:50*eft4 quit (Remote host closed the connection)
11:13:10*leru joined #nim
11:15:40*mwe1 joined #nim
11:16:08*TheLemonMan quit (Quit: "It's now safe to turn off your computer.")
11:19:49*Vladar joined #nim
11:20:29*mwe1 quit (Remote host closed the connection)
11:37:25*Eryn_1983_FL3 joined #nim
11:38:03*Eryn_1983_FL3 quit (Remote host closed the connection)
11:40:30*leru quit (Ping timeout: 268 seconds)
11:43:57FromGitter<narimiran> https://blog.rraghur.in/2018/09/27/fruzzy---a-freaky-fast-fuzzy-finder-for-vim/neovim/
11:45:15FromGitter<narimiran> btw, can anybody answer this question from reddit: "Does the old nullable `string` migrate to `ref string` then?"
11:49:21PMunchDepends on what you mean by migrate
11:49:48PMunchIf you want a string that can or can't be set you are recommended to use the options module and create an Option[string]
11:51:16*francisl joined #nim
11:52:41FromGitter<narimiran> PMunch https://old.reddit.com/r/programming/comments/9jdfwe/nim_version_0190_released/e6sacfo/ please write it here
11:52:50krux02is nimsuggest bundled with choosenim?
11:52:56*francisl quit (Client Quit)
11:54:03*jwilliams22 joined #nim
11:54:42*jwilliams22 quit (Killed (Sigyn (Spam is off topic on freenode.)))
11:55:07FromGitter<kayabaNerve> It builds Nim from source unless it can get binaries.
11:55:17FromGitter<kayabaNerve> So the question is if koch tools builds nimsuggest
11:55:37FromGitter<kayabaNerve> And if Nim's binary downloads ship it
12:01:37*leorize joined #nim
12:03:29FromGitter<kaushalmodi> What if we start going through the issues starting the oldest: https://github.com/nim-lang/Nim/issues?q=is%3Aissue+is%3Aopen+sort%3Acreated-asc
12:04:01FromGitter<kaushalmodi> I'd have to guess some of them would definitely have got fixed by now, or maybe inapplicable
12:04:16FromGitter<ephja> nah that's cheating :p
12:04:52FromGitter<kaushalmodi> Even folks without repo admin rights can at least comment whether they can still reproduce the issue, or it's already fixed, or doesn't apply.
12:05:04FromGitter<kaushalmodi> You don't need to be a Nim dev to do those.
12:05:54FromGitter<kaushalmodi> Let's set a conservative goal to close at least 5 issues a day!
12:07:51planetis[m]hey what is this error about? https://gist.github.com/b3liever/40b9a19345e22c1da6868b4e502a9d2d
12:16:28PMunchplanetis[m], might be the result value that's messing things up
12:16:33PMunchTry to use a regular return
12:17:20krux02PMunch, I had problems with the result variable sometimes being incorrectly shadowed with templates
12:17:21PMunchAnd an easier way would probably be to use quote do
12:17:49PMunchkrux02, yeah it's not great
12:18:21PMunchYeah, that seemed to solve the issue
12:18:52planetis[m]same error with a return
12:19:13*tzui joined #nim
12:19:34PMunchWhat? I just tried on my machine and got no error when I switched the result = on line 7 to a return
12:19:35krux02I am extremely happy that the nil state of seq and strings has been eleminated.
12:19:49*tzui left #nim (#nim)
12:19:50planetis[m]will fill some bug reports today
12:19:50krux02not sure if it has been eleminated internally as well
12:20:14planetis[m]oh this result
12:20:35planetis[m]yep works thanks
12:21:34planetis[m]I guess there is a bug report already for that?
12:23:59FromGitter<Yardanico> @zacharycarter you can ping me here/PM me on twitter when you will need twitch-irc bridge (in fact I can enable it right now if you want)
12:24:15PMunchplanetis[m], probably. I know Araq is aware of it at least
12:24:59krux02should nim get it's own twitch channel?
12:25:14FromGitter<kayabaNerve> What would it do
12:25:33FromGitter<kayabaNerve> I think both Ara_q and dom have their own stuff already
12:26:01krux02kayabaNerve do you try to not trigger him by putting an _ in the name
12:26:10krux02but nim is "style insensitive" :P
12:26:54FromGitter<kayabaNerve> Yeah. I'm polite
12:27:36FromGitter<kayabaNerve> dom has 96. BDFL is not the best known acronym. "A" is too ambiguous.
12:27:41FromGitter<kayabaNerve> Ara seems weird.
12:30:12FromGitter<kaushalmodi> Andreas?
12:30:44*masterm joined #nim
12:32:46FromGitter<bung87> is there a simple way to generate temp filename with random suffix?
12:38:43FromGitter<kayabaNerve> @bung87 ⏎ ⏎ ```for _ in 0 ..< 4: ⏎ name &= $char(65 + (random() mod 26))``` [https://gitter.im/nim-lang/Nim?at=5bae20d301fb5f4ae136e13f]
12:39:04FromGitter<kayabaNerve> That's what I can think of off the top of my head. ⏎ ⏎ You can also just get the time
12:41:33FromGitter<Yardanico> ```code paste, see link``` ⏎ ⏎ also you can use something like this (you can change alphabet for your liking) [https://gitter.im/nim-lang/Nim?at=5bae217deba8e60bc65b2a51]
12:41:40FromGitter<zacharycarter> @Yardanico that would be awesome - do you need any info from me?
12:42:13shashlick@kaushalmodi: that's what I've been doing with tissue
12:42:21shashlickChecking older issues are fixed
12:42:28shashlickMainly crashes though
12:42:30FromGitter<Yardanico> @zacharycarter nah, it would be good if you make "FromIRC" user a moderator on your channel (this is the twitch account I use for twitch relay) though
12:42:43FromGitter<bung87> @kayabaNerve thanks , the random take a int arg and deprecated.
12:42:45shashlickI wish more people used it, makes things super easy
12:42:49FromGitter<Yardanico> but it would work without that. your twitch channel is twitch.tv/zachary_carter right?
12:42:56FromGitter<Yardanico> @bung87 use `rand()` instead :)
12:43:20FromGitter<zacharycarter> @Yardanico - yup - I wil go ahead and do that
12:44:09FromGitter<kaushalmodi> shashlick: oh cool, I'll check it out. I have a feeling that I don't have the mettle to use that tool. I don't know any of the Nim internals (macros, etc).
12:44:10shashlickhttps://github.com/genotrance/tissue
12:44:33FromGitter<kaushalmodi> Yes, I know about it, just haven't found courage to use it.
12:44:41shashlickIt's a simple cli tool to download and run snippets
12:44:43*chpts joined #nim
12:44:47*SenasOzys quit (Ping timeout: 240 seconds)
12:44:55shashlickPost comments, builds test cases and creates PRs
12:45:03FromGitter<kaushalmodi> OK, will try it. 👍
12:45:04shashlickFor the lazy developers
12:45:16FromGitter<kaushalmodi> Wouldn't that be a security risk?
12:45:31FromGitter<bung87> @Yardanico I take your version, easier to read.
12:45:34FromGitter<kaushalmodi> When I run a code manually I review it before running
12:45:53FromGitter<kaushalmodi> Wouldn't tissue have the same hazard as `curl foo.sh | sh`?
12:45:53shashlickIt has an interactive mode
12:45:56FromGitter<Yardanico> @bung87 don't forget to run `randomize()` before doing any random stuff though
12:46:07shashlickDoesn't do anything automatically
12:46:12FromGitter<kaushalmodi> Cool
12:46:40FromGitter<kayabaNerve> @bung87 I actually haven't used random in a while. Sorry about that.
12:47:59*dddddd joined #nim
12:48:06FromGitter<bung87> @kayabaNerve no need sorry for that:)
12:48:09*chpts quit (Quit: leaving)
12:48:29*smt joined #nim
12:48:36*FromTwitch joined #nim
12:49:18shashlickbung87: how's nimfastText working for you
12:49:27*FromTwitch quit (Remote host closed the connection)
12:50:17FromGitter<Yardanico> @zacharycarter what do you think, we need to bridge your irc chat to #nim or to #nim-offtopic?
12:50:48FromGitter<bung87> still stuck in there, I thought may make a frozen version of cpp fasttext and manually modify the source.
12:51:15shashlickWhat's not working for you
12:51:16*SenasOzys joined #nim
12:51:39shashlickWould be great if you could help get the wrapper working
12:52:26FromGitter<bung87> or I get enough knowledge to convertting the std istream to nim stream object.
12:53:02shashlickI can try to help with that
12:53:41FromGitter<bung87> I have no idea even if I can read the cpp manual , how can I implements the istream in nim
12:54:13*stefanos82 joined #nim
12:54:34FromGitter<bung87> and let the cpp implements treat it as std istream.
12:55:19FromGitter<dom96> Recursive fibonacci benchmark using top languages on GitHub https://news.ycombinator.com/item?id=18091655
12:55:28FromGitter<dom96> Nim is on top :o
12:56:18FromGitter<bung87> yeah , that’s the last thing I can imagenation, unless there’s another unconverted type in cpp function calls
12:57:34FromGitter<zacharycarter> @Yardanico hrm
12:57:53FromGitter<zacharycarter> I think that's probably up to Araq / dom96
12:57:58FromGitter<zacharycarter> I'm fine with either
12:58:17FromGitter<zacharycarter> I'm still trying to figure out twitch - I tried creating an event twice, and both times it failed.
13:02:28*francisl joined #nim
13:03:36*drawkward10 joined #nim
13:05:39*drawkward10 quit (Remote host closed the connection)
13:07:37FromGitter<zacharycarter> @Yardanico - I have no idea how to add that user as a moderator - so I'm just going to wait until later today and try again
13:08:32FromGitter<Yardanico> @zacharycarter just write `/mod FromIRC` in your twitch channel's chat
13:09:04FromGitter<zacharycarter> good looks
13:09:35FromGitter<zacharycarter> done
13:09:39FromGitter<kayabaNerve> /mod Kayaba
13:09:41FromGitter<kayabaNerve> Damn
13:12:25*PrimHelios joined #nim
13:12:53FromDiscord<Shield> good to see nim being on top of a benchmark, it will sure attract more attention
13:13:43FromGitter<kayabaNerve> You write C. Nim writes micro optimized C that's akin to Assembly.
13:20:27FromGitter<zacharycarter> lol
13:29:05*oscar__ joined #nim
13:33:15*oscar__ quit (Remote host closed the connection)
13:38:20*falz4 joined #nim
13:39:57FromGitter<narimiran> i'll repeat my words from yesterday: some would say that all benchmarks are not meaningful, but this one (recursive fibonacci) takes the cake!
13:42:15FromGitter<narimiran> it doesn't get much pointless-y than this
13:42:55elroodmicrobenchmarks are not about being on point for anything, they're there to attract attention
13:43:11*falz4 quit (Remote host closed the connection)
13:43:23FromGitter<Bennyelg> correct
13:44:30*vivus joined #nim
13:45:18vivusHow do I specify the ROOT/home folder when opening a file ?
13:46:34FromDiscord<Shield> yep, In the sea of countless languages I used a benchmark to find nim
13:49:19livcdwhy do most "new release of a language" turn into a comparison of this language vs Rust ?
13:50:36FromGitter<kayabaNerve> vivus You mean ~/ or /home/root
13:51:02vivus@kayabaNerve : /home/MYUSER/
13:51:27FromGitter<kayabaNerve> ~/
13:51:31PMunchlivcd, good question
13:52:13PMunchI guess most people wanting to try something new and cool nowadays censiders either Nim or Rust..
13:52:37FromGitter<kayabaNerve> livcd Aren't they only 2 new systems programming languages?
13:52:47FromGitter<kayabaNerve> Most new langs are scripted
13:52:56FromGitter<kayabaNerve> I'm discounting the functional ones
13:53:06FromGitter<kayabaNerve> Both those are generally scripted anyways
13:53:26PMunchOh by the way federico3, I saw some guy asking about running Nim on microcontrollers with the new release. You should write something about how you did it
13:54:28livcdhmm whenever I read news from Go,Crystal,Nim it always turns into such a pointless debate :)
13:54:33FromGitter<kayabaNerve> I got Nim up on Tomus. Not saying it's impressive. I'm saying if anyone wants the code I have it online
13:54:54federico3kayabaNerve on TOMU keys?
13:54:59*Drego_UP7 joined #nim
13:55:15*Drego_UP7 quit (Killed (Sigyn (Spam is off topic on freenode.)))
13:55:23FromGitter<kayabaNerve> https://www.crowdsupply.com/sutajio-kosagi/tomu
13:56:36FromGitter<rufusroflpunch> there a way, when calling a generic proc, to specify generic type variable but let another be inferred?
13:57:03FromGitter<rufusroflpunch> or is type variable inference all or nothign?
13:57:14federico3PMunch: it's more like we need to centralize all drivers and confs and so on into one project
13:58:27*francisl quit (Quit: francisl)
14:00:03*francisl joined #nim
14:00:09*francisl quit (Client Quit)
14:01:10*francisl joined #nim
14:04:52PMunchfederico3, for the different chips and such?
14:05:38*miran joined #nim
14:05:56federico3and boards, GPIOs, devices...
14:05:57vivushow do I activate choosenim if my system is not seeing it on its own?
14:07:16vivusfigured it out
14:10:05FromGitter<kaushalmodi> federico3: I'd suggest creating a GitHub Organization, and then start adding repos to that
14:10:14*ArGGu^^18 joined #nim
14:10:18FromGitter<kaushalmodi> For the Nim driver stuff
14:11:19*PrimHelios quit (Quit: Leaving)
14:12:13*ArGGu^^18 quit (Remote host closed the connection)
14:16:11PMunchI was more thinking of a complete beginner, how does he even know how do find all that stuff for his board
14:21:16FromGitter<kaushalmodi> May be Nim docs should later link to such Organizations once they are mature.
14:21:38FromGitter<kaushalmodi> And searching for TOMU, etc on Nim site leads to those repos.
14:35:20miranhey guys, i'll try to update Nim Basics to use Nim v0.19. i was thinking if i should also add a section about custom types (objects)?
14:35:55mirani don't know if that is suited for the beginners. on the other hand, people might find that quite useful
14:36:29FromGitter<kaushalmodi> miran: You can start a Nim Intermediate :)
14:36:58FromGitter<kaushalmodi> But I agree, it would be nice to use more tutorials on topics like those
14:36:58miranheh, i don't know what would i put there :D
14:37:09FromGitter<kaushalmodi> You can start with this
14:37:16FromGitter<kaushalmodi> It can be a living document/site
14:37:24FromGitter<kaushalmodi> just add more stuff to it as you learn
14:37:35FromGitter<kaushalmodi> I am looking forward for a Nim Macros tutorial
14:37:45FromGitter<kaushalmodi> s/for a/to a
14:37:59miranif it is only this, i would rather add it to nim basics. and then one day, if there are more of these 'advanced' things, i might split it then
14:38:38miranmacros tutorial (or maybe just a short article about it) is something i plan to do, but i cannot promise when will that happen
14:38:47*SenasOzys quit (Ping timeout: 240 seconds)
14:39:34FromDiscord<Shield> is there an available wrapper for a scripting language? the one for lua is nice but you can't call lua code from nim
14:40:03*Pisuke quit (Ping timeout: 245 seconds)
14:43:48FromDiscord<demotomohiro> Recursive fibonacci benchmark should take input number from outside of the program so that very wise compiler cannot generate a program that just print a number
14:45:19Nolan[m]If I have a {.cdecl, dynlib: ... .} function, but I need to link the library at compile-time, what's the best way to do that? Is there a pragma I'd put in the file, or do I need to edit config.nims and add command line parameters?
14:45:34Nolan[m]And do I then remove the `dynlib`?
14:48:46FromDiscord<demotomohiro> Just checked list of nimble packagehttps://github.com/nim-lang/packages/blob/master/packages.json
14:48:52FromDiscord<demotomohiro> I found
14:49:06FromDiscord<demotomohiro> https://github.com/nim-lang/lua
14:49:55FromDiscord<demotomohiro> Shield: this example looks like executing a lua code from nim
14:49:56FromDiscord<demotomohiro> https://github.com/nim-lang/lua/blob/master/examples/luaex.nim
14:52:21FromGitter<mratsim> @Shield, you can try Spry, it’s a smalltalk/rebol inspired language written in Nim: http://sprylang.se/
14:53:36FromGitter<zacharycarter> @Shield - 1) why do you want a scripting language with Nim
14:53:49FromGitter<zacharycarter> 2) - Araq will tell you to use Nim's VM
14:53:50*miran quit (Ping timeout: 244 seconds)
14:54:28FromGitter<mratsim> Otherwise Nim is a wrapper for Javascript :D
14:54:55FromGitter<mratsim> and you can call JS from Nim
14:56:21FromDiscord<Shield> @mratsim I'm making a mouse snapping tool, the user can input a function that will generate a curve to snap the mouse to
14:56:50FromDiscord<Shield> oh it was an answer to zacharycarter
14:57:09livcdts ts i just read this fight dom96 had with the crystal guy :P
14:57:49FromGitter<zacharycarter> Shield: but why does that require a scripting language?
14:58:06FromGitter<zacharycarter> and if you still want one - you could look at how Nimble uses nimscript
14:58:08FromGitter<zacharycarter> or
14:58:16FromGitter<mratsim> the function is provided at runtime
14:58:31FromGitter<zacharycarter> how https://github.com/Araq/nimedit does
14:58:32FromGitter<zacharycarter> ah
14:58:50FromDiscord<Shield> yeah the function is provided at runtime, can nimscript be used that way?
14:58:59FromGitter<zacharycarter> probably
14:59:03FromGitter<zacharycarter> there are limitations to Nimscript
14:59:22FromGitter<mratsim> Best would be JS or something like that: https://github.com/oskca/webview
14:59:27FromGitter<zacharycarter> but you can extend it - although I think there are still limitations around that unless you are into extending the VM's capabilities
14:59:46FromGitter<zacharycarter> unless he wants to use the c backend
14:59:50FromGitter<zacharycarter> then JS is probably useless
15:00:13FromDiscord<Shield> yeah I'm using the c backend with winim
15:00:15FromGitter<mratsim> you can, by opening a socket
15:00:17FromGitter<zacharycarter> oh
15:00:18FromGitter<zacharycarter> I see
15:00:27FromGitter<zacharycarter> nevermind @mratsim - my bad
15:00:36FromGitter<zacharycarter> I didn't click the link before typing that - I should have
15:00:54FromDiscord<Shield> wait, can you use js for that?
15:00:55FromGitter<mratsim> otherwise you need to create a small domain specific language + interpreter
15:01:05FromGitter<zacharycarter> might be a fun exercise though
15:01:13FromGitter<zacharycarter> http://craftinginterpreters.com/
15:01:17FromGitter<zacharycarter> is coming along nicely too :D
15:01:22FromGitter<mratsim> server C backend, client JS backend
15:01:44FromGitter<mratsim> example: https://github.com/Vindaar/NeuralNetworkLiveDemo
15:01:58FromDiscord<Shield> if nimscript can be used like a scripting language for real time functions it'll be a blast, nim for everything
15:02:11FromGitter<mratsim> or the webview link I sent it’s a wrapper for a cross platform UI lib in C that can call the native JS engine of each OS
15:02:26*francisl quit (Quit: francisl)
15:04:22FromDiscord<Shield> that could work
15:06:55*francisl joined #nim
15:09:23*SenasOzys joined #nim
15:11:03FromGitter<rufusroflpunch> in nim, can you pass a function first class (as opposed to an anonymous proc)?
15:12:08FromGitter<bung87> var a = proc():int = 0
15:12:29*PMunch quit (Quit: Leaving)
15:12:35FromGitter<rufusroflpunch> ah yeah, seems obvious now
15:14:19*chpts joined #nim
15:18:38FromGitter<Bennyelg> @dom96 anywhy I can pass the ip of my user inside a request?
15:20:33*TheLemonMan joined #nim
15:27:53*vivus quit (Remote host closed the connection)
15:29:46*Arimil joined #nim
15:33:24*Arimil quit (Remote host closed the connection)
15:34:47*Calinou quit (Quit: http://quassel-irc.org - Discuter simplement. Partout.)
15:38:55krux02for some reason whenever I want to type "automatical" my brains makes me type "automagical"
15:40:08elroodso you automagically type..
15:43:08FromGitter<mratsim> The krux02 type system is automagical
15:44:12*nsf quit (Quit: WeeChat 2.2)
15:46:17Nolan[m]Can I check if a flag is defined with `-d:foo` in nimscript?
15:47:30leorizewhen defined(something)
15:47:40leorizejust like what you would do in a .nim file
15:48:13Nolan[m]Perfect, where `something` is a string?
15:48:13FromGitter<kaushalmodi> Nolan[m]: See that config.nims link I sent yesterday ;-)
15:48:20FromGitter<kaushalmodi> I stumbled through similar questions
15:48:32FromGitter<kaushalmodi> https://github.com/kaushalmodi/hello_musl/blob/master/config.nims
15:49:08*francisl quit (Quit: francisl)
15:49:41Nolan[m]kaushalmodi: Right, that's what I'm tweaking now. According to the nimscript docs, it is convention to have a "build" task. So I'm refactoring that to be a build task that checks for -d:emscripten, sets up for an Emscripten build if that is defined, but doesn't if it isn't.
15:53:17*seni quit (Quit: Leaving)
15:54:05Nolan[m]OK, something else that confuses me, if I have a config.nims where I define tasks, that won't pick up dependencies in a .nimble file, right?
15:55:46*francisl joined #nim
15:57:32*chpts quit (Ping timeout: 252 seconds)
15:57:40FromGitter<kaushalmodi> umm.. I don't think so
15:58:11FromGitter<kaushalmodi> depending on the use case, you may call `nimble ..` using `exec` from the task
16:00:25Nolan[m]So that's what I'm trying to reconcile. I don't necessarily want to override the entire build process that Nimble uses. I just want to say that, if `-d:emscripten` is true, add a bunch of command line flags. `nimble build` seems to handle dependency resolution but is less flexible. config.nims is more flexible but won't resolve dependencies.
16:01:33Nolan[m]I wish I could do something like `nimble build -- -d:emscripten` and pass args to the compiler from that.
16:02:01FromGitter<kaushalmodi> Nolan[m]: I think that doesn't work
16:02:06FromGitter<kaushalmodi> I had opened an issue about that
16:02:09Nolan[m]Or, at least, that's what it seems like I want after less than 24 hours of trying to evaluate this, so I may be way off. :)
16:02:17FromGitter<kaushalmodi> not the exact same issue, but similar
16:02:30FromGitter<kaushalmodi> I wanted to do `nimble build <task in .nims>`
16:02:50Nolan[m]Right.
16:03:29FromGitter<kaushalmodi> https://github.com/nim-lang/nimble/issues/542
16:03:50Nolan[m]Well, I think I'll stick with my tweaks to your config.nims for now. At the moment I'm not using any Nim dependencies, just linking to spatialite/sqlite3 and trying to get the thing running in wasm. :) I'll cross that bridge when I get there.
16:04:27FromGitter<kaushalmodi> .nimble seems like a fork of .nims
16:04:31FromGitter<kaushalmodi> I wish both are consolidated
16:05:30FromGitter<kaushalmodi> Instead of allowing users to define tasks, etc. in there, it should ask them to create config.nims
16:05:52FromGitter<kaushalmodi> By "it", I mean nimble of course
16:06:17*tzui joined #nim
16:06:19*Trustable joined #nim
16:09:50deependI'm on windows. 64bit nim install. trying to build a 32bit windows binary. do I need to do something more than just --cpu:i386 ?
16:12:56deependnimbase.h:484:13: error: size of array 'Nim_and_C_compiler_disagree_on_target_architecture' is negative
16:20:44leorizetry adding `--passC:'-m32' --passL:'-m32'`
16:21:33*TheLemonMan quit (Quit: "It's now safe to turn off your computer.")
16:21:59deependthat appears to have succeeded
16:22:07Demos[m]it's not a fork
16:22:08deependhad to change the ' to " on windows though
16:22:11deependthanks leorize
16:22:32Demos[m].nims is part of the compiler, for just scripts you want to run in the compiler's VM
16:22:46Demos[m].nimble are .nims files read by nimble
16:22:59Demos[m]there does seem to be a task interface in .nims, but it's not documented and few use it
16:23:11Demos[m]well it's documented but not very extensively
16:25:27FromGitter<kaushalmodi> Demos[m]: I didn't mean a literal fork
16:26:00Demos[m]ah, sorry I'm pretty tired.
16:26:10FromGitter<kaushalmodi> But the fact that both nimble and nims can define a `task`, but things aren't identical in both
16:26:22FromGitter<kaushalmodi> e.g. `findExe` works in .nims but not in .nimble
16:26:59leorizethat's a nimble bug...
16:27:05leorizeI think
16:27:49Araqwell, yeah. probably Nimble doesn't claim to support findExe, but still
16:27:50FromGitter<kaushalmodi> leorize: but would it be possible for both to "source" those procs/templates from the same place?
16:28:14FromGitter<kaushalmodi> there's an issue for that findExe.. but cannot find it
16:28:18AraqNolan[m]: if your task uses 'nimble' it should be a nimble task to begin with
16:28:42Araqcalling 'nimble' in your build step is *wrong* and every project that does that is super annoying
16:29:22FromGitter<kaushalmodi> about that findExe: https://github.com/nim-lang/nimble/pull/541
16:29:41Araqit's like calling 'brew' from your makefile
16:29:53leorizekaushalmodi: now you know why they can't "source" it :P
16:30:00*chpts joined #nim
16:30:42FromGitter<kaushalmodi> leorize: I mean that when `findExe` got added to nims in nim core, should nimble use that same library?
16:30:51FromGitter<kaushalmodi> then we don't need to add the same procs in parallel to both
16:30:54Nolan[m]FWIW, I'm not calling nimble from config.nims. :) I just don't immediately know how to both use Nim dependencies and evaluate compile-time defines.
16:30:59Nolan[m]Seems it's one or the other.
16:32:02leorizekaushalmodi: I think there might be some issues. Given that the compiler already export `setupVM()`, but nimble still uses it's own version...
16:33:13leorizehttps://github.com/nim-lang/nimble/blob/af1c1d73c32b6e9fe7a8aecf3768d9f482b18180/src/nimblepkg/nimscriptsupport.nim#L96-L99
16:41:19*tzui left #nim ("Textual IRC Client: www.textualapp.com")
16:41:47*abm joined #nim
16:43:02FromGitter<kdheepak> Is there a way to dispatch on the enum value?
16:43:46*flaviu quit (Remote host closed the connection)
16:45:35*leru joined #nim
16:45:49FromGitter<kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae5abd01fb5f4ae1388403]
16:45:56*flaviu joined #nim
16:47:04leorizeI have no idea what you're trying to do
16:47:25leorizeand why would you need to assert k is of Kind?
16:47:39leorizeit has to be `Kind`
16:48:24FromGitter<kdheepak> Sorry, I didn't check if that assert worked. I assumed it would have? I was just trying to let the reader know k was a value in Kind.
16:49:00leorizethe Nim way is var k: Kind :P
16:49:13FromGitter<kdheepak> Got it :D
16:49:23elroodhm, nimble.directory (or whatever you guys consider to be the go-to listing of available nim packages) could use a more prominent link on the website, it's pretty well hidden
16:49:25FromGitter<kdheepak> I think what I'm asking is not possible.
16:49:30leorizeand I don't think you can "dispatch" :P
16:49:43leorizefor that use case implement `$` instead
16:50:02FromGitter<kdheepak> Yeah, because the enum essentially get converted to ints I think.
16:50:15FromGitter<kdheepak> Can you elaborate on how `$` would help?
16:50:24leorizethis is not C, enums aren't int...
16:51:32*Calinou joined #nim
16:51:55leorize!eval type Kind = kFirst, kSecond; echo kFirst
16:51:57NimBotCompile failed: in.nim(1, 13) Error: undeclared identifier: 'kFirst'
16:52:11leorize!eval type Kind = kFirst, kSecond; let k = kFirst; echo k
16:52:12NimBotCompile failed: in.nim(1, 13) Error: undeclared identifier: 'kFirst'
16:52:25*Calinou quit (Remote host closed the connection)
16:52:26leorize!eval type Kind = enum kFirst, kSecond; echo kFirst
16:52:27NimBotCompile failed: in.nim(1, 33) Error: identifier expected, but found ';'
16:52:36*francisl quit (Quit: francisl)
16:52:40FromGitter<kayabaNerve> leorize Yeah they are
16:52:53leorize:P my one line Nim skills aren't that good
16:52:56FromGitter<kayabaNerve> I mean, Nim compiles to C and enums are int
16:53:21leorizethat's only an implementation thingy
16:53:26FromGitter<kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae5c8653c31c11117bf5eb]
16:53:35FromGitter<kdheepak> https://nim-lang.org/docs/manual.html#types-enumeration-types
16:53:43FromGitter<kdheepak> This is what I meant.
16:53:49FromGitter<kayabaNerve> Every enum definition can have custom int fields declared. ⏎ Every enum type can be casted to an int/called ord() upon. ⏎ Every int value can be casted to an Enum type if the int value is in the Enum.
16:54:09FromGitter<kayabaNerve> *int values
16:54:20FromGitter<kayabaNerve> So it's not a raw int in the sense a char isn't an int
16:54:31FromGitter<kayabaNerve> But enums are ordinal types and have an int definition
16:54:54leorizethat's what I meant
16:55:55leorizenever noticed that you can customize the string without defining your own `$`, thanks @kdheepak
16:56:18*chpts quit (Quit: leaving)
16:56:23FromGitter<kayabaNerve> Just like chars are an ordinal type with int definitions masking the ASCII table
16:56:23FromGitter<kayabaNerve> Fair enough.
17:02:23FromGitter<kdheepak> :D
17:03:58*gmpreussner quit (Ping timeout: 250 seconds)
17:03:59*gmpreussner_ joined #nim
17:04:27*francisl joined #nim
17:04:28*floppydh quit (Quit: WeeChat 2.2)
17:04:44FromGitter<kayabaNerve> leorize: Enums are intd if you use a macro that turns all Enums decls into constants and break 80% of the functionality behind Enums
17:07:31FromGitter<kayabaNerve> Why learn Nim and code things when you can write macros that force your broken code to technically work but break everything's intent so far you're seen as clinically insane?
17:11:42FromGitter<kdheepak> If I have a `seq[string]` how do I convert it to a string?
17:12:54*gmpreussner joined #nim
17:13:02FromGitter<kdheepak> `join`?
17:13:30*gmpreussner_ quit (Ping timeout: 268 seconds)
17:13:46FromGitter<kayabaNerve> That's one way
17:13:51FromGitter<kayabaNerve> You can also call $
17:13:55FromGitter<kayabaNerve> What are you trying to do?
17:14:08FromGitter<kayabaNerve> Do you want to handle data or print the seq/
17:14:15FromGitter<kdheepak> Can you not redeclare a variable in a function?
17:14:23FromGitter<kdheepak> as a different type?
17:14:40FromGitter<kayabaNerve> Nope
17:15:10*leru quit (Ping timeout: 246 seconds)
17:18:48FromGitter<adam-r-kowalski> What is the equivalent of passing by constant reference in nim? By default things are pass by value right, which makes a copy. If you mark it as a var then it is pass by pointer, so cheap to pass big objects, but then they are mutable
17:19:24leorizeit's `lent`
17:19:36leorizebut highly experimental and undocumented
17:20:02leorizeand only works with `--newruntime` and/or `--gc:destructors`
17:20:04FromGitter<adam-r-kowalski> Well so what do you all use in day to day code? Do you just make every big object a reference type?
17:20:42FromGitter<mratsim> @adam-r-kowalski if a stack object is bigger than 3 times the size of a pointer, it’s passed by hidden ref
17:21:38FromGitter<mratsim> otherwise it’s passed by val
17:21:38FromGitter<adam-r-kowalski> But honestly that seems really nice, that means with the new runtime we can essentially have c++/rust like semantics right? We pass by either a move or a borrow(reference) and don’t need the gc for anything
17:21:58FromGitter<mratsim> yes https://github.com/nim-lang/Nim/wiki/Destructors
17:22:16FromGitter<mratsim> seq and string will not depend on GC once newruntime is default
17:22:19FromGitter<adam-r-kowalski> @mratsim oh thats nice, so I don’t even need to use lent? just no annotation at all should be just as efficient and seems to have the same semantics?
17:22:26FromGitter<mratsim> yep
17:22:56FromGitter<mratsim> You would probably still need GC for closures and async but who knows
17:23:13FromGitter<adam-r-kowalski> I’m a big fan of arraymancer by the way! I’ve been trying to switch to nim from julia, and your library is helping me make the switch!
17:23:24FromGitter<mratsim> cool =) thanks
17:24:12FromGitter<adam-r-kowalski> What are your thoughts on the nimtorch annoucement? It seems like there could be a lot of room for collaboration
17:24:15FromGitter<mratsim> Once I finish adding some RNN examples I’m gonna attack the data viz part
17:25:16FromGitter<mratsim> I’m in their Gitter, basically they prototyped a lot on Arraymancer but they felt like the field is moving too fast to build stuff from scratch, especially since I’ve been doing much less deep learning commits recently
17:25:29FromGitter<mratsim> that’s true.
17:25:36*Calinou joined #nim
17:26:23*Calinou quit (Client Quit)
17:26:28Araqadam-r-kowalski, just to confirm, the default parameter passing mode is closer to 'const&' than to "pass by value"
17:26:37*Calinou joined #nim
17:27:02FromGitter<mratsim> I’m waiting for destructors to have easier to interop low level and provides Python and whatever else want interior: https://github.com/mratsim/Arraymancer/issues/262#issuecomment-415958290
17:27:30FromGitter<mratsim> @Araq, you should put that in a Nim for the C++ programmer page ;)
17:27:43FromGitter<mratsim> I think the only way to find that info is in IRC logs
17:28:22FromGitter<adam-r-kowalski> I think that we can learn a lot from julia honestly. They have built a really composable ecosystem by making a series of small libraries. They have many different tensor/nd-array packages as well as autodiff. Then you can mix and match because no concrete types are specialized, and instead they work on with informal interfaces. That means as long as your nd-array conformes to the interface it is plug and play
17:28:22FromGitter... with the autodiff libraries. I am wondering if we can do something similar with concepts. We can define a Tensor concept and then whether it is an arraymancer cpu/cuda/opencl tensor or a nimtorch tensor we shouldn’t really have to care right? And that would help with not having to build everything from scratch. You ... [https://gitter.im/nim-lang/Nim?at=5bae64b5640179275b6846ef]
17:29:24*nsf joined #nim
17:29:26Araqconcepts will work for this, but afaik Julia benefits from its JIT here
17:29:58FromGitter<adam-r-kowalski> @Araq, thats very good to know! So pass by var is really passing by reference? Or is it passing by pointer?
17:30:31Araqit's really like this:
17:31:10Araqx: T # let the compiler decide, not mutable
17:31:13FromGitter<adam-r-kowalski> It does benefit from the JIT but the thing they don’t tell you, that really bites you is how long the compilation is. And since it’s not cached you have to deal with it every time you run your code. Importing common libraries for plotting and getting your first plot up takes upwards of 30seconds
17:31:25FromGitter<mratsim> The current autograd is mostly Generics, I use concepts for “TrainableLayers” only.
17:31:29Araqx: var T # let the compiler decided, but it's mutable
17:31:55Araqx: sink T # let the compiler decide, but the callee takes ownership
17:32:05FromGitter<adam-r-kowalski> Fair enough, so it will just do the right thing depending on the size of the type?
17:32:11Araqexactly.
17:32:45stefanos82can we be explicit if we want to though?
17:32:48FromGitter<adam-r-kowalski> So since we have sink T and ptr is not based on GC we should be able to build unique/shared/weak ptr types right? Then just have move constructors defined
17:33:06Araqthe parameter passing modes capture the intent, they are not to optimize your code.
17:33:59FromGitter<bung87> it’s a cool thing that nim has low level and high level concept for gc and non-gc language programers.
17:34:01FromGitter<adam-r-kowalski> @mratsim so if I were to build my own tensor type, say a stack allocated one, then it could work with your autograd system?
17:34:56FromGitter<mratsim> I think you need a “shape” proc or field with array semantics, but yeah, it shouldn’t be hard to adapt.
17:36:52FromGitter<mratsim> but an autograd is super simple, here is one based on closure for scalars: https://github.com/mratsim/nim-rmad Thinc (from spaCy) uses something similar.
17:38:17FromGitter<mratsim> only issue with closures is that the number of args and return values are part of the type so you would need type erasure anyway, so I just went and used inheritance
17:38:33FromGitter<kaushalmodi> Araq: I have few PRs ready based on what gets decided out of https://github.com/nim-lang/Nim/issues/9104#issuecomment-425508998
17:39:14FromGitter<kaushalmodi> question is if dochack.js should stay in the /doc vs /doc/html. If it is the latter, we don't need unnecessary dir structure in deployed site
17:39:48FromGitter<adam-r-kowalski> So closures need GC because we don’t have capture classes like in c++ or rust right? If we did and we marked each captured var as moved or borrowed we could have 0 overhead closures right?
17:40:50FromGitter<adam-r-kowalski> You could just create a struct that holds the environment and then pass that in as needed
17:44:55FromGitter<kaushalmodi> If this particular test failed, how do I rerun just that locally? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae6897271506518d89db6b]
17:46:19FromGitter<mratsim> btw @adam-r-kowalski I don’t know if you checked the Julia challenge but you might be interested in my Nim solution to it: https://github.com/SimonDanisch/julia-challenge/pull/3
17:46:41FromGitter<adam-r-kowalski> Yeah I saw that! I saw that you beat them on every benchmark haha
17:47:37FromGitter<mratsim> besides compile-time ;)
17:47:55Araqadam-r-kowalski: huh, you need to elaborate on that. sounds like you have some ideas that I've been missing :-)
17:48:08Araq'ref' and 'closure' are unsolved problems for me :D
17:48:12Araqbbs
17:48:35FromGitter<kayabaNerve> @mratsim You can have the fastest compile time of all languages if you never compile
17:49:02FromGitter<kayabaNerve> Is it just me or is it annoying how you can't test stdlib modules in Nim secret?
17:49:09FromGitter<kayabaNerve> I fully understand why.
17:49:18FromGitter<mratsim> math works ;)
17:49:26FromGitter<kayabaNerve> TIL
17:49:32FromGitter<kayabaNerve> But most don't :P
17:49:46FromGitter<mratsim> I think if it’s enabled for nimscript it’s enabled for nim secret
17:50:35FromGitter<adam-r-kowalski> Yeah but honeslty thats what scares me about Julia. In theory it’s a great langauge, as fast as c++ but the problem is that it is only true the second time you run any piece of code. My question to them has been, since you have dynamic typing, you can run across a pair of types during runtime that you’ve never seen before and have to pause while the AOT JIT stamps out a method before it actually runs it to
17:50:35FromGitter... get the real speed. So maybe nim had worse compile times, but you only need to pay that cost once. After that your binary will run without pausing, besides GC, which you can disable
17:50:52FromGitter<mratsim> @kayabaNerve here is the future: https://github.com/nim-lang/Nim/issues/8927
17:51:12FromGitter<adam-r-kowalski> yeah full code reloading would be awesome1
17:51:48FromGitter<mratsim> when i tried Julia in the past (0.3~0.4) The only way i could get fast speed is by adding all types explicitly
17:51:57FromGitter<mratsim> A bit like Numba for Python.
17:52:08FromGitter<kayabaNerve> @mratsim With all that new Status money? :P
17:52:18FromGitter<kayabaNerve> I saw it when it went live. I hope it works.
17:52:32FromGitter<mratsim> yep funded by Status
17:53:29FromGitter<kayabaNerve> Nice
17:53:42FromGitter<adam-r-kowalski> @mratsim I actually found that a lot of the time I don’t need to write down the types, because it’s not actually dynamic, it’s more like each argument is a template parameter (or generic in nim) but did you notice the huge pause you execute any code the first time? It’s always way faster the second and subsequent execution
17:53:44*aamk joined #nim
17:56:56FromGitter<mratsim> yeah, one thing I’m wondering is why many LLVM based language (like Rust or Crystal or D LLVM backend) have slow compilation issues
18:02:16*wildlander joined #nim
18:03:24krux02mratsim: it is unlikely the cause of LLVM.
18:04:23krux02maybe LLVM is not the fastest compilation backend imaginable, it has many costly optimizations built-in.
18:04:42FromGitter<mratsim> C is fast
18:05:00*francisl quit (Quit: francisl)
18:05:12FromGitter<mratsim> I guess they have an issue with their symbol resolution passes (which C doesn’t have)
18:05:23FromGitter<mratsim> for generics*
18:05:31krux02Scala has also compilation speed issues
18:05:41krux02and it is not LLVM based.
18:05:42FromGitter<mratsim> and maybe OO as well
18:06:11krux02the problem is that many languages try to be *too smart*
18:06:43krux02in rust it is the safety checker as far as I know
18:07:11krux02and it scala I think it has to do with the ``implicit`` stuff, but I am not sure..
18:07:25krux02there are N^2 problems in the compiler
18:07:35krux02and that just doesn't scale very well
18:08:46krux02c++ has a big problem, because for big projects you need compilation clusters.
18:09:07FromGitter<kayabaNerve> If you don't write your C++ code on a supercomputer, you're not a C++ dev
18:09:29FromGitter<kayabaNerve> If you don't program Python while wearing a fish bowl, you aren't a Python dev
18:09:52krux02I like if I can write and compile my code on a crappy laptop.
18:09:54FromGitter<kayabaNerve> If you don't code Nim while praising our BDFL, you aren't a Nim dev
18:10:55Araqthat's a recent development, in the past Nim was used despite of its BDFL
18:11:02Araq:P
18:11:42FromGitter<kayabaNerve> Araq if you read the Nth character of every other Git commit message on my projects, they spell out PRAISE ARAQ
18:11:55Araqlol
18:11:57FromGitter<kayabaNerve> Damn it, could you imagine lol
18:11:59Araqthank you.
18:12:07FromGitter<kayabaNerve> I feel like I now have to
18:12:29oprypinCrystal has a very simple problem, it's as if you were writing every method like this `proc foo*[T: Foo, U: Bar](a: T, b: U)` rather than `proc foo*(a: Foo, b: Bar)` (at least I hope this is also how Nim's generics work) - each slightly different type causes a new function or even a whole cascade of functions to be generated
18:12:37FromGitter<kayabaNerve> Use a GitHub history faker to upload Nim files and spell Araq on the activity green square thingy
18:13:56oprypin@mratsim
18:14:16FromGitter<mratsim> here
18:15:37FromGitter<mratsim> but it works at instantiation only right?
18:15:48Araqto be fair, "Is language X fast to compile in principle" is essentially an unsolved problem
18:15:51FromGitter<mratsim> if so i think it’s like Nim
18:16:40oprypini mean, that part with generics probably is like Nim, but it doesn't have any equivalent of `proc foo*(a: Foo, b: Bar)`, u know?
18:17:14Araqand I think the answer is "yes" for any language out there, if you pick the right compiler architecture
18:17:55Araqand I want to write a book about the "right" compiler architecture
18:17:57Araq;-)
18:19:11Araqand for C++ the answer is probably "no, add a module system ffs"
18:20:21*krako joined #nim
18:20:48*francisl joined #nim
18:23:41FromGitter<kdheepak> I'm getting a weird error, can someone help me understand what is going on? Pasting code below:
18:24:08FromGitter<kdheepak> this is the error message: ⏎ ⏎ ``` Error: type expected``` [https://gitter.im/nim-lang/Nim?at=5bae71c85331811c2e1dd0f0]
18:24:35FromGitter<kdheepak> I get it when I try to run `initObj(attr: o)`.
18:24:57FromGitter<kdheepak> I've defined `initObj` as a constructor for `Obj`.
18:25:38*aamk quit (Remote host closed the connection)
18:28:19FromDiscord<demotomohiro> Did you defined type `o` used in `initObj(attr: o)`?
18:29:16*francisl quit (Quit: francisl)
18:29:25FromGitter<kdheepak> Yes, attr is `JsonNode` and `o = newJObject()`
18:30:32*ritchie_ quit (Remote host closed the connection)
18:32:00*francisl joined #nim
18:32:20FromDiscord<demotomohiro> `var obj: Obj`
18:32:20FromDiscord<demotomohiro> `let o = newJObject()`
18:32:20FromDiscord<demotomohiro> `obj.initObj(o)`
18:32:22FromGitter<kdheepak> Can you store user created objects in a JSON?
18:32:30*miran joined #nim
18:35:35krux02Compilation time problems are solved once and for all by using interpreted languages only.
18:38:48FromGitter<vivekimsit> @mratsim I think its better to program on the blockchain first and then get into internals
18:38:59stefanos82krux02: I like Ocaml's approach to be honest with you
18:43:52krux02stefanos82, I didn't work yet in Ocaml, what is thear appreach?
18:44:14krux02And I probably won't work in Ocaml, because I am very happy in the wordl of Nim.
18:44:48stefanos82krux02: an interactive top-level interpreter, a bytecode compiler, and an optimizing native code compiler
18:45:18stefanos82I didn't say anything bad about Nim
18:45:32krux02that is not how I meant it.
18:45:45stefanos82all I wish for is to get an interpreter for Nim to produce fast prototype results
18:45:46krux02it is just unlikely that I will go in depth into Ocaml
18:45:56krux02unless I get paied to do so
18:46:01stefanos82it depends from your future career needs
18:46:24krux02^^ yes
18:46:36krux02but for the moment, I keep using Nim.
18:47:11FromGitter<kdheepak> nim doesn't seem to like this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae772f1e23486b935c1f59]
18:48:13FromGitter<kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae776d271506518d8a3aa1]
18:48:49*stram joined #nim
18:48:51FromGitter<krux02> @kdheepak you use inheritance, but don't use references
18:49:50krux02inheritance baced polymorphism only works with one level of pointer indirection.
18:50:17krux02so either make Animal a ref object, or make the seq of type ``seq[ref Animal]``
18:51:11Araqhttps://github.com/nim-lang/Nim/issues/9108 yay, more RFCs
18:52:37FromGitter<kdheepak> So this seems to work ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae78751e23486b935c262d]
18:53:18FromGitter<kdheepak> I don't understand when to use ref and when not to.
18:53:37*stram quit (Remote host closed the connection)
18:53:57miran@kdheepak from which programming language are you coming to nim?
18:54:04Araqstefanos82: Ocaml's approach is nice but I think instead of a bytecode interpreter a simple codegen like Tiny C uses is better
18:54:18FromGitter<kdheepak> @miran Python
18:54:20*DM_ joined #nim
18:54:36Araqless friction for the FFI then, all interpreters produce interop problems
18:54:40stefanos82true, but tinyc is quite buggy for important pieces of code
18:54:41krux02@kdheepak: you need ref whenever you use inheritance based polymorphism.
18:55:06miranexactly as i thought ;) me too and at first i also had hard time understaning ref/non-ref objects, their differences and usages
18:55:08*DM_ quit (Client Quit)
18:55:17krux02and when you need to share the same object on different locations
18:56:28miran@kdheepak: this has been helpful to many people (me included): https://peterme.net/nim-types-originally-a-reddit-reply.html
18:57:15FromGitter<kdheepak> I was just about to ask for reading material :) Thanks! I'll read and ask more questions if I don't understand anything.
18:58:36mirani'm sure you'll understand at least something ;) and let that information sink in a bit, and then re-read that article again in a day or two, after you have experimented with some simple examples with (non)ref objects. things will start to get clearer
19:01:32FromGitter<kdheepak> > If we had simply done var myObject: SomeObject and SomeObject was defined as a ref object we would only have a reference on our stack, so trying to access it would crash saying we had an "Illegal storage access". This is because Nim defaults our value to nil, and no-one is allowed to access memory area 0.
19:02:16FromGitter<kdheepak> Does this mean that if I have a ref object defined called SomeObject, and if I write `var myObject: SomeObject` it doesn't actually create the object?
19:02:58FromGitter<kdheepak> If I had defined it as an object instead of ref object, would it then create it when I use `var myObject: SomeObject`?
19:03:07FromGitter<kdheepak> (I'm guessing not)
19:03:24FromGitter<kayabaNerve> If it's a ref object, you must use the constructor
19:03:34FromGitter<kayabaNerve> var myObject: ObjectType = ObjectType()
19:12:47FromGitter<mratsim> or “new"
19:13:33FromGitter<mratsim> @vivekimsit then I suggest you try the tutorial of Loom Network to will guide you to write a blockchain game like CryptoZombies
19:13:56FromGitter<bung87> ```code paste, see link``` ⏎ ⏎ how to get it work? [https://gitter.im/nim-lang/Nim?at=5bae7d73c08b8b3067a33226]
19:14:39FromGitter<bung87> I am wrapping a cpp lib
19:15:07FromGitter<bung87> ```code paste, see link``` ⏎ ⏎ it throws [https://gitter.im/nim-lang/Nim?at=5bae7dbbef4afc4f28ed64ce]
19:24:36*cbaines29 joined #nim
19:26:22*jjido joined #nim
19:26:35*Calinou quit (Quit: http://quassel-irc.org - Discuter simplement. Partout.)
19:30:09*stefanos82 quit (Quit: Quitting for now...)
19:31:15*cbaines29 quit (Remote host closed the connection)
19:43:52ZevvSearching on the Nim Manual seems to be broken for me: "Error: Error: unhandled exception: index out of bounds [IndexError]"
19:44:26Zevvfor certain searches, for example "type"
19:46:28*nsf quit (Quit: WeeChat 2.2)
19:52:21AraqZevv: ooh, let me try
19:53:01FromGitter<kaushalmodi> phew.. final list of broken links in the generated nim docs: https://github.com/nim-lang/Nim/issues/9109
19:53:12FromGitter<kaushalmodi> anyone wants to take a peek and start fixing them one by one?
19:54:40*Anticimex joined #nim
19:57:30*Anticimex quit (Remote host closed the connection)
20:00:24*elrood_ joined #nim
20:01:34*elrood quit (Ping timeout: 240 seconds)
20:06:28*chrispho1k joined #nim
20:08:36FromGitter<kdheepak> I'm still struggling to understand the `ref` keyword, particularly in conjunction with `seq`.
20:08:42FromGitter<kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae8a4aa9be136b94c86a74]
20:09:12FromGitter<kdheepak> If I wanted a list of Animals to be stored in l, and want to append to the list in a for loop, how can I go about doing that?
20:11:17*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:12:13*chrispho1k quit (Remote host closed the connection)
20:15:38FromGitter<rayman22201> @Zevv, orly? what browser? This is using the fuzzy match search PR now right @Araq and @kaushalmodi ?
20:15:51Araqsure it is
20:15:56FromGitter<rayman22201> damnit
20:15:57Araqso yeah, your bug :P
20:16:04Araqhowever
20:16:24Araqthe JS codegen doesn't produce a trailing \0 anymore, maybe that's why
20:16:39Araqlooking at your code though, you use 'cstring'
20:17:07FromGitter<rayman22201> yup. I'm back btw. Was sick with the flu all week. I still owe you a streams PR as well
20:17:29FromGitter<kaushalmodi> Zevv: I can reproduce that error
20:17:36FromGitter<kaushalmodi> @rayman22201 : ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae8c601e23486b935c9dfb]
20:17:46FromGitter<rayman22201> It seems to happen on chrome but not Firefox
20:17:53FromGitter<kaushalmodi> above was Firefox
20:18:10FromGitter<kaushalmodi> I don't use Chrome as it completely blocks the search
20:18:14FromGitter<kaushalmodi> the cross origin thing
20:18:38Araqhuh? Chrome works for me too
20:18:48Araq(ignoring this bug)
20:18:55FromGitter<rayman22201> Yeah. I use Firefox normally, and I can't repro. but I checked chrome just to see
20:18:59FromGitter<kaushalmodi> Araq: it's because I am opening the docs without server
20:19:32FromGitter<kaushalmodi> If I start the docs in localhost server, I'll need to kill/restart the server each time I rebuild the docs (I guess)
20:19:45FromGitter<kaushalmodi> (or may be not.. haven't checked :P)
20:20:28FromGitter<rayman22201> Also, yeah, I'm using cstring, so the ending /0 shouldn't be an issue... weird
20:21:01FromGitter<kaushalmodi> @rayman22201 OK, I can reproduce that error on Firefox ESR 45
20:21:05FromGitter<kaushalmodi> but not on the latest 62
20:21:21FromGitter<rayman22201> interesting
20:21:24FromGitter<krux02> @kdheepak http://ix.io/1nMQ
20:21:27FromGitter<rayman22201> freaking browsers
20:21:41*francisl quit (Quit: francisl)
20:22:00*NimBot joined #nim
20:22:07FromGitter<kaushalmodi> even on ESR 45, it works.. but when using the hosted version
20:22:33FromGitter<kaushalmodi> but I get the error when reading docs directly (`firefox foo.html&`)
20:22:42FromGitter<kaushalmodi> Zevv: How are you reading the docs?
20:23:08FromGitter<kdheepak> Thanks @krux02. Does that mean you created a reference to Animal before adding to the seq?
20:23:50FromGitter<kdheepak> Does this create an Animal on the stack but take the reference to it? Or does it create an Animal on the heap? ⏎ ⏎ ```l.add( (ref Animal)(x: i) )``` [https://gitter.im/nim-lang/Nim?at=5bae8dd6a9be136b94c87f76]
20:24:06FromGitter<rayman22201> On Chrome 69.0.3497.100 (latest I think) repros consistently. Firefox 62.0.2 does not repro.
20:24:41FromGitter<rayman22201> more people use Chrome than FF unfortunately, so I should fix this.
20:24:59FromGitter<kaushalmodi> @rayman22201 and I can once again see the error on a localhost server on ESR 45
20:25:06FromGitter<kaushalmodi> let me send you a capture video in a min
20:26:25Zevvkaushalmodi: FF 60.02
20:26:42Zevvonline from nim-lang.org
20:26:45FromGitter<kaushalmodi> https://i.imgur.com/YrQi8oi.gifv
20:26:53FromGitter<kaushalmodi> @rayman22201 ^
20:27:20FromGitter<iffy> For testing, can I import non-public things from a module somehow? (i.e. I want to test `proc foo()` in a different file without adding `*` to it)
20:27:51*Evolution5 joined #nim
20:28:23FromGitter<rayman22201> @kaushalmodi yeah. Same exact behavior on Chrome 69
20:28:45FromGitter<kaushalmodi> cool, glad you can repro
20:29:12FromGitter<kaushalmodi> that's half solving the bug :)
20:29:13FromGitter<rayman22201> I'm stepping through the code in the Chrome debugger. It somehow things that index 2 is out of bounds of a string of length 36
20:29:18FromGitter<rayman22201> lol. Very true
20:29:46*miran quit (Ping timeout: 246 seconds)
20:29:55FromGitter<rayman22201> I'm just annoyed / confused about what changed between browser versions that would cause such a drastic change in behavior.
20:30:23FromGitter<rayman22201> /s/things/thinks/
20:32:33FromGitter<iffy> oh, not public: exported. Is there a way for test files to access non-exported things from other files?
20:33:12*Evolution5 quit (Remote host closed the connection)
20:38:39*tzui joined #nim
20:39:06FromGitter<krux02> @kdheepak yes you create references to Animal before you put them in seq
20:39:33FromGitter<krux02> but normally I would avoid doing that.
20:40:14FromGitter<krux02> It is more efficient to have just one type, Animal, and this animal has a tag that says what kind of animal it is.
20:40:30FromGitter<krux02> then you can put all of the animals in a seq without the need for pointer indirection.
20:45:08FromGitter<kdheepak> Hmm. Thanks for the replies @krux02. I think I'm still missing something though: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ For example, I don't understand why this example works. [https://gitter.im/nim-lang/Nim?at=5bae92d41e23486b935cc50b]
20:46:14FromGitter<kdheepak> I've created a ` Dog( kind: "dog", attributes: %*{"height": 1} )` instead of `(ref Dog)( kind: "dog", attributes: %*{"height": 1} )`.
20:46:29FromGitter<kdheepak> But I defined the type as `Dog = ref object of Animal`.
20:47:05FromGitter<kdheepak> Is it correct then to say that nim doesn't care about what the definition was in the type?
20:47:20FromGitter<kdheepak> Does it only take into account what happens when creating it?
20:47:30krux02get rid of "ref", the type "Dog" and inheritance (the keyword of)
20:48:25FromGitter<kdheepak> What does the ref do in this example?
20:48:52FromGitter<kdheepak> And why are you asking I remove the inheritance?
20:49:04krux02if means that the type "Dog" is alrady a reference (pointer) type, where Animal is not.
20:49:11krux02(doesn't really make sense)
20:50:23krux02because inheritance based polymorphism, while being basically everywhere is one of the big reasons for memory bloat in modern software architecture
20:50:25FromGitter<kdheepak> `Animal = ref object of RootObj` I've defined Animal to be a `ref` as well. Right?
20:50:39krux02you shoud not get in the habit of creating type hieracies
20:50:54krux02try to model with flat data structures first.
20:50:55FromGitter<kdheepak> I need to store a seq of different types.
20:51:27krux02when you do that, the Dog will be a double indirection.
20:51:28FromGitter<kdheepak> How do I store it if I don't use inheritance?
20:51:36FromGitter<kdheepak> Ohh.
20:51:37krux02a ``ref ref object``
20:52:03krux02you just store it in a ``seq`` or ``array``
20:52:08krux02meaning flat data structures.
20:52:38krux02you won't have an array of pointers that point to something, you will have an array that already contains the data.
20:53:29FromGitter<kdheepak> This example doesn't compile now ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae94c9a9be136b94c8a94a]
20:54:21krux02that kind field is redundant
20:54:29FromGitter<kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae9505c7bf7c3662889d6b]
20:54:43krux02if you use inheritance, you automatically have a hidden field that stores the type of that object.
20:54:59FromGitter<kdheepak> I can get rid of kind then.
20:55:14krux02don't use a kind field and inheritance based polymorphism at the same time
20:55:31krux02either get rid of the inheritance or the kind field
20:55:38FromGitter<kdheepak> I'll remove the `kind`.
20:55:46FromGitter<kdheepak> Do you know why this doesn't compile?
20:57:41krux02kdheepak, sorry I was wrong about the ref object of Animal part
20:58:08krux02aparently you won't get double indirection by it.
20:59:02krux02you have to put Dof = ref object of Animal
20:59:11FromGitter<kaushalmodi> @rayman22201 Does dochack.js only work if it's in the parent dir?
20:59:25FromGitter<kaushalmodi> even after changing the path to it in the script tag?
20:59:27FromGitter<kdheepak> Okay. this compiles now. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae962f5a52b440159ce134]
21:00:27FromGitter<rayman22201> @kaushalmodi I don't think it matters.... What are you seeing?
21:00:42FromGitter<kaushalmodi> @rayman22201 .. because I am not getting that index error when I search for "temp" on https://nim-lang.org/docs/tut1.html. But I do get that error on https://awesome-babbage-a89752.netlify.com/tut1.html even on Firefox 62
21:01:04FromGitter<rayman22201> Also, I refreshed my firefox and I can repro now. (I was using an old cached version of dochack.js)
21:01:08FromGitter<kaushalmodi> the difference is that the latter link has dochack.js moved to the same dir as html
21:01:11FromGitter<rayman22201> repro in FF I mean
21:01:41FromGitter<rayman22201> stepping through in the debugger I think it's an actual bug. There is an edge case in the state machine that I didn't account for.
21:01:56FromGitter<rayman22201> https://github.com/nim-lang/Nim/blob/devel/tools/dochack/fuzzysearch.nim#L92
21:02:36FromGitter<kaushalmodi> hmm, even after cache refresh, I cannot reproduce that bug on FF 62 on the official link
21:02:44FromGitter<rayman22201> If it's in the "LeadingCharMatch" or "ConsecutiveMatch" state and we are both at the end of the pattern string and the search string, it errors.
21:02:53FromGitter<rayman22201> really?
21:03:15FromGitter<rayman22201> that's strange
21:03:18FromGitter<kaushalmodi> yeah
21:04:03FromGitter<kaushalmodi> the second link (awesome babbage (randomly generated by Netlify)) contains docs generated after https://github.com/nim-lang/Nim/pull/9103 and https://github.com/nim-lang/Nim/pull/9110
21:04:24FromGitter<rayman22201> stupid question, but are you sure you have cleared your cache, and the correct dochack.js file is loading?
21:04:31FromGitter<kaushalmodi> I don't think if any of those changes could cause that error.. so I will wait for your PR
21:04:39FromGitter<kaushalmodi> Ctrl+F5?
21:05:05FromGitter<kaushalmodi> also in Ctrl+Shift+I, in network tab, I checked Disable Cache
21:06:06FromGitter<rayman22201> That should work....
21:06:27FromGitter<kaushalmodi> let's see.. I'll try out when you have the fix
21:06:33FromGitter<rayman22201> well, I think the bug is real regardless. I will create the PR, yeah.
21:06:35FromGitter<kaushalmodi> unrelated: I get this warning: "Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http://xhr.spec.whatwg.org/ dochack.js:1402:4"
21:08:13FromGitter<kdheepak> Is there any difference between ⏎ ⏎ `var d = Dog()` and `var dr = new(Dog)`? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae983d1e23486b935ce3e5]
21:09:07FromGitter<rayman22201> @kaushalmodi That is because the search does an "old school" javascript trick of loading the entire index.html file into a js string using XMLHttpRequest().open
21:09:09FromGitter<rayman22201> https://github.com/nim-lang/Nim/blob/devel/tools/dochack/dochack.nim#L242
21:09:18FromGitter<rayman22201> which is synchronous.
21:09:34FromGitter<rayman22201> These days the "prefered" way is to do an async request
21:09:48FromGitter<rayman22201> but that is a big refactor that is probably not worth it for this.
21:10:01*Vladar quit (Remote host closed the connection)
21:12:09*francisl joined #nim
21:16:58*gangstacat quit (Quit: Ĝis!)
21:18:13FromGitter<kaushalmodi> ok
21:18:44*leod__ joined #nim
21:23:37*francisl quit (Quit: francisl)
21:23:38*gangstacat joined #nim
21:25:03*leod__ quit (Remote host closed the connection)
21:29:04*chemist69 quit (Ping timeout: 240 seconds)
21:29:56*gangstacat quit (Quit: Ĝis!)
21:30:10*Guest71143 joined #nim
21:30:27*chemist69 joined #nim
21:31:19FromGitter<krux02> @kaushalmodi this is the same but in efficient: http://ix.io/1nN6
21:31:45FromGitter<kaushalmodi> ?
21:31:52FromGitter<krux02> sorry
21:31:53FromGitter<kaushalmodi> @kdheepak ^
21:31:55FromGitter<kaushalmodi> :)
21:31:59FromGitter<krux02> yes
21:32:12FromGitter<krux02> blindly hitting completion
21:33:29*Guest71143 quit (Remote host closed the connection)
21:38:24*Myon26 joined #nim
21:39:41*Trustable quit (Remote host closed the connection)
21:42:00*gbristol25 joined #nim
21:42:36*gbristol25 quit (Remote host closed the connection)
21:43:37FromGitter<kdheepak> Thanks @krux02
21:43:53*SenasOzys quit (Remote host closed the connection)
21:44:49*gmpreussner_ joined #nim
21:45:11*Myon26 quit (Remote host closed the connection)
21:45:41*gmpreussner quit (Ping timeout: 260 seconds)
21:45:48*SenasOzys joined #nim
21:48:20*amk joined #nim
21:48:43FromGitter<kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5baea1bba9be136b94c8f403]
21:49:01FromGitter<kdheepak> This returns the following: ⏎ ⏎ ```(name: "Joe") ⏎ (name: "Joe") ⏎ (name: "Jane") ⏎ (name: "Jane")``` [https://gitter.im/nim-lang/Nim?at=5baea1cd19b139275a183209]
21:49:22*SenasOzys quit (Remote host closed the connection)
21:49:42FromGitter<kdheepak> One of them is created on the stack and the other is created on the heap, right?
21:49:45*SenasOzys joined #nim
21:49:50Nolan[m]If you're using Nim to build what is for all intents and purposes a C library, I guess it's reasonable to think you'll need to disable the GC? I almost have a wasm function calling, but it segfaults on a `new()` call but works fine when compiled natively. I'm assuming that's because wasm lacks a secondary GC but could be wrong in blaming that.
21:50:23FromGitter<krux02> @kdheepak yes
21:50:52FromGitter<kdheepak> But the modify function is passing a reference in both cases?
21:51:24FromGitter<krux02> well they are two different kinds of references.
21:51:33FromGitter<krux02> one of them is really a misnomer
21:52:02FromGitter<krux02> the ``ref object`` is strictly speaking not a reference, it is a pointer that is just called a reference
21:52:08FromGitter<kdheepak> Do you how there are there different?
21:52:21FromGitter<krux02> yes
21:52:46FromGitter<krux02> when you create an object on the stack, it is there without pointer indirection.
21:52:53Nolan[m]Or do I need to use the unsafe references for this kind of thing?
21:53:44FromGitter<krux02> when you pass it down to a function, it is unlike c passed "by reference", meaning there is a hidden pointer
21:54:36FromGitter<krux02> when you pass a stack object to a function with a ``var`` parameter, it compiles down to the same thing
21:54:50FromGitter<krux02> just this time the function is allowed to modify the object
21:55:07FromGitter<krux02> and since it is a pointer to an object on the stack tho object on the stack is modified.
21:55:33FromGitter<krux02> a ref object on the other hand is from the beginning allocated on the heap and on the stack there is just a pointer
21:55:50FromGitter<krux02> passing a ref object to a function passes a copy of that pointer to the function
21:55:59FromGitter<krux02> the function can then modify the object on the heap
21:56:38FromGitter<krux02> so after compiling both functions to C, they don't really look different at all.
21:57:02FromGitter<krux02> but the way you can pass object to the functions is very different.
21:57:56krux02Nolan[m], what is your precise problem.
21:58:35krux02Normally I would not assume it is a problem to implement a GC in wasm, it is just the overhead that is kind of stupid, when there is already a vm with a perfectly fine GC sitting around.
21:58:53krux02but I could be wrong I did not do anything with wasm.
21:59:14FromGitter<bung87> with gc enable no much things to worry about.
21:59:50Nolan[m]krux02: Segfault when calling `new(result)` where `result` is a ref. I'm trying to return an opaque pointer to JS. `--gc:none` fixed that issue, in that it disabled the GC, though to paraphrase, now I have 2 problems (or, however many problems manual memory management will ultimately lead to. :)
21:59:56FromGitter<kdheepak> Thanks @krux02 that helps a lot!
22:01:13FromGitter<kdheepak> How do I see what the c files are?
22:01:34krux02kdheepak: there is a folder called nimcache, open it and look inside
22:01:58FromGitter<kdheepak> There's no nimcache in the current folder
22:01:59krux02Nolan[m]: I don't think manual memory management is really that much of a problem in Nim, if you can use seq and string.
22:02:24krux02normally when I compile a file nim always creates a nimcache folder
22:03:03FromGitter<kdheepak> The newest version doesn't create it?
22:04:06FromGitter<bung87> it’s now under your nim prefix folder.
22:04:06*a_b_m joined #nim
22:04:24FromGitter<kdheepak> What is the nim prefix folder?
22:04:26FromGitter<kdheepak> ~/.nim?
22:04:47*NimBot joined #nim
22:05:12FromGitter<kdheepak> ~/.nimble/bin/nim
22:06:42FromGitter<kdheepak> I installed it using choosenim
22:06:51FromGitter<kdheepak> but I can't seem to find it in ~/.choosenim as
22:06:53FromGitter<bung87> well I can not for sure when using choosnim
22:07:02*abm quit (Ping timeout: 268 seconds)
22:07:28FromGitter<kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5baea62019b139275a184c8a]
22:07:55krux02Araq: I just looked at the changelog in Nim 0.18 and it says "An array[x, char] can no longer be converted to a cstring type"
22:08:18krux02that is not true, it can still be converted to a cstring type via cast, it is just not done automatically anymore.
22:08:52krux02kdheepak, I just checked nimchache as well and I am confused that I also can't find it anymore
22:09:02krux02but I am sure it was there.
22:09:14FromGitter<kdheepak> It gets created when building js
22:09:19FromGitter<kdheepak> but not when creating c
22:09:38krux02well it was defititively created when building with c
22:09:40krux02100% sure
22:09:41FromGitter<bung87> I usually using git clone version nim , it’s under ~/Nim/ in my machine
22:09:43krux02used it a lot
22:09:48krux02somebody took it away
22:10:41FromGitter<bung87> ```Nim Compiler Version 0.19.0 [MacOSX: amd64] ⏎ Compiled at 2018-09-26``` [https://gitter.im/nim-lang/Nim?at=5baea6e15a52b440159d3a2d]
22:11:07krux02my nim is "installed" in ~/proj/nim/Nim
22:11:27Araqkrux02: the 'cast' is invalid too
22:11:40Araqarrays are not pointers
22:11:43FromGitter<kdheepak> ```$ vim ~/.cache/nim/test_d/nim_glm_test.c```
22:11:51FromGitter<kdheepak> It gets created ^ here
22:12:31krux02Araq: yes true, but I actually meant casting a pointer to the array to cstring. Even though I didn't say it.
22:12:46krux02I thought that was implied
22:13:14krux02Araq: did something happen with the nimchache folder?
22:13:26Araqit moved
22:13:31krux02where is it now?
22:14:09krux02aparently it only moved partially, if you scroll a bit up, aparently the js backend still creates it at the old location.
22:14:23FromGitter<bung87> ah ` ~/Nim/nimcache/` all the std cache here
22:15:15FromGitter<bung87> ~/.cache/nim/ all you compiled cache here
22:15:57*tzui quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:16:41Nolan[m]A C-style pointer is a ref in Nim, correct? So `ref cstring` is a C string pointer?
22:16:53krux02Nolan[m], not really
22:17:00krux02a ptr is a C-style pointer
22:17:10krux02a ref is technically the same, but not for the GC
22:17:37Nolan[m]Ah.
22:18:07Araqkrux02: well for the JS I didn't touch the 'nimcache' location
22:18:51FromGitter<kaushalmodi> Araq: Appveyor failed here because it timed out? https://ci.appveyor.com/project/dom96/nim/build/4941?fullLog=true
22:18:59FromGitter<kaushalmodi> message says 1hr limit was reached
22:20:10krux02looks like some tests are running to long
22:20:14krux02ore there are too many
22:20:16krux02or both
22:20:37FromGitter<kaushalmodi> it seems arbitrary
22:20:46FromGitter<kaushalmodi> both travis and appveyor passed on this PR: https://github.com/nim-lang/Nim/pull/9110
22:20:57FromGitter<kaushalmodi> which included that "failed" PR too
22:21:00krux02sometimes you just restart
22:21:15krux02let me rephrase that
22:21:28krux02did you try to turn it off and on again?
22:21:44FromGitter<kaushalmodi> turn off what?
22:21:49krux02the test
22:21:53FromGitter<kaushalmodi> no
22:22:00krux02then do that
22:22:02FromGitter<kaushalmodi> I just pushed the commits and the test autostarts
22:22:07FromGitter<kaushalmodi> can I control that?
22:22:26krux02just do an irrelevant change.
22:22:32krux02you can even edit on github
22:22:38krux02add a space somewhere
22:22:48Araqalso common is to close and reopen the PR
22:22:48FromGitter<kaushalmodi> yeah, let me try force push
22:22:54*speak10 joined #nim
22:23:35Araqand yeah, we would pay Appveyor and Travis money if it means these timeouts go away, so far I haven't found clues that's part of their pricing models
22:23:36FromGitter<kaushalmodi> hmm.. close/reopen did not help
22:23:52Araqit does, give it a minute.
22:24:03FromGitter<kaushalmodi> it did :)
22:24:04FromGitter<kaushalmodi> thanks
22:24:16*tzui joined #nim
22:24:18Nolan[m]OK, so I'm trying to return a ptr DbConn but `db_sqlite.open` returns a DbConn. How do I make it a pointer? I'm assigning to result in a proc that returns the ptr.
22:26:43FromGitter<rayman22201> addr or unsafe addr @Nolan[m]?
22:27:03FromGitter<rayman22201> https://nim-lang.org/docs/manual.html#statements-and-expressions-the-addr-operator
22:27:23Nolan[m]Thanks.
22:29:13*speak10 quit (Ping timeout: 245 seconds)
22:34:19FromGitter<kdheepak> In this example, is TeacherRef created on the stack or the heap? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5baeac6b435c2a518e22972a]
22:41:14FromGitter<kdheepak> i.e. if I inherit from a ref, is the final type also a ref?
22:43:19FromGitter<kdheepak> I think it is not.
22:45:04shashlickany way to define the following? crashes on 0.18.0 but works on 0.19.0
22:45:04shashlick```
22:45:06shashlick pair* {.importcpp: "std::pair", header: "<utility>".}[T, U] = object
22:45:07shashlick first*:T
22:45:08shashlick second*:U
22:45:09shashlick```
22:54:33*mzo joined #nim
22:55:20mzohi
22:55:43FromGitter<rayman22201> Was a fraking one line fix: https://github.com/nim-lang/Nim/pull/9112
22:56:05FromGitter<rayman22201> @kaushalmodi or @araq if you want to check it out to verify the fix works
22:56:18FromGitter<rayman22201> I checked it myself, but more eyes and all that.
22:57:01FromGitter<kdheepak> I think this might be my last question for today: ⏎ ⏎ The following prints out: `@[<PersonRef(name: "John")>, <PersonRef(name: "John")>]` ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5baeb1bd5331811c2e1f52b0]
22:57:07FromGitter<rayman22201> I should probably add some automated tests for the fuzzy matcher... 😔
22:57:15FromGitter<kdheepak> Is there a way to make it print out `TeacherRef` instead?
22:57:32FromGitter<rayman22201> hi @mzo
23:01:28mzoi'm just looking at nim, very new to the language. i'm wondering why this openArray type is necessary. shouldn't arrays just be a subtype of sequence? also is openArray something that is built into the language, or can in be defined in Nim itself? i.e., is openArray a keyword or does it have a definition somewhere in a Nim module?
23:02:13FromGitter<kayabaNerve> It's in system.nim which is implicitly imported into everything
23:02:43FromGitter<rayman22201> An array is very different from a sequence
23:02:51FromGitter<rayman22201> they are not subtypes
23:03:34FromGitter<bung87> in other language array also fixed size.
23:04:05FromGitter<kaushalmodi> mzo: https://nim-lang.org/docs/manual.html#types-open-arrays
23:04:59FromGitter<rayman22201> openArray is sort of a built in interface that sequence and arrays conform to
23:05:09FromGitter<kaushalmodi> @rayman22201 I'll try your PR tomorrow. Just reading it makes a lot of sense :D
23:05:30FromGitter<rayman22201> 👍 cool
23:07:25FromGitter<rayman22201> It took me longer to build the latest nim devel compiler and docs than to actually do the fix X.X
23:07:45FromGitter<rayman22201> so stupid... lol...
23:08:03FromGitter<kaushalmodi> :)
23:08:16FromGitter<kaushalmodi> mzo: here's my exploration of the open arrays topic: https://scripter.co/notes/nim/#open-arrays
23:10:45FromGitter<rayman22201> @kaushalmodi good notes :-D
23:11:28FromGitter<kdheepak> If I add an instance of a type to a seq, then it changes type?
23:11:45FromGitter<kdheepak> It is coerced to the type of the seq?
23:12:06FromGitter<kdheepak> Example here: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5baeb5461c100a4f2901ed85]
23:12:39FromGitter<kdheepak> I want to print `TeacherRef` when the sequence is printed, but it always prints PersonRef.
23:12:57FromGitter<kdheepak> I don't think I'm able to find a way to do this
23:13:15FromGitter<kdheepak> Changing the ```proc`$```` also does not work
23:13:26FromGitter<kdheepak> help?
23:13:28FromGitter<rayman22201> @kdheepak idk a lot about Nim OOP, but I don't think there is a way to do it at runtime like you are asking.
23:13:32FromGitter<kaushalmodi> @kdheepak I believe there are few issues like this related to typetraits already open.
23:13:51FromGitter<kaushalmodi> Search for typetraits in issues.
23:13:55FromGitter<kdheepak> Okay, thanks.
23:14:16FromGitter<kdheepak> I did look through them. I didn't see a answer one way or the other.
23:14:29FromGitter<kdheepak> Any way to do this using macros / templates?
23:14:52FromGitter<rayman22201> This isn't really a typetraits thing, it's more like a standard inheritance thing...
23:15:27FromGitter<bung87> it does not know which type you want representation.
23:15:44FromGitter<kaushalmodi> @rayman22201 hmm ok
23:15:55FromGitter<rayman22201> Generally, if you put a sublcass into a container of type parent class, you loose the information. That's a classic type erasure problem. Happens in C++ the same way
23:16:26FromGitter<bung87> imagenation A inherit from B ,C inherit from B , which one you want representation?
23:17:57FromGitter<rayman22201> What you can do is use instanceof to create a switch statement: https://nim-lang.org/docs/manual.html#types-tuples-and-object-types
23:18:23FromGitter<rayman22201> I'm sorry, it's "of", not instanceof
23:18:36*scorcoran20 joined #nim
23:18:56FromGitter<bung87> it’s js keyword ha.
23:19:29FromGitter<kdheepak> I think it's not possible. I get a compile error. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5baeb7011e23486b935d83c9]
23:19:52FromGitter<kdheepak> I added `age` for `TeacherRef` ⏎ ⏎ ``` TeacherRef = ref object of PersonRef ⏎ age: int``` [https://gitter.im/nim-lang/Nim?at=5baeb718c7bf7c36628960ac]
23:20:04FromGitter<rayman22201> what compile error do you get?
23:20:34FromGitter<kdheepak> ```code paste, see link```
23:20:58FromGitter<rayman22201> oh! You have to cast it first
23:20:59FromGitter<kdheepak> In that proc, nim thinks `p` is `PersonRef` and not `TeacherRef`.
23:21:39FromGitter<rayman22201> the "of" operator tells you that it is a TeacherRef, but it won't convert it to a TeacherRef for you
23:21:43FromGitter<kdheepak> How do I cast?
23:21:53FromGitter<rayman22201> pulling up the docs for it. hold on.
23:22:07FromGitter<bung87> castX (Y)
23:22:16FromGitter<bung87> `castX (Y)`
23:22:33FromGitter<kdheepak> ``` var p = cast[TeacherRef](p)```
23:22:36FromGitter<kdheepak> So that worked.
23:22:40FromGitter<rayman22201> https://nim-lang.org/docs/manual.html#statements-and-expressions-type-casts
23:22:43FromGitter<rayman22201> oh, yeah
23:22:45FromGitter<rayman22201> there you go
23:22:47FromGitter<rayman22201> lol
23:22:53*scorcoran20 quit (Remote host closed the connection)
23:23:09FromGitter<kdheepak> But what happens if I pass in a PersonRef to it, and it tries to cast it to TeacherRef?
23:23:19FromGitter<bung87> keep in mind , you’re programing in static type language..
23:23:19FromGitter<rayman22201> I have too many languages in my head, so I always have to look synta up first to make sure
23:24:15FromGitter<kdheepak> Huh. That is so odd. If I run this example: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I get the following: ... [https://gitter.im/nim-lang/Nim?at=5baeb81eef4afc4f28eea047]
23:24:59FromGitter<rayman22201> You need to put the cast inside the if
23:25:30FromGitter<rayman22201> you are casting `p` before checking what `p` even is
23:25:52FromGitter<rayman22201> Nim is nice to you here. In C/C++ that would segv
23:25:54FromGitter<rayman22201> :-P
23:25:54FromGitter<kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5baeb8825331811c2e1f7a67]
23:26:26FromGitter<rayman22201> yeah, The Nim compiler was even smart enough to warn you that you were doing something silly :-P nice
23:26:51FromGitter<bung87> you do the things like castbool (1) == true.
23:26:52FromGitter<kdheepak> This seems to work though ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5baeb8bcef4afc4f28eea25d]
23:27:11FromGitter<bung87> you do the things like `castbool (1) == true`
23:27:31FromGitter<kdheepak> Great! I think I got what I needed!
23:27:43FromGitter<kdheepak> Thanks everyone! You are all super helpful!
23:28:13FromGitter<rayman22201> np! Glad to have more Nim programmers :-)
23:30:09FromGitter<rayman22201> So, my big question of the day. @zacharycarter when does nim-playground get upgraded to use Nim 0.19? :-)
23:53:31*mzo left #nim ("Leaving")