00:04:45 | * | renard_19 joined #nim |
00:05:31 | * | renard_19 quit (Remote host closed the connection) |
00:08:16 | FromGitter | <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:51 | FromDiscord | <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:17 | FromGitter | <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:47 | Nolan[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:36 | Nolan[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:26 | AlexMax | Hrm |
01:47:34 | AlexMax | this converted function wants a cStringArray |
01:48:01 | AlexMax | is there any reason why I can't cast an array[5, cstring]? |
01:50:54 | AlexMax | also 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:43 | cavariux | AlexMax a const variable is parsed by the compiler |
02:22:03 | cavariux | and a cStringArray is a pointer to a cstring you can cast it |
02:22:29 | AlexMax | Yeah, so whatever is assigned to the const variable ends up in the data segment no? |
02:22:42 | AlexMax | that's addressible |
02:23:16 | cavariux | const variables can be optimized by the compiler so generally they are more into place for modification at compile time not at runtime |
02:23:50 | cavariux | it's an rvalue to put it like like a more c++ way |
02:25:25 | * | chamar joined #nim |
02:25:48 | AlexMax | so 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:23 | cavariux | yep, if you want something const that has an addr you can use a let and use unsafeAddr |
02:26:32 | AlexMax | so I could say `const x = 4; foo(x)` |
02:26:40 | AlexMax | and it would end up as `foo(4)`? |
02:26:49 | cavariux | only if foo can be runned at compile time |
02:26:51 | AlexMax | well, wait, that's a bad example |
02:27:03 | AlexMax | since that's a function call and rvalues don't even enter into it. |
02:27:30 | AlexMax | cavariux: I'm basically trying to expose an array of C strings to a wrapped C function |
02:27:36 | AlexMax | But without "allocating" them |
02:28:03 | AlexMax | And the wrapped C function demands a cStringArray |
02:28:11 | cavariux | the library that you are wrapping manages the memory for you? |
02:28:22 | cavariux | of the strings |
02:29:10 | AlexMax | Not really? |
02:29:34 | AlexMax | It's a proceedure that takse a const char **items, int count |
02:29:44 | cavariux | you can pass a ptr cstring to that |
02:30:02 | cavariux | or a ptr to the first object of an array of cstrings |
02:30:21 | AlexMax | And in the C version of the demo, it passes this to the function: |
02:30:23 | AlexMax | static const char *weapons[] = {"Fist","Pistol","Shotgun","Plasma","BFG"}; |
02:30:45 | AlexMax | so basically, a constant array of c strings |
02:30:55 | cavariux | I guess you could pass the ptr to the first object of a cstring array |
02:31:02 | cavariux | and in the count pass the len of the array |
02:33:09 | AlexMax | so, this, essentially |
02:33:11 | AlexMax | https://paste.ee/p/idKDJ |
02:33:34 | AlexMax | There's no function for it, so I just want to make sure I'm not invoking zalgo by doing this |
02:33:46 | cavariux | yep, I think that would work |
02:35:41 | FromGitter | <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:02 | leorize | `var a: SomeType` |
02:36:16 | leorize | will initialize all of them, ... |
02:36:26 | leorize | What exactly do you want to do? |
02:36:52 | cavariux | `var a: YourType |
02:36:52 | cavariux | a.oneIwant = whatever` |
02:36:52 | cavariux | remember that nim doesn't have constructors |
02:37:25 | leorize | or even `var a = YourType(whatIwant: value)` |
02:40:12 | FromGitter | <kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bad948c01fb5f4ae1335b77] |
02:40:31 | FromGitter | <kdheepak> If nim doesn't have constructors, then I think what I'm asking is not possible? |
02:41:38 | leorize | make a proc called `newAnimal(s: string)` |
02:41:44 | leorize | that returns an Animal |
02:42:14 | * | skellock quit (Quit: WeeChat 1.9.1) |
02:42:26 | leorize | then you initialize your var with `var d = newAnimal("dog")` |
02:42:49 | FromGitter | <kdheepak> Got it. Presumably I can have multiple procs called `newAnimal`, right? |
02:42:58 | FromGitter | <kdheepak> As different "constructors" |
02:43:19 | leorize | yes, proc overload will help you with that |
02:43:44 | cavariux | AlexMax I just tested it and it worked |
02:43:52 | leorize | btw, if it only creates object on the stack then name it `initAnimal()` |
02:44:02 | leorize | See https://nim-lang.org/docs/nep1.html for API naming convention |
02:44:28 | FromGitter | <kdheepak> Thank you! |
02:46:31 | FromDiscord | <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:35 | AlexMax | cavariux: Thanks. |
03:07:32 | shashlick | I 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:13 | FromGitter | <7sDream> (https://files.gitter.im/nim-lang/Nim/J877/Xnip2018-09-28_11-26-41.jpg) |
03:27:36 | FromGitter | <7sDream> emmm, where is the nimpretty binary? |
03:27:40 | * | DEac-2 quit (Remote host closed the connection) |
03:29:04 | leorize | have you built it? |
03:30:07 | FromGitter | <7sDream> I don’t know I need built it myself. It’s not a part of offical toolchain? |
03:30:23 | FromGitter | <7sDream> like nimsuggest |
03:30:38 | leorize | are you on nim 0.19.0? |
03:30:39 | FromDiscord | <Shield> it seems that it's not automatically built |
03:30:47 | FromGitter | <7sDream> yes |
03:30:49 | leorize | it should be a part. I've not checked though |
03:30:57 | leorize | it's in Nim/nimpretty |
03:33:33 | FromGitter | <7sDream> Thx, will check it |
03:34:21 | * | chamar quit (Read error: Connection reset by peer) |
03:50:05 | bozaloshtsh | so 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:14 | bozaloshtsh | it=nimble |
03:50:38 | bozaloshtsh | seemed like an obvious fix, but import system.nimscript and permutations of that didn't do anything |
03:51:50 | * | chemist69 joined #nim |
03:55:16 | dom96 | You probably have an old version of Nim hidden somewhere |
03:56:25 | dom96 | or you're using an old nimble |
03:56:34 | dom96 | Are you sure you're calling the 0.9 one? |
03:56:48 | dom96 | As a workaround you can edit this file: https://github.com/nim-lang/Nim/blob/devel/lib/system/nimscript.nim#L322 |
04:03:51 | FromDiscord | <Shield> is there a way to know the order of code executed using static |
04:10:27 | bozaloshtsh | dom96: pretty sure. I pull from devel and compile manually so I doubt there's any old files sitting anywhere |
04:10:42 | bozaloshtsh | nimble --version and nim --version both show up as latest |
04:11:23 | bozaloshtsh | Was there any change that could even cause this? That's what I'm most confused about. |
04:11:28 | dom96 | maybe try removing anything related to Nimble in /tmp |
04:11:49 | dom96 | Shield: huh? Top to bottom? |
04:13:03 | bozaloshtsh | removed, same response |
04:13:36 | bozaloshtsh | I'll try to reproduce in a clean env |
04:15:11 | bozaloshtsh | ok, I'm doing something stupid because it works with a clean environment |
04:16:16 | bozaloshtsh | removing the cache probably fixed it |
04:18:43 | bozaloshtsh | next question: from 0.18 to 0.19, I'm noticing that the map proc for seqs isn't dispatching correctly |
04:19:07 | bozaloshtsh | it'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:23 | bozaloshtsh | I'm reading through the changes but can't find anything related to this |
04:25:16 | FromDiscord | <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:32 | FromDiscord | <Shield> I think the compiler can't guarantee the order of loading modules |
04:27:23 | FromGitter | <kayabaNerve> Why do objects have a `$` operator? I meant to ask. |
04:28:08 | bozaloshtsh | kabayaNerve: not sure... now that you mention it I don't remember there being a default |
04:28:41 | FromGitter | <kayabaNerve> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5badadf9eba8e60bc65844c8] |
04:28:46 | * | nc-x joined #nim |
04:29:21 | bozaloshtsh | it looks like (field1: val1, field2:val2, ...) |
04:29:27 | FromGitter | <kayabaNerve> Yeah |
04:29:29 | FromGitter | <kayabaNerve> That's the default |
04:29:47 | bozaloshtsh | when was that added? |
04:30:03 | FromGitter | <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:14 | FromGitter | <kayabaNerve> If I want the debugging, I'll write the $. |
04:30:21 | nc-x | kayabaNerve: Well there *was* an RFC to remove default $ from objects. |
04:30:23 | bozaloshtsh | it seriously screwed up my code, especially because map dispatches to the default instead of mine now |
04:30:24 | nc-x | https://github.com/nim-lang/Nim/issues/8023 |
04:30:44 | bozaloshtsh | corrupted the state of my application hard, luckily I had a backup |
04:32:25 | FromGitter | <kayabaNerve> So it seems dom96 likes it but Araq agreed it should disappear. That said, the community like it. |
04:32:35 | FromGitter | <kayabaNerve> What if we forced it to be under a pragma/define? |
04:33:13 | dom96 | bozaloshtsh: if you could figure out what caused that Nimble problem and report it on GitHub that would be a big help |
04:33:18 | dom96 | Guessing others will run into this too :( |
04:33:37 | nc-x | i 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:27 | bozaloshtsh | dom96: I'll try. Perhaps a static message in nimble to remind the user to delete the cache is in order? |
04:35:44 | dom96 | yep |
04:36:38 | bozaloshtsh | ok, now that I know that system.$ exists, how can I get map to resolve my $? I'm actually calling map FROM my $ |
04:38:03 | bozaloshtsh | basically $(o: myobj) = o.listfield.map($) or base case |
04:38:07 | bozaloshtsh | where o.listfield is seq[myobj] |
04:38:27 | * | nc-x quit (Ping timeout: 256 seconds) |
04:39:12 | bozaloshtsh | I 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:38 | nc-x | is your $ defined properly? |
04:42:29 | bozaloshtsh | define properly. |
04:42:48 | bozaloshtsh | proc `$`*(x: MyType): string {.inline, procvar.} = |
04:44:03 | nc-x | Does 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:17 | FromGitter | <kayabaNerve> I made a comment on a closed isssue and GitHub doesn't bump it up |
04:44:19 | FromGitter | <kayabaNerve> Damn ot |
04:44:36 | FromGitter | <kayabaNerve> dom96 Have a second? |
04:45:33 | nc-x | kayabaNerve https://github.com/nim-lang/Nim/issues?utf8=✓&q=sort%3Aupdated-desc+ shows it on the top |
04:46:02 | FromGitter | <kayabaNerve> Since you were in favor of system.$, mind reviewing my statement here: https://github.com/nim-lang/Nim/issues/8023 |
04:46:13 | bozaloshtsh | nc-x: mymodule.$ doesn't work, but $ is in the file I'm calling it from because it's recursive |
04:46:28 | bozaloshtsh | mymodule.$ fails due to some type mismatch that I am currently reading |
04:46:28 | FromGitter | <kayabaNerve> Thanks nc-x |
04:46:56 | nc-x | bozaloshtsh: can you post the code in pastebin/ix/somewhere else |
04:47:03 | bozaloshtsh | nc-x: I'm working on a minimum example |
04:47:07 | bozaloshtsh | also mapIt($it) works lol |
04:47:30 | bozaloshtsh | It's a bit weird because it requires recursive $ which means sum type |
04:51:29 | * | nc-x quit (Ping timeout: 256 seconds) |
04:57:37 | leorize | kayabaNerve: 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:56 | FromGitter | <kayabaNerve> leorize: Posted there. |
05:07:19 | * | sagax joined #nim |
05:08:07 | FromDiscord | <Shield> https://github.com/golang/go/issues/26623 |
05:08:20 | FromDiscord | <Shield> it's sad to see Nim missing from a benchmark |
05:09:18 | cavariux | I 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:48 | nc-x | crystal has many people of ruby background |
05:12:14 | cavariux | nim would have many people of python and c background |
05:12:31 | nc-x | python and c people have been resistant |
05:12:51 | nc-x | many ruby people moved to crystal because it was too similar |
05:13:28 | nc-x | but it is now biting their back though. because of their type inference, compilation is very slow. |
05:13:52 | nc-x | if they change to local type inference now. people will be angry. so they are stuck. |
05:15:17 | nc-x | but anyways crystal is pretty good too. except that i am on windows and crystal is not |
05:15:33 | cavariux | oh, isn't like more than 50% of developers on windows lol? |
05:16:37 | nc-x | nim 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:55 | FromGitter | <kayabaNerve> My project, not a lib, is building a site. |
05:18:06 | FromDiscord | <Shield> and libraries |
05:18:08 | FromGitter | <kayabaNerve> Turns out web devs are kinda hard to find. |
05:18:29 | nc-x | nim can have an advantage over crystal/rust if we get a dedicated developer for tooling - nimpretty/nimsuggest etc. |
05:19:00 | nc-x | because their alternatives to nimsuggest is pretty bad |
05:19:20 | cavariux | tbh nim can beat by far go and rust |
05:19:25 | FromGitter | <gogolxdong> Is there any android or IOS development example? |
05:19:28 | FromDiscord | <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:34 | cavariux | sadly nim isn't backed up by a huge company |
05:19:36 | nc-x | rust's rls takes 5 seconds for me for even simple things like showing red error sqiggles |
05:19:40 | FromGitter | <gogolxdong> We might need native APP. |
05:20:11 | nc-x | I hope the new recruit can work on tooling |
05:20:23 | FromGitter | <gogolxdong> besides web. |
05:20:41 | cavariux | Shield exactly my thinking, nim is the most apropiate language for 90% of game dev projects except maybe bc tooling for AAA |
05:22:55 | FromDiscord | <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:23 | cavariux | haha good point, do you have a background in graphics programming? |
05:24:55 | * | nc-x quit (Ping timeout: 256 seconds) |
05:24:57 | FromDiscord | <Shield> only for 2d games |
05:25:26 | * | yuriwho21 joined #nim |
05:27:26 | FromGitter | <kayabaNerve> cavariux Status is one of the biggest Ethereum people. |
05:27:40 | * | yuriwho21 quit (Remote host closed the connection) |
05:27:46 | FromGitter | <kayabaNerve> *companies |
05:27:55 | FromDiscord | <Shield> just started learning about webdev |
05:28:06 | cavariux | kayabaNerve yeah I guess but it starts slow and go has been backed up by google since the beginning and rust by mozilla |
05:28:38 | cavariux | Shield oh that's nice, are you using any nim libraries atm? |
05:28:40 | FromDiscord | <Shield> what do you think about mofuw? |
05:28:45 | FromGitter | <kayabaNerve> 108 Million dollars in one of the largest ICOs of all time. |
05:30:02 | cavariux | oh well mofuw isn't actively in development I think |
05:31:46 | FromDiscord | <Shield> oh wow it got discontinued yesterday... |
05:32:28 | FromDiscord | <Shield> well, I couldn't use karakx when I had 0.18.0 but I guess it's usable after the update |
05:36:10 | FromDiscord | <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:56 | FromDiscord | <Shield> there's also Raylib which is easy to bind, i did it using c2nim |
05:38:15 | FromDiscord | <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:21 | FromGitter | <kdheepak> How do you convert from a `char` to a `string` in Nim? |
06:32:04 | FromDiscord | <Shield> use $ |
06:35:39 | FromGitter | <kdheepak> Is there a way to return a immutable object? |
06:35:54 | FromGitter | <kdheepak> Thanks @Shield |
06:36:55 | * | vlad1777d joined #nim |
06:39:14 | FromGitter | <codenoid> good night all |
06:43:25 | leorize | kdheepak: no, it's not possible to return an immutable object (yet) |
06:43:45 | FromGitter | <kdheepak> Thanks. |
06:44:13 | FromGitter | <kdheepak> If I set it to `let` and return it from a function, it is immutable only in the function scope? |
06:44:34 | leorize | what do you mean? |
06:49:14 | FromGitter | <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:28 | leorize | yes |
06:49:29 | FromGitter | <kayabaNerve> I believe the answer is yes @kdheepak |
06:49:49 | FromGitter | <kayabaNerve> Yep Since they're not pointers, they copy the value. |
06:49:58 | leorize | `return a` is just -> `result = a; return result` |
06:50:24 | FromGitter | <kayabaNerve> That said @Quelklef built an awesome library to make sure object fields are only set oncw |
06:50:37 | FromGitter | <kayabaNerve> So you can create immutable object fields |
06:50:45 | FromGitter | <kayabaNerve> https://github.com/Quelklef/nim-finals |
06:52:31 | FromGitter | <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:19 | FromGitter | <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:38 | FromGitter | <kayabaNerve> I also just create a fricking ton of objects with it. |
07:00:22 | FromGitter | <narimiran> leorize: you don't have to `return result`, it is automatically returned at the end of your proc |
07:01:02 | leorize | I know, was just trying explain `return <something>` |
07:01:30 | leorize | that said, it should be `return` instead :P explain it the way I did create an infinite loop |
07:06:37 | FromGitter | <gogolxdong> Is the author of Reel Valley around? |
07:15:26 | FromGitter | <kdheepak> Is there a way to convert a string to a raw string? |
07:19:31 | leorize | what is a raw string? |
07:19:47 | leorize | there is only `string` |
07:19:47 | FromGitter | <7sDream> raw bytes? |
07:19:53 | FromGitter | <kdheepak> https://nim-lang.org/docs/manual.html#lexical-analysis-generalized-raw-string-literals |
07:20:12 | leorize | `r"raw string here"` |
07:20:14 | FromGitter | <kdheepak> I have a character `\n`. |
07:20:38 | leorize | see my msg above |
07:20:56 | FromGitter | <kdheepak> ```var c = '\n' ⏎ # TODO ⏎ echo c # should print `\n` and not `newline`.``` [https://gitter.im/nim-lang/Nim?at=5badd658aedb375b9c5bc9fc] |
07:21:46 | FromGitter | <kdheepak> @leorize, does that make sense? I know there's r"raw string" but how to do I use that for printing? |
07:21:47 | FromGitter | <narimiran> @kayabaNerve see if this helps: https://narimiran.github.io/nim-basics/#_special_characters |
07:21:57 | leorize | !eval echo '\\n' |
07:21:58 | NimBot | Compile failed: in.nim(1, 9) Error: missing final ' for character literal |
07:22:18 | leorize | !eval echo NimVersion |
07:22:21 | NimBot | 0.18.0 |
07:22:23 | * | apache216 joined #nim |
07:22:33 | leorize | !eval echo r"\n" |
07:22:35 | NimBot | \n |
07:22:46 | FromGitter | <narimiran> leorize: your single quotes are not the same character, it seems to me |
07:22:59 | FromGitter | <narimiran> !eval echo '\n' |
07:23:01 | NimBot | ↵ |
07:23:04 | leorize | !eval echo '\\n' |
07:23:05 | * | apache216 quit (Remote host closed the connection) |
07:23:06 | NimBot | Compile failed: in.nim(1, 9) Error: missing final ' for character literal |
07:23:26 | leorize | is there some magic going on with my irc client? |
07:23:28 | FromGitter | <narimiran> again same thing. some autocorrect is happening on your end |
07:24:01 | leorize | oh btw narimiran, my echo have 2 `\\` |
07:24:17 | leorize | lol it appears if you have those backticks |
07:24:22 | FromGitter | <narimiran> ooops, the above message with the link was not for @kayabaNerve but for @kdheepak |
07:25:07 | FromGitter | <kdheepak> @narimiran Thanks for the link. That almost answers it. |
07:25:20 | FromGitter | <kdheepak> I have the `var c = '\n'` |
07:25:55 | FromGitter | <kdheepak> Let's say I'm parsing a file, and store the character in `var c`. |
07:26:06 | leorize | it's only a problem with literals |
07:26:15 | leorize | in variables it doesn't mean anything |
07:26:21 | FromGitter | <kdheepak> How do I then print it out without creating a new line? |
07:27:13 | leorize | you just print it |
07:27:20 | leorize | stdout.write |
07:28:15 | leorize | !eval var c = r"\n"; echo c |
07:28:17 | NimBot | \n |
07:28:24 | leorize | kdheepak: there |
07:34:03 | FromGitter | <kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5badd96bcdc5013172664ba7] |
07:34:20 | FromGitter | <mratsim> @Shield If you want to apply the transformation from a macro in another macro you need to use getAst |
07:34:31 | FromGitter | <kdheepak> @leorize does that question make sense? |
07:35:06 | FromGitter | <mratsim> @kdheepak someone asked the same the past week in the forum |
07:35:27 | FromGitter | <mratsim> use stdout.write or something like that |
07:35:30 | FromGitter | <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:40 | FromGitter | <gogolxdong> Have you figured out why nim cpp faster than nim c? |
07:35:43 | leorize | kdheepak: so uh: `if c == '\n': continue? |
07:35:44 | FromGitter | <mratsim> no, don’t use echo |
07:36:35 | FromGitter | <kdheepak> I want to print out `\n` instead of a new line. |
07:36:52 | FromGitter | <mratsim> @kdheepak https://forum.nim-lang.org/t/4107 |
07:37:26 | FromGitter | <mratsim> replace "\n" by “\\n" |
07:37:30 | leorize | kdhepakk: `r"hello\nworld"` ? |
07:38:01 | FromGitter | <mratsim> or “””Hello\nWorld””" |
07:38:10 | FromGitter | <mratsim> triple quote would escape everything |
07:38:10 | FromGitter | <kdheepak> @leorize I'm reading the string from a file, I can't change that. |
07:38:27 | leorize | so yes, your way is correct, but don't use `echo` since it will add a newline |
07:38:59 | FromGitter | <kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5badda9353c31c1111787339] |
07:39:49 | leorize | !eval const s = "hello\nworld"; for i in s: if i == '\n': stdout.write r"\n" else: stdout.write c |
07:39:50 | NimBot | Compile failed: in.nim(1, 39) Error: complex statement requires indentation |
07:40:07 | leorize | !eval const s = "hello\nworld"; for i in s: (if i == '\n': stdout.write r"\n" else: stdout.write c) |
07:40:08 | NimBot | Compile failed: in.nim(1, 92) Error: undeclared identifier: 'c' |
07:40:13 | leorize | !eval const s = "hello\nworld"; for i in s: (if i == '\n': stdout.write r"\n" else: stdout.write i) |
07:40:15 | NimBot | hello\nworld |
07:40:34 | FromGitter | <kdheepak> Yup! That's it! |
07:41:02 | FromGitter | <kdheepak> Now I have to do the same thing for tabs. |
07:43:56 | FromGitter | <mratsim> case tok of ‘\t’: stdout.write … of ‘\n’: stdout.write … else: …. |
07:55:04 | FromGitter | <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:22 | FromGitter | <kdheepak> Yes! |
07:55:35 | FromGitter | <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:04 | FromGitter | <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:15 | FromGitter | <Bennyelg> header is including all the js importing etc.. |
08:31:33 | Zevv | https://github.com/drujensen/fib :) |
08:39:43 | FromGitter | <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:17 | FromGitter | <Bennyelg> Interesting Question, I guess a second edition is required |
08:40:31 | FromGitter | <7sDream> Or erratum page, at least |
08:41:25 | FromGitter | <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:46 | FromGitter | <7sDream> In particular, this is the only published book of Nim for now |
08:42:05 | FromGitter | <Bennyelg> Yea |
08:43:15 | PMunch | https://forum.nim-lang.org/t/3716 |
08:44:06 | PMunch | Zevv, yeah Nim is now fastest of the compiled static languages, and amongst the fastest in the optimized version :) |
08:44:30 | PMunch | Bennyelg, 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:23 | FromGitter | <mratsim> @7sDream, compile with -d:laxStrings it should revert to the old behaviour |
08:58:24 | FromGitter | <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:21 | FromGitter | <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:00 | FromGitter | <7sDream> some code in *Nim in Action*: |
09:00:07 | FromGitter | <7sDream> `````` |
09:00:17 | FromGitter | <gogolxdong> Does fib benchmark mean we'd better compile Nim with cpp in production? |
09:00:17 | FromGitter | <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:33 | FromGitter | <7sDream> ```assert discarded() == nil``` |
09:00:45 | FromGitter | <7sDream> will raise exception |
09:00:47 | * | leorize quit (Ping timeout: 240 seconds) |
09:01:17 | Araq | gogolxdong: yeah, probably |
09:04:08 | FromGitter | <gogolxdong> Got it, strange, nim cpp faster than nim c |
09:04:25 | FromGitter | <mratsim> I think it’s constant propagation |
09:04:42 | * | seni joined #nim |
09:04:55 | FromGitter | <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:53 | FromGitter | <mratsim> anyway I have an idea for a 0s bench. |
09:06:08 | FromGitter | <mratsim> just add static(fix(46)) :P |
09:06:12 | FromGitter | <mratsim> fib* |
09:10:32 | * | aramiscd25 joined #nim |
09:11:25 | * | TheLemonMan joined #nim |
09:11:52 | TheLemonMan | 'grats everybody for this release |
09:12:01 | FromGitter | <mratsim> congrats to you |
09:13:54 | * | aramiscd25 quit (Remote host closed the connection) |
09:16:04 | TheLemonMan | hey, I said that first! |
09:16:32 | Araq | yeah, you deserve special fame, TheLemonMan |
09:18:45 | TheLemonMan | you're far too kind, I just fix stuff (and break some other stuff) |
09:19:16 | FromGitter | <mratsim> static fibonacci was a false dream “interpretation requires too many iteration”, though the memoized version might work |
09:21:57 | Araq | TheLemonMan, but that's what we need the most, people who just fix stuff instead of messing around with macros/concepts/destructors :P |
09:22:42 | FromGitter | <mratsim> add generics and static to that list :P |
09:23:02 | Araq | and now that you've fixed so many bugs... what do you consider the worst part of Nim? |
09:23:11 | FromGitter | <mratsim> Aka we need Rob Pike? :P |
09:24:03 | Araq | maybe we need a fixed Rob Pike who doesn't believe in pathetic stringly typed solutions. |
09:24:12 | * | fbred0 joined #nim |
09:25:17 | FromGitter | <mratsim> Nice quote about Go “simplicity”: https://news.ycombinator.com/item?id=16102260 |
09:26:45 | TheLemonMan | the 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:15 | FromGitter | <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:59 | Araq | mratsim: Overloading resolution. |
09:31:21 | FromGitter | <mratsim> so it’s the cause of that? https://github.com/nim-lang/Nim/issues/9093 |
09:31:38 | Araq | no. |
09:32:32 | TheLemonMan | I'd say the root cause of that is the separation between procs and iterators |
09:33:34 | FromGitter | <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:24 | TheLemonMan | since you're in type() the compiler doesn't care |
09:39:34 | * | jouni_28 quit (Remote host closed the connection) |
09:41:06 | FromGitter | <ephja> one step closer to working concepts https://gist.github.com/ephja/b613cb3b1e9d59e2e88032328a8b3628 |
09:43:38 | Araq | I think we need a real 'typeof' proc that takes a parameter enum preferIter, preferProc |
09:49:57 | FromGitter | <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:20 | FromGitter | <mratsim> in non-ref object inheritance* |
09:50:24 | * | Gogh4 joined #nim |
09:50:47 | * | Gogh4 quit (Remote host closed the connection) |
09:50:54 | FromGitter | <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:49 | FromGitter | <tim-st> maybe this is quicker with main proc? https://github.com/drujensen/fib/blob/master/fib_mem.nim |
09:56:53 | FromGitter | <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:57 | FromGitter | <mratsim> i.e. bench needed |
09:57:46 | FromGitter | <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:22 | crem | Was something done for better destructor support recently (last year)? |
09:59:07 | FromGitter | <tim-st> @mratsim do you think that would be a good idea? |
09:59:07 | leorize | yes, a lot recently |
09:59:12 | * | Calinou quit (Quit: http://quassel-irc.org - Discuter simplement. Partout.) |
09:59:16 | crem | In 0.19? |
09:59:27 | * | Calinou joined #nim |
09:59:52 | leorize | tim-st: IIRC Araq once talk about doing automated transformation for that, but he said there were more serious bugs to fix |
10:00:01 | FromGitter | <mratsim> @tim-st, not sure, the main impact is the life-time of global variables, and triggering finalizers and destructors |
10:00:16 | leorize | crem: yes |
10:00:22 | FromGitter | <tim-st> ok, thanks |
10:00:22 | * | tzui quit (Read error: Connection reset by peer) |
10:00:34 | FromGitter | <ephja> do futures have to allocate? :p |
10:00:47 | crem | leorize: cannot find anything related in changelog.. |
10:01:35 | leorize | it'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:32 | FromGitter | <mratsim> @ephja yes |
10:12:50 | FromGitter | <mratsim> closure iterators allocate and Future are built on top |
10:15:28 | FromGitter | <kaushalmodi> !eval const s = "hello\nworld"; for i in s: echo i.repr |
10:15:30 | NimBot | 'h'↵'e'↵'l'↵'l'↵'o'↵'\10'↵'w'↵'o'↵'r'↵'l'↵'d' |
10:16:02 | FromGitter | <kaushalmodi> @kdheepak ^ Use `repr` |
10:17:59 | FromGitter | <kaushalmodi> !eval const s = "hello\n\tworld👋"; for i in s: echo i.repr |
10:18:01 | NimBot | 'h'↵'e'↵'l'↵'l'↵'o'↵'\10'↵'\9'↵'w'↵'o'↵'r'↵'l'↵'d'↵'\240'↵'\159'↵'\145'↵'\139' |
10:20:56 | FromGitter | <kdheepak> Thanks @kaushalmodi that seems to print `\10`. |
10:21:05 | FromGitter | <kdheepak> I guess I'll have to make do with that. |
10:25:21 | FromGitter | <kaushalmodi> That's the ascii; time to recognize the ascii codes :) |
10:26:43 | FromGitter | <kaushalmodi> `man ascii` |
10:27:12 | FromGitter | <kaushalmodi> ^ that's the command to type in the terminal |
10:27:14 | leorize | that wouldn't work if you're not on Linux :P |
10:27:23 | FromGitter | <kaushalmodi> He's on Mac |
10:27:44 | FromGitter | <kaushalmodi> For Windows users: http://man7.org/linux/man-pages/man7/ascii.7.html |
10:27:50 | leorize | and Mac is not Linux |
10:28:05 | leorize | It'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:07 | FromGitter | <kaushalmodi> @kdheepak `repr` prints *\\DECIMAL_ASCII* for non-printable chars. |
10:29:29 | FromGitter | <kaushalmodi> And the decimal ascii of newline or linefeed(LF) is 10. |
10:31:09 | FromGitter | <kaushalmodi> leorize: touché I wouldn't have known.. I assumed macOS (derived from BSD, I guess) would include such critical mans |
10:31:36 | FromGitter | <zacharycarter> https://github.com/drujensen/fib#natively-compiled-statically-typed :D |
10:31:38 | FromGitter | <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:50 | FromGitter | <kaushalmodi> Well then, if that doesn't work on Mac, use the url. |
10:32:04 | FromGitter | <kdheepak> (It's 4:30 am here :) excuse my brevity) |
10:32:46 | FromGitter | <kaushalmodi> @kdheepak at least you have multiple solutions now. :) |
10:33:09 | FromGitter | <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:57 | FromGitter | <narimiran> https://blog.rraghur.in/2018/09/27/fruzzy---a-freaky-fast-fuzzy-finder-for-vim/neovim/ |
11:45:15 | FromGitter | <narimiran> btw, can anybody answer this question from reddit: "Does the old nullable `string` migrate to `ref string` then?" |
11:49:21 | PMunch | Depends on what you mean by migrate |
11:49:48 | PMunch | If 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:41 | FromGitter | <narimiran> PMunch https://old.reddit.com/r/programming/comments/9jdfwe/nim_version_0190_released/e6sacfo/ please write it here |
11:52:50 | krux02 | is 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:07 | FromGitter | <kayabaNerve> It builds Nim from source unless it can get binaries. |
11:55:17 | FromGitter | <kayabaNerve> So the question is if koch tools builds nimsuggest |
11:55:37 | FromGitter | <kayabaNerve> And if Nim's binary downloads ship it |
12:01:37 | * | leorize joined #nim |
12:03:29 | FromGitter | <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:01 | FromGitter | <kaushalmodi> I'd have to guess some of them would definitely have got fixed by now, or maybe inapplicable |
12:04:16 | FromGitter | <ephja> nah that's cheating :p |
12:04:52 | FromGitter | <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:04 | FromGitter | <kaushalmodi> You don't need to be a Nim dev to do those. |
12:05:54 | FromGitter | <kaushalmodi> Let's set a conservative goal to close at least 5 issues a day! |
12:07:51 | planetis[m] | hey what is this error about? https://gist.github.com/b3liever/40b9a19345e22c1da6868b4e502a9d2d |
12:16:28 | PMunch | planetis[m], might be the result value that's messing things up |
12:16:33 | PMunch | Try to use a regular return |
12:17:20 | krux02 | PMunch, I had problems with the result variable sometimes being incorrectly shadowed with templates |
12:17:21 | PMunch | And an easier way would probably be to use quote do |
12:17:49 | PMunch | krux02, yeah it's not great |
12:18:21 | PMunch | Yeah, that seemed to solve the issue |
12:18:52 | planetis[m] | same error with a return |
12:19:13 | * | tzui joined #nim |
12:19:34 | PMunch | What? I just tried on my machine and got no error when I switched the result = on line 7 to a return |
12:19:35 | krux02 | I am extremely happy that the nil state of seq and strings has been eleminated. |
12:19:49 | * | tzui left #nim (#nim) |
12:19:50 | planetis[m] | will fill some bug reports today |
12:19:50 | krux02 | not sure if it has been eleminated internally as well |
12:20:14 | planetis[m] | oh this result |
12:20:35 | planetis[m] | yep works thanks |
12:21:34 | planetis[m] | I guess there is a bug report already for that? |
12:23:59 | FromGitter | <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:15 | PMunch | planetis[m], probably. I know Araq is aware of it at least |
12:24:59 | krux02 | should nim get it's own twitch channel? |
12:25:14 | FromGitter | <kayabaNerve> What would it do |
12:25:33 | FromGitter | <kayabaNerve> I think both Ara_q and dom have their own stuff already |
12:26:01 | krux02 | kayabaNerve do you try to not trigger him by putting an _ in the name |
12:26:10 | krux02 | but nim is "style insensitive" :P |
12:26:54 | FromGitter | <kayabaNerve> Yeah. I'm polite |
12:27:36 | FromGitter | <kayabaNerve> dom has 96. BDFL is not the best known acronym. "A" is too ambiguous. |
12:27:41 | FromGitter | <kayabaNerve> Ara seems weird. |
12:30:12 | FromGitter | <kaushalmodi> Andreas? |
12:30:44 | * | masterm joined #nim |
12:32:46 | FromGitter | <bung87> is there a simple way to generate temp filename with random suffix? |
12:38:43 | FromGitter | <kayabaNerve> @bung87 ⏎ ⏎ ```for _ in 0 ..< 4: ⏎ name &= $char(65 + (random() mod 26))``` [https://gitter.im/nim-lang/Nim?at=5bae20d301fb5f4ae136e13f] |
12:39:04 | FromGitter | <kayabaNerve> That's what I can think of off the top of my head. ⏎ ⏎ You can also just get the time |
12:41:33 | FromGitter | <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:40 | FromGitter | <zacharycarter> @Yardanico that would be awesome - do you need any info from me? |
12:42:13 | shashlick | @kaushalmodi: that's what I've been doing with tissue |
12:42:21 | shashlick | Checking older issues are fixed |
12:42:28 | shashlick | Mainly crashes though |
12:42:30 | FromGitter | <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:43 | FromGitter | <bung87> @kayabaNerve thanks , the random take a int arg and deprecated. |
12:42:45 | shashlick | I wish more people used it, makes things super easy |
12:42:49 | FromGitter | <Yardanico> but it would work without that. your twitch channel is twitch.tv/zachary_carter right? |
12:42:56 | FromGitter | <Yardanico> @bung87 use `rand()` instead :) |
12:43:20 | FromGitter | <zacharycarter> @Yardanico - yup - I wil go ahead and do that |
12:44:09 | FromGitter | <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:10 | shashlick | https://github.com/genotrance/tissue |
12:44:33 | FromGitter | <kaushalmodi> Yes, I know about it, just haven't found courage to use it. |
12:44:41 | shashlick | It'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:55 | shashlick | Post comments, builds test cases and creates PRs |
12:45:03 | FromGitter | <kaushalmodi> OK, will try it. 👍 |
12:45:04 | shashlick | For the lazy developers |
12:45:16 | FromGitter | <kaushalmodi> Wouldn't that be a security risk? |
12:45:31 | FromGitter | <bung87> @Yardanico I take your version, easier to read. |
12:45:34 | FromGitter | <kaushalmodi> When I run a code manually I review it before running |
12:45:53 | FromGitter | <kaushalmodi> Wouldn't tissue have the same hazard as `curl foo.sh | sh`? |
12:45:53 | shashlick | It has an interactive mode |
12:45:56 | FromGitter | <Yardanico> @bung87 don't forget to run `randomize()` before doing any random stuff though |
12:46:07 | shashlick | Doesn't do anything automatically |
12:46:12 | FromGitter | <kaushalmodi> Cool |
12:46:40 | FromGitter | <kayabaNerve> @bung87 I actually haven't used random in a while. Sorry about that. |
12:47:59 | * | dddddd joined #nim |
12:48:06 | FromGitter | <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:18 | shashlick | bung87: how's nimfastText working for you |
12:49:27 | * | FromTwitch quit (Remote host closed the connection) |
12:50:17 | FromGitter | <Yardanico> @zacharycarter what do you think, we need to bridge your irc chat to #nim or to #nim-offtopic? |
12:50:48 | FromGitter | <bung87> still stuck in there, I thought may make a frozen version of cpp fasttext and manually modify the source. |
12:51:15 | shashlick | What's not working for you |
12:51:16 | * | SenasOzys joined #nim |
12:51:39 | shashlick | Would be great if you could help get the wrapper working |
12:52:26 | FromGitter | <bung87> or I get enough knowledge to convertting the std istream to nim stream object. |
12:53:02 | shashlick | I can try to help with that |
12:53:41 | FromGitter | <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:34 | FromGitter | <bung87> and let the cpp implements treat it as std istream. |
12:55:19 | FromGitter | <dom96> Recursive fibonacci benchmark using top languages on GitHub https://news.ycombinator.com/item?id=18091655 |
12:55:28 | FromGitter | <dom96> Nim is on top :o |
12:56:18 | FromGitter | <bung87> yeah , that’s the last thing I can imagenation, unless there’s another unconverted type in cpp function calls |
12:57:34 | FromGitter | <zacharycarter> @Yardanico hrm |
12:57:53 | FromGitter | <zacharycarter> I think that's probably up to Araq / dom96 |
12:57:58 | FromGitter | <zacharycarter> I'm fine with either |
12:58:17 | FromGitter | <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:37 | FromGitter | <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:32 | FromGitter | <Yardanico> @zacharycarter just write `/mod FromIRC` in your twitch channel's chat |
13:09:04 | FromGitter | <zacharycarter> good looks |
13:09:35 | FromGitter | <zacharycarter> done |
13:09:39 | FromGitter | <kayabaNerve> /mod Kayaba |
13:09:41 | FromGitter | <kayabaNerve> Damn |
13:12:25 | * | PrimHelios joined #nim |
13:12:53 | FromDiscord | <Shield> good to see nim being on top of a benchmark, it will sure attract more attention |
13:13:43 | FromGitter | <kayabaNerve> You write C. Nim writes micro optimized C that's akin to Assembly. |
13:20:27 | FromGitter | <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:57 | FromGitter | <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:15 | FromGitter | <narimiran> it doesn't get much pointless-y than this |
13:42:55 | elrood | microbenchmarks 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:23 | FromGitter | <Bennyelg> correct |
13:44:30 | * | vivus joined #nim |
13:45:18 | vivus | How do I specify the ROOT/home folder when opening a file ? |
13:46:34 | FromDiscord | <Shield> yep, In the sea of countless languages I used a benchmark to find nim |
13:49:19 | livcd | why do most "new release of a language" turn into a comparison of this language vs Rust ? |
13:50:36 | FromGitter | <kayabaNerve> vivus You mean ~/ or /home/root |
13:51:02 | vivus | @kayabaNerve : /home/MYUSER/ |
13:51:27 | FromGitter | <kayabaNerve> ~/ |
13:51:31 | PMunch | livcd, good question |
13:52:13 | PMunch | I guess most people wanting to try something new and cool nowadays censiders either Nim or Rust.. |
13:52:37 | FromGitter | <kayabaNerve> livcd Aren't they only 2 new systems programming languages? |
13:52:47 | FromGitter | <kayabaNerve> Most new langs are scripted |
13:52:56 | FromGitter | <kayabaNerve> I'm discounting the functional ones |
13:53:06 | FromGitter | <kayabaNerve> Both those are generally scripted anyways |
13:53:26 | PMunch | Oh 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:28 | livcd | hmm whenever I read news from Go,Crystal,Nim it always turns into such a pointless debate :) |
13:54:33 | FromGitter | <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:54 | federico3 | kayabaNerve 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:23 | FromGitter | <kayabaNerve> https://www.crowdsupply.com/sutajio-kosagi/tomu |
13:56:36 | FromGitter | <rufusroflpunch> there a way, when calling a generic proc, to specify generic type variable but let another be inferred? |
13:57:03 | FromGitter | <rufusroflpunch> or is type variable inference all or nothign? |
13:57:14 | federico3 | PMunch: 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:52 | PMunch | federico3, for the different chips and such? |
14:05:38 | * | miran joined #nim |
14:05:56 | federico3 | and boards, GPIOs, devices... |
14:05:57 | vivus | how do I activate choosenim if my system is not seeing it on its own? |
14:07:16 | vivus | figured it out |
14:10:05 | FromGitter | <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:18 | FromGitter | <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:11 | PMunch | I was more thinking of a complete beginner, how does he even know how do find all that stuff for his board |
14:21:16 | FromGitter | <kaushalmodi> May be Nim docs should later link to such Organizations once they are mature. |
14:21:38 | FromGitter | <kaushalmodi> And searching for TOMU, etc on Nim site leads to those repos. |
14:35:20 | miran | hey 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:55 | miran | i don't know if that is suited for the beginners. on the other hand, people might find that quite useful |
14:36:29 | FromGitter | <kaushalmodi> miran: You can start a Nim Intermediate :) |
14:36:58 | FromGitter | <kaushalmodi> But I agree, it would be nice to use more tutorials on topics like those |
14:36:58 | miran | heh, i don't know what would i put there :D |
14:37:09 | FromGitter | <kaushalmodi> You can start with this |
14:37:16 | FromGitter | <kaushalmodi> It can be a living document/site |
14:37:24 | FromGitter | <kaushalmodi> just add more stuff to it as you learn |
14:37:35 | FromGitter | <kaushalmodi> I am looking forward for a Nim Macros tutorial |
14:37:45 | FromGitter | <kaushalmodi> s/for a/to a |
14:37:59 | miran | if 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:38 | miran | macros 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:34 | FromDiscord | <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:48 | FromDiscord | <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:19 | Nolan[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:34 | Nolan[m] | And do I then remove the `dynlib`? |
14:48:46 | FromDiscord | <demotomohiro> Just checked list of nimble packagehttps://github.com/nim-lang/packages/blob/master/packages.json |
14:48:52 | FromDiscord | <demotomohiro> I found |
14:49:06 | FromDiscord | <demotomohiro> https://github.com/nim-lang/lua |
14:49:55 | FromDiscord | <demotomohiro> Shield: this example looks like executing a lua code from nim |
14:49:56 | FromDiscord | <demotomohiro> https://github.com/nim-lang/lua/blob/master/examples/luaex.nim |
14:52:21 | FromGitter | <mratsim> @Shield, you can try Spry, it’s a smalltalk/rebol inspired language written in Nim: http://sprylang.se/ |
14:53:36 | FromGitter | <zacharycarter> @Shield - 1) why do you want a scripting language with Nim |
14:53:49 | FromGitter | <zacharycarter> 2) - Araq will tell you to use Nim's VM |
14:53:50 | * | miran quit (Ping timeout: 244 seconds) |
14:54:28 | FromGitter | <mratsim> Otherwise Nim is a wrapper for Javascript :D |
14:54:55 | FromGitter | <mratsim> and you can call JS from Nim |
14:56:21 | FromDiscord | <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:50 | FromDiscord | <Shield> oh it was an answer to zacharycarter |
14:57:09 | livcd | ts ts i just read this fight dom96 had with the crystal guy :P |
14:57:49 | FromGitter | <zacharycarter> Shield: but why does that require a scripting language? |
14:58:06 | FromGitter | <zacharycarter> and if you still want one - you could look at how Nimble uses nimscript |
14:58:08 | FromGitter | <zacharycarter> or |
14:58:16 | FromGitter | <mratsim> the function is provided at runtime |
14:58:31 | FromGitter | <zacharycarter> how https://github.com/Araq/nimedit does |
14:58:32 | FromGitter | <zacharycarter> ah |
14:58:50 | FromDiscord | <Shield> yeah the function is provided at runtime, can nimscript be used that way? |
14:58:59 | FromGitter | <zacharycarter> probably |
14:59:03 | FromGitter | <zacharycarter> there are limitations to Nimscript |
14:59:22 | FromGitter | <mratsim> Best would be JS or something like that: https://github.com/oskca/webview |
14:59:27 | FromGitter | <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:46 | FromGitter | <zacharycarter> unless he wants to use the c backend |
14:59:50 | FromGitter | <zacharycarter> then JS is probably useless |
15:00:13 | FromDiscord | <Shield> yeah I'm using the c backend with winim |
15:00:15 | FromGitter | <mratsim> you can, by opening a socket |
15:00:17 | FromGitter | <zacharycarter> oh |
15:00:18 | FromGitter | <zacharycarter> I see |
15:00:27 | FromGitter | <zacharycarter> nevermind @mratsim - my bad |
15:00:36 | FromGitter | <zacharycarter> I didn't click the link before typing that - I should have |
15:00:54 | FromDiscord | <Shield> wait, can you use js for that? |
15:00:55 | FromGitter | <mratsim> otherwise you need to create a small domain specific language + interpreter |
15:01:05 | FromGitter | <zacharycarter> might be a fun exercise though |
15:01:13 | FromGitter | <zacharycarter> http://craftinginterpreters.com/ |
15:01:17 | FromGitter | <zacharycarter> is coming along nicely too :D |
15:01:22 | FromGitter | <mratsim> server C backend, client JS backend |
15:01:44 | FromGitter | <mratsim> example: https://github.com/Vindaar/NeuralNetworkLiveDemo |
15:01:58 | FromDiscord | <Shield> if nimscript can be used like a scripting language for real time functions it'll be a blast, nim for everything |
15:02:11 | FromGitter | <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:22 | FromDiscord | <Shield> that could work |
15:06:55 | * | francisl joined #nim |
15:09:23 | * | SenasOzys joined #nim |
15:11:03 | FromGitter | <rufusroflpunch> in nim, can you pass a function first class (as opposed to an anonymous proc)? |
15:12:08 | FromGitter | <bung87> var a = proc():int = 0 |
15:12:29 | * | PMunch quit (Quit: Leaving) |
15:12:35 | FromGitter | <rufusroflpunch> ah yeah, seems obvious now |
15:14:19 | * | chpts joined #nim |
15:18:38 | FromGitter | <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:55 | krux02 | for some reason whenever I want to type "automatical" my brains makes me type "automagical" |
15:40:08 | elrood | so you automagically type.. |
15:43:08 | FromGitter | <mratsim> The krux02 type system is automagical |
15:44:12 | * | nsf quit (Quit: WeeChat 2.2) |
15:46:17 | Nolan[m] | Can I check if a flag is defined with `-d:foo` in nimscript? |
15:47:30 | leorize | when defined(something) |
15:47:40 | leorize | just like what you would do in a .nim file |
15:48:13 | Nolan[m] | Perfect, where `something` is a string? |
15:48:13 | FromGitter | <kaushalmodi> Nolan[m]: See that config.nims link I sent yesterday ;-) |
15:48:20 | FromGitter | <kaushalmodi> I stumbled through similar questions |
15:48:32 | FromGitter | <kaushalmodi> https://github.com/kaushalmodi/hello_musl/blob/master/config.nims |
15:49:08 | * | francisl quit (Quit: francisl) |
15:49:41 | Nolan[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:05 | Nolan[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:40 | FromGitter | <kaushalmodi> umm.. I don't think so |
15:58:11 | FromGitter | <kaushalmodi> depending on the use case, you may call `nimble ..` using `exec` from the task |
16:00:25 | Nolan[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:33 | Nolan[m] | I wish I could do something like `nimble build -- -d:emscripten` and pass args to the compiler from that. |
16:02:01 | FromGitter | <kaushalmodi> Nolan[m]: I think that doesn't work |
16:02:06 | FromGitter | <kaushalmodi> I had opened an issue about that |
16:02:09 | Nolan[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:17 | FromGitter | <kaushalmodi> not the exact same issue, but similar |
16:02:30 | FromGitter | <kaushalmodi> I wanted to do `nimble build <task in .nims>` |
16:02:50 | Nolan[m] | Right. |
16:03:29 | FromGitter | <kaushalmodi> https://github.com/nim-lang/nimble/issues/542 |
16:03:50 | Nolan[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:27 | FromGitter | <kaushalmodi> .nimble seems like a fork of .nims |
16:04:31 | FromGitter | <kaushalmodi> I wish both are consolidated |
16:05:30 | FromGitter | <kaushalmodi> Instead of allowing users to define tasks, etc. in there, it should ask them to create config.nims |
16:05:52 | FromGitter | <kaushalmodi> By "it", I mean nimble of course |
16:06:17 | * | tzui joined #nim |
16:06:19 | * | Trustable joined #nim |
16:09:50 | deepend | I'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:56 | deepend | nimbase.h:484:13: error: size of array 'Nim_and_C_compiler_disagree_on_target_architecture' is negative |
16:20:44 | leorize | try adding `--passC:'-m32' --passL:'-m32'` |
16:21:33 | * | TheLemonMan quit (Quit: "It's now safe to turn off your computer.") |
16:21:59 | deepend | that appears to have succeeded |
16:22:07 | Demos[m] | it's not a fork |
16:22:08 | deepend | had to change the ' to " on windows though |
16:22:11 | deepend | thanks leorize |
16:22:32 | Demos[m] | .nims is part of the compiler, for just scripts you want to run in the compiler's VM |
16:22:46 | Demos[m] | .nimble are .nims files read by nimble |
16:22:59 | Demos[m] | there does seem to be a task interface in .nims, but it's not documented and few use it |
16:23:11 | Demos[m] | well it's documented but not very extensively |
16:25:27 | FromGitter | <kaushalmodi> Demos[m]: I didn't mean a literal fork |
16:26:00 | Demos[m] | ah, sorry I'm pretty tired. |
16:26:10 | FromGitter | <kaushalmodi> But the fact that both nimble and nims can define a `task`, but things aren't identical in both |
16:26:22 | FromGitter | <kaushalmodi> e.g. `findExe` works in .nims but not in .nimble |
16:26:59 | leorize | that's a nimble bug... |
16:27:05 | leorize | I think |
16:27:49 | Araq | well, yeah. probably Nimble doesn't claim to support findExe, but still |
16:27:50 | FromGitter | <kaushalmodi> leorize: but would it be possible for both to "source" those procs/templates from the same place? |
16:28:14 | FromGitter | <kaushalmodi> there's an issue for that findExe.. but cannot find it |
16:28:18 | Araq | Nolan[m]: if your task uses 'nimble' it should be a nimble task to begin with |
16:28:42 | Araq | calling 'nimble' in your build step is *wrong* and every project that does that is super annoying |
16:29:22 | FromGitter | <kaushalmodi> about that findExe: https://github.com/nim-lang/nimble/pull/541 |
16:29:41 | Araq | it's like calling 'brew' from your makefile |
16:29:53 | leorize | kaushalmodi: now you know why they can't "source" it :P |
16:30:00 | * | chpts joined #nim |
16:30:42 | FromGitter | <kaushalmodi> leorize: I mean that when `findExe` got added to nims in nim core, should nimble use that same library? |
16:30:51 | FromGitter | <kaushalmodi> then we don't need to add the same procs in parallel to both |
16:30:54 | Nolan[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:59 | Nolan[m] | Seems it's one or the other. |
16:32:02 | leorize | kaushalmodi: I think there might be some issues. Given that the compiler already export `setupVM()`, but nimble still uses it's own version... |
16:33:13 | leorize | https://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:02 | FromGitter | <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:49 | FromGitter | <kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae5abd01fb5f4ae1388403] |
16:45:56 | * | flaviu joined #nim |
16:47:04 | leorize | I have no idea what you're trying to do |
16:47:25 | leorize | and why would you need to assert k is of Kind? |
16:47:39 | leorize | it has to be `Kind` |
16:48:24 | FromGitter | <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:00 | leorize | the Nim way is var k: Kind :P |
16:49:13 | FromGitter | <kdheepak> Got it :D |
16:49:23 | elrood | hm, 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:25 | FromGitter | <kdheepak> I think what I'm asking is not possible. |
16:49:30 | leorize | and I don't think you can "dispatch" :P |
16:49:43 | leorize | for that use case implement `$` instead |
16:50:02 | FromGitter | <kdheepak> Yeah, because the enum essentially get converted to ints I think. |
16:50:15 | FromGitter | <kdheepak> Can you elaborate on how `$` would help? |
16:50:24 | leorize | this is not C, enums aren't int... |
16:51:32 | * | Calinou joined #nim |
16:51:55 | leorize | !eval type Kind = kFirst, kSecond; echo kFirst |
16:51:57 | NimBot | Compile failed: in.nim(1, 13) Error: undeclared identifier: 'kFirst' |
16:52:11 | leorize | !eval type Kind = kFirst, kSecond; let k = kFirst; echo k |
16:52:12 | NimBot | Compile failed: in.nim(1, 13) Error: undeclared identifier: 'kFirst' |
16:52:25 | * | Calinou quit (Remote host closed the connection) |
16:52:26 | leorize | !eval type Kind = enum kFirst, kSecond; echo kFirst |
16:52:27 | NimBot | Compile failed: in.nim(1, 33) Error: identifier expected, but found ';' |
16:52:36 | * | francisl quit (Quit: francisl) |
16:52:40 | FromGitter | <kayabaNerve> leorize Yeah they are |
16:52:53 | leorize | :P my one line Nim skills aren't that good |
16:52:56 | FromGitter | <kayabaNerve> I mean, Nim compiles to C and enums are int |
16:53:21 | leorize | that's only an implementation thingy |
16:53:26 | FromGitter | <kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae5c8653c31c11117bf5eb] |
16:53:35 | FromGitter | <kdheepak> https://nim-lang.org/docs/manual.html#types-enumeration-types |
16:53:43 | FromGitter | <kdheepak> This is what I meant. |
16:53:49 | FromGitter | <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:09 | FromGitter | <kayabaNerve> *int values |
16:54:20 | FromGitter | <kayabaNerve> So it's not a raw int in the sense a char isn't an int |
16:54:31 | FromGitter | <kayabaNerve> But enums are ordinal types and have an int definition |
16:54:54 | leorize | that's what I meant |
16:55:55 | leorize | never noticed that you can customize the string without defining your own `$`, thanks @kdheepak |
16:56:18 | * | chpts quit (Quit: leaving) |
16:56:23 | FromGitter | <kayabaNerve> Just like chars are an ordinal type with int definitions masking the ASCII table |
16:56:23 | FromGitter | <kayabaNerve> Fair enough. |
17:02:23 | FromGitter | <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:44 | FromGitter | <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:31 | FromGitter | <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:42 | FromGitter | <kdheepak> If I have a `seq[string]` how do I convert it to a string? |
17:12:54 | * | gmpreussner joined #nim |
17:13:02 | FromGitter | <kdheepak> `join`? |
17:13:30 | * | gmpreussner_ quit (Ping timeout: 268 seconds) |
17:13:46 | FromGitter | <kayabaNerve> That's one way |
17:13:51 | FromGitter | <kayabaNerve> You can also call $ |
17:13:55 | FromGitter | <kayabaNerve> What are you trying to do? |
17:14:08 | FromGitter | <kayabaNerve> Do you want to handle data or print the seq/ |
17:14:15 | FromGitter | <kdheepak> Can you not redeclare a variable in a function? |
17:14:23 | FromGitter | <kdheepak> as a different type? |
17:14:40 | FromGitter | <kayabaNerve> Nope |
17:15:10 | * | leru quit (Ping timeout: 246 seconds) |
17:18:48 | FromGitter | <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:24 | leorize | it's `lent` |
17:19:36 | leorize | but highly experimental and undocumented |
17:20:02 | leorize | and only works with `--newruntime` and/or `--gc:destructors` |
17:20:04 | FromGitter | <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:42 | FromGitter | <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:38 | FromGitter | <mratsim> otherwise it’s passed by val |
17:21:38 | FromGitter | <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:58 | FromGitter | <mratsim> yes https://github.com/nim-lang/Nim/wiki/Destructors |
17:22:16 | FromGitter | <mratsim> seq and string will not depend on GC once newruntime is default |
17:22:19 | FromGitter | <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:26 | FromGitter | <mratsim> yep |
17:22:56 | FromGitter | <mratsim> You would probably still need GC for closures and async but who knows |
17:23:13 | FromGitter | <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:24 | FromGitter | <mratsim> cool =) thanks |
17:24:12 | FromGitter | <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:15 | FromGitter | <mratsim> Once I finish adding some RNN examples I’m gonna attack the data viz part |
17:25:16 | FromGitter | <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:29 | FromGitter | <mratsim> that’s true. |
17:25:36 | * | Calinou joined #nim |
17:26:23 | * | Calinou quit (Client Quit) |
17:26:28 | Araq | adam-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:02 | FromGitter | <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:30 | FromGitter | <mratsim> @Araq, you should put that in a Nim for the C++ programmer page ;) |
17:27:43 | FromGitter | <mratsim> I think the only way to find that info is in IRC logs |
17:28:22 | FromGitter | <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:22 | FromGitter | ... 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:26 | Araq | concepts will work for this, but afaik Julia benefits from its JIT here |
17:29:58 | FromGitter | <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:31 | Araq | it's really like this: |
17:31:10 | Araq | x: T # let the compiler decide, not mutable |
17:31:13 | FromGitter | <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:25 | FromGitter | <mratsim> The current autograd is mostly Generics, I use concepts for “TrainableLayers” only. |
17:31:29 | Araq | x: var T # let the compiler decided, but it's mutable |
17:31:55 | Araq | x: sink T # let the compiler decide, but the callee takes ownership |
17:32:05 | FromGitter | <adam-r-kowalski> Fair enough, so it will just do the right thing depending on the size of the type? |
17:32:11 | Araq | exactly. |
17:32:45 | stefanos82 | can we be explicit if we want to though? |
17:32:48 | FromGitter | <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:06 | Araq | the parameter passing modes capture the intent, they are not to optimize your code. |
17:33:59 | FromGitter | <bung87> it’s a cool thing that nim has low level and high level concept for gc and non-gc language programers. |
17:34:01 | FromGitter | <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:56 | FromGitter | <mratsim> I think you need a “shape” proc or field with array semantics, but yeah, it shouldn’t be hard to adapt. |
17:36:52 | FromGitter | <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:17 | FromGitter | <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:33 | FromGitter | <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:14 | FromGitter | <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:48 | FromGitter | <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:50 | FromGitter | <adam-r-kowalski> You could just create a struct that holds the environment and then pass that in as needed |
17:44:55 | FromGitter | <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:19 | FromGitter | <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:41 | FromGitter | <adam-r-kowalski> Yeah I saw that! I saw that you beat them on every benchmark haha |
17:47:37 | FromGitter | <mratsim> besides compile-time ;) |
17:47:55 | Araq | adam-r-kowalski: huh, you need to elaborate on that. sounds like you have some ideas that I've been missing :-) |
17:48:08 | Araq | 'ref' and 'closure' are unsolved problems for me :D |
17:48:12 | Araq | bbs |
17:48:35 | FromGitter | <kayabaNerve> @mratsim You can have the fastest compile time of all languages if you never compile |
17:49:02 | FromGitter | <kayabaNerve> Is it just me or is it annoying how you can't test stdlib modules in Nim secret? |
17:49:09 | FromGitter | <kayabaNerve> I fully understand why. |
17:49:18 | FromGitter | <mratsim> math works ;) |
17:49:26 | FromGitter | <kayabaNerve> TIL |
17:49:32 | FromGitter | <kayabaNerve> But most don't :P |
17:49:46 | FromGitter | <mratsim> I think if it’s enabled for nimscript it’s enabled for nim secret |
17:50:35 | FromGitter | <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:35 | FromGitter | ... 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:52 | FromGitter | <mratsim> @kayabaNerve here is the future: https://github.com/nim-lang/Nim/issues/8927 |
17:51:12 | FromGitter | <adam-r-kowalski> yeah full code reloading would be awesome1 |
17:51:48 | FromGitter | <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:57 | FromGitter | <mratsim> A bit like Numba for Python. |
17:52:08 | FromGitter | <kayabaNerve> @mratsim With all that new Status money? :P |
17:52:18 | FromGitter | <kayabaNerve> I saw it when it went live. I hope it works. |
17:52:32 | FromGitter | <mratsim> yep funded by Status |
17:53:29 | FromGitter | <kayabaNerve> Nice |
17:53:42 | FromGitter | <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:56 | FromGitter | <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:24 | krux02 | mratsim: it is unlikely the cause of LLVM. |
18:04:23 | krux02 | maybe LLVM is not the fastest compilation backend imaginable, it has many costly optimizations built-in. |
18:04:42 | FromGitter | <mratsim> C is fast |
18:05:00 | * | francisl quit (Quit: francisl) |
18:05:12 | FromGitter | <mratsim> I guess they have an issue with their symbol resolution passes (which C doesn’t have) |
18:05:23 | FromGitter | <mratsim> for generics* |
18:05:31 | krux02 | Scala has also compilation speed issues |
18:05:41 | krux02 | and it is not LLVM based. |
18:05:42 | FromGitter | <mratsim> and maybe OO as well |
18:06:11 | krux02 | the problem is that many languages try to be *too smart* |
18:06:43 | krux02 | in rust it is the safety checker as far as I know |
18:07:11 | krux02 | and it scala I think it has to do with the ``implicit`` stuff, but I am not sure.. |
18:07:25 | krux02 | there are N^2 problems in the compiler |
18:07:35 | krux02 | and that just doesn't scale very well |
18:08:46 | krux02 | c++ has a big problem, because for big projects you need compilation clusters. |
18:09:07 | FromGitter | <kayabaNerve> If you don't write your C++ code on a supercomputer, you're not a C++ dev |
18:09:29 | FromGitter | <kayabaNerve> If you don't program Python while wearing a fish bowl, you aren't a Python dev |
18:09:52 | krux02 | I like if I can write and compile my code on a crappy laptop. |
18:09:54 | FromGitter | <kayabaNerve> If you don't code Nim while praising our BDFL, you aren't a Nim dev |
18:10:55 | Araq | that's a recent development, in the past Nim was used despite of its BDFL |
18:11:02 | Araq | :P |
18:11:42 | FromGitter | <kayabaNerve> Araq if you read the Nth character of every other Git commit message on my projects, they spell out PRAISE ARAQ |
18:11:55 | Araq | lol |
18:11:57 | FromGitter | <kayabaNerve> Damn it, could you imagine lol |
18:11:59 | Araq | thank you. |
18:12:07 | FromGitter | <kayabaNerve> I feel like I now have to |
18:12:29 | oprypin | Crystal 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:37 | FromGitter | <kayabaNerve> Use a GitHub history faker to upload Nim files and spell Araq on the activity green square thingy |
18:13:56 | oprypin | @mratsim |
18:14:16 | FromGitter | <mratsim> here |
18:15:37 | FromGitter | <mratsim> but it works at instantiation only right? |
18:15:48 | Araq | to be fair, "Is language X fast to compile in principle" is essentially an unsolved problem |
18:15:51 | FromGitter | <mratsim> if so i think it’s like Nim |
18:16:40 | oprypin | i 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:14 | Araq | and I think the answer is "yes" for any language out there, if you pick the right compiler architecture |
18:17:55 | Araq | and I want to write a book about the "right" compiler architecture |
18:17:57 | Araq | ;-) |
18:19:11 | Araq | and 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:41 | FromGitter | <kdheepak> I'm getting a weird error, can someone help me understand what is going on? Pasting code below: |
18:24:08 | FromGitter | <kdheepak> this is the error message: ⏎ ⏎ ``` Error: type expected``` [https://gitter.im/nim-lang/Nim?at=5bae71c85331811c2e1dd0f0] |
18:24:35 | FromGitter | <kdheepak> I get it when I try to run `initObj(attr: o)`. |
18:24:57 | FromGitter | <kdheepak> I've defined `initObj` as a constructor for `Obj`. |
18:25:38 | * | aamk quit (Remote host closed the connection) |
18:28:19 | FromDiscord | <demotomohiro> Did you defined type `o` used in `initObj(attr: o)`? |
18:29:16 | * | francisl quit (Quit: francisl) |
18:29:25 | FromGitter | <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:20 | FromDiscord | <demotomohiro> `var obj: Obj` |
18:32:20 | FromDiscord | <demotomohiro> `let o = newJObject()` |
18:32:20 | FromDiscord | <demotomohiro> `obj.initObj(o)` |
18:32:22 | FromGitter | <kdheepak> Can you store user created objects in a JSON? |
18:32:30 | * | miran joined #nim |
18:35:35 | krux02 | Compilation time problems are solved once and for all by using interpreted languages only. |
18:38:48 | FromGitter | <vivekimsit> @mratsim I think its better to program on the blockchain first and then get into internals |
18:38:59 | stefanos82 | krux02: I like Ocaml's approach to be honest with you |
18:43:52 | krux02 | stefanos82, I didn't work yet in Ocaml, what is thear appreach? |
18:44:14 | krux02 | And I probably won't work in Ocaml, because I am very happy in the wordl of Nim. |
18:44:48 | stefanos82 | krux02: an interactive top-level interpreter, a bytecode compiler, and an optimizing native code compiler |
18:45:18 | stefanos82 | I didn't say anything bad about Nim |
18:45:32 | krux02 | that is not how I meant it. |
18:45:45 | stefanos82 | all I wish for is to get an interpreter for Nim to produce fast prototype results |
18:45:46 | krux02 | it is just unlikely that I will go in depth into Ocaml |
18:45:56 | krux02 | unless I get paied to do so |
18:46:01 | stefanos82 | it depends from your future career needs |
18:46:24 | krux02 | ^^ yes |
18:46:36 | krux02 | but for the moment, I keep using Nim. |
18:47:11 | FromGitter | <kdheepak> nim doesn't seem to like this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae772f1e23486b935c1f59] |
18:48:13 | FromGitter | <kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae776d271506518d8a3aa1] |
18:48:49 | * | stram joined #nim |
18:48:51 | FromGitter | <krux02> @kdheepak you use inheritance, but don't use references |
18:49:50 | krux02 | inheritance baced polymorphism only works with one level of pointer indirection. |
18:50:17 | krux02 | so either make Animal a ref object, or make the seq of type ``seq[ref Animal]`` |
18:51:11 | Araq | https://github.com/nim-lang/Nim/issues/9108 yay, more RFCs |
18:52:37 | FromGitter | <kdheepak> So this seems to work ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae78751e23486b935c262d] |
18:53:18 | FromGitter | <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:57 | miran | @kdheepak from which programming language are you coming to nim? |
18:54:04 | Araq | stefanos82: Ocaml's approach is nice but I think instead of a bytecode interpreter a simple codegen like Tiny C uses is better |
18:54:18 | FromGitter | <kdheepak> @miran Python |
18:54:20 | * | DM_ joined #nim |
18:54:36 | Araq | less friction for the FFI then, all interpreters produce interop problems |
18:54:40 | stefanos82 | true, but tinyc is quite buggy for important pieces of code |
18:54:41 | krux02 | @kdheepak: you need ref whenever you use inheritance based polymorphism. |
18:55:06 | miran | exactly 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:17 | krux02 | and when you need to share the same object on different locations |
18:56:28 | miran | @kdheepak: this has been helpful to many people (me included): https://peterme.net/nim-types-originally-a-reddit-reply.html |
18:57:15 | FromGitter | <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:36 | miran | i'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:32 | FromGitter | <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:16 | FromGitter | <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:58 | FromGitter | <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:07 | FromGitter | <kdheepak> (I'm guessing not) |
19:03:24 | FromGitter | <kayabaNerve> If it's a ref object, you must use the constructor |
19:03:34 | FromGitter | <kayabaNerve> var myObject: ObjectType = ObjectType() |
19:12:47 | FromGitter | <mratsim> or “new" |
19:13:33 | FromGitter | <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:56 | FromGitter | <bung87> ```code paste, see link``` ⏎ ⏎ how to get it work? [https://gitter.im/nim-lang/Nim?at=5bae7d73c08b8b3067a33226] |
19:14:39 | FromGitter | <bung87> I am wrapping a cpp lib |
19:15:07 | FromGitter | <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:52 | Zevv | Searching on the Nim Manual seems to be broken for me: "Error: Error: unhandled exception: index out of bounds [IndexError]" |
19:44:26 | Zevv | for certain searches, for example "type" |
19:46:28 | * | nsf quit (Quit: WeeChat 2.2) |
19:52:21 | Araq | Zevv: ooh, let me try |
19:53:01 | FromGitter | <kaushalmodi> phew.. final list of broken links in the generated nim docs: https://github.com/nim-lang/Nim/issues/9109 |
19:53:12 | FromGitter | <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:36 | FromGitter | <kdheepak> I'm still struggling to understand the `ref` keyword, particularly in conjunction with `seq`. |
20:08:42 | FromGitter | <kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae8a4aa9be136b94c86a74] |
20:09:12 | FromGitter | <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:38 | FromGitter | <rayman22201> @Zevv, orly? what browser? This is using the fuzzy match search PR now right @Araq and @kaushalmodi ? |
20:15:51 | Araq | sure it is |
20:15:56 | FromGitter | <rayman22201> damnit |
20:15:57 | Araq | so yeah, your bug :P |
20:16:04 | Araq | however |
20:16:24 | Araq | the JS codegen doesn't produce a trailing \0 anymore, maybe that's why |
20:16:39 | Araq | looking at your code though, you use 'cstring' |
20:17:07 | FromGitter | <rayman22201> yup. I'm back btw. Was sick with the flu all week. I still owe you a streams PR as well |
20:17:29 | FromGitter | <kaushalmodi> Zevv: I can reproduce that error |
20:17:36 | FromGitter | <kaushalmodi> @rayman22201 : ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae8c601e23486b935c9dfb] |
20:17:46 | FromGitter | <rayman22201> It seems to happen on chrome but not Firefox |
20:17:53 | FromGitter | <kaushalmodi> above was Firefox |
20:18:10 | FromGitter | <kaushalmodi> I don't use Chrome as it completely blocks the search |
20:18:14 | FromGitter | <kaushalmodi> the cross origin thing |
20:18:38 | Araq | huh? Chrome works for me too |
20:18:48 | Araq | (ignoring this bug) |
20:18:55 | FromGitter | <rayman22201> Yeah. I use Firefox normally, and I can't repro. but I checked chrome just to see |
20:18:59 | FromGitter | <kaushalmodi> Araq: it's because I am opening the docs without server |
20:19:32 | FromGitter | <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:45 | FromGitter | <kaushalmodi> (or may be not.. haven't checked :P) |
20:20:28 | FromGitter | <rayman22201> Also, yeah, I'm using cstring, so the ending /0 shouldn't be an issue... weird |
20:21:01 | FromGitter | <kaushalmodi> @rayman22201 OK, I can reproduce that error on Firefox ESR 45 |
20:21:05 | FromGitter | <kaushalmodi> but not on the latest 62 |
20:21:21 | FromGitter | <rayman22201> interesting |
20:21:24 | FromGitter | <krux02> @kdheepak http://ix.io/1nMQ |
20:21:27 | FromGitter | <rayman22201> freaking browsers |
20:21:41 | * | francisl quit (Quit: francisl) |
20:22:00 | * | NimBot joined #nim |
20:22:07 | FromGitter | <kaushalmodi> even on ESR 45, it works.. but when using the hosted version |
20:22:33 | FromGitter | <kaushalmodi> but I get the error when reading docs directly (`firefox foo.html&`) |
20:22:42 | FromGitter | <kaushalmodi> Zevv: How are you reading the docs? |
20:23:08 | FromGitter | <kdheepak> Thanks @krux02. Does that mean you created a reference to Animal before adding to the seq? |
20:23:50 | FromGitter | <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:06 | FromGitter | <rayman22201> On Chrome 69.0.3497.100 (latest I think) repros consistently. Firefox 62.0.2 does not repro. |
20:24:41 | FromGitter | <rayman22201> more people use Chrome than FF unfortunately, so I should fix this. |
20:24:59 | FromGitter | <kaushalmodi> @rayman22201 and I can once again see the error on a localhost server on ESR 45 |
20:25:06 | FromGitter | <kaushalmodi> let me send you a capture video in a min |
20:26:25 | Zevv | kaushalmodi: FF 60.02 |
20:26:42 | Zevv | online from nim-lang.org |
20:26:45 | FromGitter | <kaushalmodi> https://i.imgur.com/YrQi8oi.gifv |
20:26:53 | FromGitter | <kaushalmodi> @rayman22201 ^ |
20:27:20 | FromGitter | <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:23 | FromGitter | <rayman22201> @kaushalmodi yeah. Same exact behavior on Chrome 69 |
20:28:45 | FromGitter | <kaushalmodi> cool, glad you can repro |
20:29:12 | FromGitter | <kaushalmodi> that's half solving the bug :) |
20:29:13 | FromGitter | <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:18 | FromGitter | <rayman22201> lol. Very true |
20:29:46 | * | miran quit (Ping timeout: 246 seconds) |
20:29:55 | FromGitter | <rayman22201> I'm just annoyed / confused about what changed between browser versions that would cause such a drastic change in behavior. |
20:30:23 | FromGitter | <rayman22201> /s/things/thinks/ |
20:32:33 | FromGitter | <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:06 | FromGitter | <krux02> @kdheepak yes you create references to Animal before you put them in seq |
20:39:33 | FromGitter | <krux02> but normally I would avoid doing that. |
20:40:14 | FromGitter | <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:30 | FromGitter | <krux02> then you can put all of the animals in a seq without the need for pointer indirection. |
20:45:08 | FromGitter | <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:14 | FromGitter | <kdheepak> I've created a ` Dog( kind: "dog", attributes: %*{"height": 1} )` instead of `(ref Dog)( kind: "dog", attributes: %*{"height": 1} )`. |
20:46:29 | FromGitter | <kdheepak> But I defined the type as `Dog = ref object of Animal`. |
20:47:05 | FromGitter | <kdheepak> Is it correct then to say that nim doesn't care about what the definition was in the type? |
20:47:20 | FromGitter | <kdheepak> Does it only take into account what happens when creating it? |
20:47:30 | krux02 | get rid of "ref", the type "Dog" and inheritance (the keyword of) |
20:48:25 | FromGitter | <kdheepak> What does the ref do in this example? |
20:48:52 | FromGitter | <kdheepak> And why are you asking I remove the inheritance? |
20:49:04 | krux02 | if means that the type "Dog" is alrady a reference (pointer) type, where Animal is not. |
20:49:11 | krux02 | (doesn't really make sense) |
20:50:23 | krux02 | because inheritance based polymorphism, while being basically everywhere is one of the big reasons for memory bloat in modern software architecture |
20:50:25 | FromGitter | <kdheepak> `Animal = ref object of RootObj` I've defined Animal to be a `ref` as well. Right? |
20:50:39 | krux02 | you shoud not get in the habit of creating type hieracies |
20:50:54 | krux02 | try to model with flat data structures first. |
20:50:55 | FromGitter | <kdheepak> I need to store a seq of different types. |
20:51:27 | krux02 | when you do that, the Dog will be a double indirection. |
20:51:28 | FromGitter | <kdheepak> How do I store it if I don't use inheritance? |
20:51:36 | FromGitter | <kdheepak> Ohh. |
20:51:37 | krux02 | a ``ref ref object`` |
20:52:03 | krux02 | you just store it in a ``seq`` or ``array`` |
20:52:08 | krux02 | meaning flat data structures. |
20:52:38 | krux02 | you won't have an array of pointers that point to something, you will have an array that already contains the data. |
20:53:29 | FromGitter | <kdheepak> This example doesn't compile now ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae94c9a9be136b94c8a94a] |
20:54:21 | krux02 | that kind field is redundant |
20:54:29 | FromGitter | <kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae9505c7bf7c3662889d6b] |
20:54:43 | krux02 | if you use inheritance, you automatically have a hidden field that stores the type of that object. |
20:54:59 | FromGitter | <kdheepak> I can get rid of kind then. |
20:55:14 | krux02 | don't use a kind field and inheritance based polymorphism at the same time |
20:55:31 | krux02 | either get rid of the inheritance or the kind field |
20:55:38 | FromGitter | <kdheepak> I'll remove the `kind`. |
20:55:46 | FromGitter | <kdheepak> Do you know why this doesn't compile? |
20:57:41 | krux02 | kdheepak, sorry I was wrong about the ref object of Animal part |
20:58:08 | krux02 | aparently you won't get double indirection by it. |
20:59:02 | krux02 | you have to put Dof = ref object of Animal |
20:59:11 | FromGitter | <kaushalmodi> @rayman22201 Does dochack.js only work if it's in the parent dir? |
20:59:25 | FromGitter | <kaushalmodi> even after changing the path to it in the script tag? |
20:59:27 | FromGitter | <kdheepak> Okay. this compiles now. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bae962f5a52b440159ce134] |
21:00:27 | FromGitter | <rayman22201> @kaushalmodi I don't think it matters.... What are you seeing? |
21:00:42 | FromGitter | <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:04 | FromGitter | <rayman22201> Also, I refreshed my firefox and I can repro now. (I was using an old cached version of dochack.js) |
21:01:08 | FromGitter | <kaushalmodi> the difference is that the latter link has dochack.js moved to the same dir as html |
21:01:11 | FromGitter | <rayman22201> repro in FF I mean |
21:01:41 | FromGitter | <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:56 | FromGitter | <rayman22201> https://github.com/nim-lang/Nim/blob/devel/tools/dochack/fuzzysearch.nim#L92 |
21:02:36 | FromGitter | <kaushalmodi> hmm, even after cache refresh, I cannot reproduce that bug on FF 62 on the official link |
21:02:44 | FromGitter | <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:53 | FromGitter | <rayman22201> really? |
21:03:15 | FromGitter | <rayman22201> that's strange |
21:03:18 | FromGitter | <kaushalmodi> yeah |
21:04:03 | FromGitter | <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:24 | FromGitter | <rayman22201> stupid question, but are you sure you have cleared your cache, and the correct dochack.js file is loading? |
21:04:31 | FromGitter | <kaushalmodi> I don't think if any of those changes could cause that error.. so I will wait for your PR |
21:04:39 | FromGitter | <kaushalmodi> Ctrl+F5? |
21:05:05 | FromGitter | <kaushalmodi> also in Ctrl+Shift+I, in network tab, I checked Disable Cache |
21:06:06 | FromGitter | <rayman22201> That should work.... |
21:06:27 | FromGitter | <kaushalmodi> let's see.. I'll try out when you have the fix |
21:06:33 | FromGitter | <rayman22201> well, I think the bug is real regardless. I will create the PR, yeah. |
21:06:35 | FromGitter | <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:13 | FromGitter | <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:07 | FromGitter | <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:09 | FromGitter | <rayman22201> https://github.com/nim-lang/Nim/blob/devel/tools/dochack/dochack.nim#L242 |
21:09:18 | FromGitter | <rayman22201> which is synchronous. |
21:09:34 | FromGitter | <rayman22201> These days the "prefered" way is to do an async request |
21:09:48 | FromGitter | <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:13 | FromGitter | <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:19 | FromGitter | <krux02> @kaushalmodi this is the same but in efficient: http://ix.io/1nN6 |
21:31:45 | FromGitter | <kaushalmodi> ? |
21:31:52 | FromGitter | <krux02> sorry |
21:31:53 | FromGitter | <kaushalmodi> @kdheepak ^ |
21:31:55 | FromGitter | <kaushalmodi> :) |
21:31:59 | FromGitter | <krux02> yes |
21:32:12 | FromGitter | <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:37 | FromGitter | <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:43 | FromGitter | <kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5baea1bba9be136b94c8f403] |
21:49:01 | FromGitter | <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:42 | FromGitter | <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:50 | Nolan[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:23 | FromGitter | <krux02> @kdheepak yes |
21:50:52 | FromGitter | <kdheepak> But the modify function is passing a reference in both cases? |
21:51:24 | FromGitter | <krux02> well they are two different kinds of references. |
21:51:33 | FromGitter | <krux02> one of them is really a misnomer |
21:52:02 | FromGitter | <krux02> the ``ref object`` is strictly speaking not a reference, it is a pointer that is just called a reference |
21:52:08 | FromGitter | <kdheepak> Do you how there are there different? |
21:52:21 | FromGitter | <krux02> yes |
21:52:46 | FromGitter | <krux02> when you create an object on the stack, it is there without pointer indirection. |
21:52:53 | Nolan[m] | Or do I need to use the unsafe references for this kind of thing? |
21:53:44 | FromGitter | <krux02> when you pass it down to a function, it is unlike c passed "by reference", meaning there is a hidden pointer |
21:54:36 | FromGitter | <krux02> when you pass a stack object to a function with a ``var`` parameter, it compiles down to the same thing |
21:54:50 | FromGitter | <krux02> just this time the function is allowed to modify the object |
21:55:07 | FromGitter | <krux02> and since it is a pointer to an object on the stack tho object on the stack is modified. |
21:55:33 | FromGitter | <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:50 | FromGitter | <krux02> passing a ref object to a function passes a copy of that pointer to the function |
21:55:59 | FromGitter | <krux02> the function can then modify the object on the heap |
21:56:38 | FromGitter | <krux02> so after compiling both functions to C, they don't really look different at all. |
21:57:02 | FromGitter | <krux02> but the way you can pass object to the functions is very different. |
21:57:56 | krux02 | Nolan[m], what is your precise problem. |
21:58:35 | krux02 | Normally 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:53 | krux02 | but I could be wrong I did not do anything with wasm. |
21:59:14 | FromGitter | <bung87> with gc enable no much things to worry about. |
21:59:50 | Nolan[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:56 | FromGitter | <kdheepak> Thanks @krux02 that helps a lot! |
22:01:13 | FromGitter | <kdheepak> How do I see what the c files are? |
22:01:34 | krux02 | kdheepak: there is a folder called nimcache, open it and look inside |
22:01:58 | FromGitter | <kdheepak> There's no nimcache in the current folder |
22:01:59 | krux02 | Nolan[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:24 | krux02 | normally when I compile a file nim always creates a nimcache folder |
22:03:03 | FromGitter | <kdheepak> The newest version doesn't create it? |
22:04:06 | FromGitter | <bung87> it’s now under your nim prefix folder. |
22:04:06 | * | a_b_m joined #nim |
22:04:24 | FromGitter | <kdheepak> What is the nim prefix folder? |
22:04:26 | FromGitter | <kdheepak> ~/.nim? |
22:04:47 | * | NimBot joined #nim |
22:05:12 | FromGitter | <kdheepak> ~/.nimble/bin/nim |
22:06:42 | FromGitter | <kdheepak> I installed it using choosenim |
22:06:51 | FromGitter | <kdheepak> but I can't seem to find it in ~/.choosenim as |
22:06:53 | FromGitter | <bung87> well I can not for sure when using choosnim |
22:07:02 | * | abm quit (Ping timeout: 268 seconds) |
22:07:28 | FromGitter | <kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5baea62019b139275a184c8a] |
22:07:55 | krux02 | Araq: 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:18 | krux02 | that is not true, it can still be converted to a cstring type via cast, it is just not done automatically anymore. |
22:08:52 | krux02 | kdheepak, I just checked nimchache as well and I am confused that I also can't find it anymore |
22:09:02 | krux02 | but I am sure it was there. |
22:09:14 | FromGitter | <kdheepak> It gets created when building js |
22:09:19 | FromGitter | <kdheepak> but not when creating c |
22:09:38 | krux02 | well it was defititively created when building with c |
22:09:40 | krux02 | 100% sure |
22:09:41 | FromGitter | <bung87> I usually using git clone version nim , it’s under ~/Nim/ in my machine |
22:09:43 | krux02 | used it a lot |
22:09:48 | krux02 | somebody took it away |
22:10:41 | FromGitter | <bung87> ```Nim Compiler Version 0.19.0 [MacOSX: amd64] ⏎ Compiled at 2018-09-26``` [https://gitter.im/nim-lang/Nim?at=5baea6e15a52b440159d3a2d] |
22:11:07 | krux02 | my nim is "installed" in ~/proj/nim/Nim |
22:11:27 | Araq | krux02: the 'cast' is invalid too |
22:11:40 | Araq | arrays are not pointers |
22:11:43 | FromGitter | <kdheepak> ```$ vim ~/.cache/nim/test_d/nim_glm_test.c``` |
22:11:51 | FromGitter | <kdheepak> It gets created ^ here |
22:12:31 | krux02 | Araq: yes true, but I actually meant casting a pointer to the array to cstring. Even though I didn't say it. |
22:12:46 | krux02 | I thought that was implied |
22:13:14 | krux02 | Araq: did something happen with the nimchache folder? |
22:13:26 | Araq | it moved |
22:13:31 | krux02 | where is it now? |
22:14:09 | krux02 | aparently it only moved partially, if you scroll a bit up, aparently the js backend still creates it at the old location. |
22:14:23 | FromGitter | <bung87> ah ` ~/Nim/nimcache/` all the std cache here |
22:15:15 | FromGitter | <bung87> ~/.cache/nim/ all you compiled cache here |
22:15:57 | * | tzui quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:16:41 | Nolan[m] | A C-style pointer is a ref in Nim, correct? So `ref cstring` is a C string pointer? |
22:16:53 | krux02 | Nolan[m], not really |
22:17:00 | krux02 | a ptr is a C-style pointer |
22:17:10 | krux02 | a ref is technically the same, but not for the GC |
22:17:37 | Nolan[m] | Ah. |
22:18:07 | Araq | krux02: well for the JS I didn't touch the 'nimcache' location |
22:18:51 | FromGitter | <kaushalmodi> Araq: Appveyor failed here because it timed out? https://ci.appveyor.com/project/dom96/nim/build/4941?fullLog=true |
22:18:59 | FromGitter | <kaushalmodi> message says 1hr limit was reached |
22:20:10 | krux02 | looks like some tests are running to long |
22:20:14 | krux02 | ore there are too many |
22:20:16 | krux02 | or both |
22:20:37 | FromGitter | <kaushalmodi> it seems arbitrary |
22:20:46 | FromGitter | <kaushalmodi> both travis and appveyor passed on this PR: https://github.com/nim-lang/Nim/pull/9110 |
22:20:57 | FromGitter | <kaushalmodi> which included that "failed" PR too |
22:21:00 | krux02 | sometimes you just restart |
22:21:15 | krux02 | let me rephrase that |
22:21:28 | krux02 | did you try to turn it off and on again? |
22:21:44 | FromGitter | <kaushalmodi> turn off what? |
22:21:49 | krux02 | the test |
22:21:53 | FromGitter | <kaushalmodi> no |
22:22:00 | krux02 | then do that |
22:22:02 | FromGitter | <kaushalmodi> I just pushed the commits and the test autostarts |
22:22:07 | FromGitter | <kaushalmodi> can I control that? |
22:22:26 | krux02 | just do an irrelevant change. |
22:22:32 | krux02 | you can even edit on github |
22:22:38 | krux02 | add a space somewhere |
22:22:48 | Araq | also common is to close and reopen the PR |
22:22:48 | FromGitter | <kaushalmodi> yeah, let me try force push |
22:22:54 | * | speak10 joined #nim |
22:23:35 | Araq | and 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:36 | FromGitter | <kaushalmodi> hmm.. close/reopen did not help |
22:23:52 | Araq | it does, give it a minute. |
22:24:03 | FromGitter | <kaushalmodi> it did :) |
22:24:04 | FromGitter | <kaushalmodi> thanks |
22:24:16 | * | tzui joined #nim |
22:24:18 | Nolan[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:43 | FromGitter | <rayman22201> addr or unsafe addr @Nolan[m]? |
22:27:03 | FromGitter | <rayman22201> https://nim-lang.org/docs/manual.html#statements-and-expressions-the-addr-operator |
22:27:23 | Nolan[m] | Thanks. |
22:29:13 | * | speak10 quit (Ping timeout: 245 seconds) |
22:34:19 | FromGitter | <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:14 | FromGitter | <kdheepak> i.e. if I inherit from a ref, is the final type also a ref? |
22:43:19 | FromGitter | <kdheepak> I think it is not. |
22:45:04 | shashlick | any way to define the following? crashes on 0.18.0 but works on 0.19.0 |
22:45:04 | shashlick | ``` |
22:45:06 | shashlick | pair* {.importcpp: "std::pair", header: "<utility>".}[T, U] = object |
22:45:07 | shashlick | first*:T |
22:45:08 | shashlick | second*:U |
22:45:09 | shashlick | ``` |
22:54:33 | * | mzo joined #nim |
22:55:20 | mzo | hi |
22:55:43 | FromGitter | <rayman22201> Was a fraking one line fix: https://github.com/nim-lang/Nim/pull/9112 |
22:56:05 | FromGitter | <rayman22201> @kaushalmodi or @araq if you want to check it out to verify the fix works |
22:56:18 | FromGitter | <rayman22201> I checked it myself, but more eyes and all that. |
22:57:01 | FromGitter | <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:07 | FromGitter | <rayman22201> I should probably add some automated tests for the fuzzy matcher... 😔 |
22:57:15 | FromGitter | <kdheepak> Is there a way to make it print out `TeacherRef` instead? |
22:57:32 | FromGitter | <rayman22201> hi @mzo |
23:01:28 | mzo | i'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:13 | FromGitter | <kayabaNerve> It's in system.nim which is implicitly imported into everything |
23:02:43 | FromGitter | <rayman22201> An array is very different from a sequence |
23:02:51 | FromGitter | <rayman22201> they are not subtypes |
23:03:34 | FromGitter | <bung87> in other language array also fixed size. |
23:04:05 | FromGitter | <kaushalmodi> mzo: https://nim-lang.org/docs/manual.html#types-open-arrays |
23:04:59 | FromGitter | <rayman22201> openArray is sort of a built in interface that sequence and arrays conform to |
23:05:09 | FromGitter | <kaushalmodi> @rayman22201 I'll try your PR tomorrow. Just reading it makes a lot of sense :D |
23:05:30 | FromGitter | <rayman22201> 👍 cool |
23:07:25 | FromGitter | <rayman22201> It took me longer to build the latest nim devel compiler and docs than to actually do the fix X.X |
23:07:45 | FromGitter | <rayman22201> so stupid... lol... |
23:08:03 | FromGitter | <kaushalmodi> :) |
23:08:16 | FromGitter | <kaushalmodi> mzo: here's my exploration of the open arrays topic: https://scripter.co/notes/nim/#open-arrays |
23:10:45 | FromGitter | <rayman22201> @kaushalmodi good notes :-D |
23:11:28 | FromGitter | <kdheepak> If I add an instance of a type to a seq, then it changes type? |
23:11:45 | FromGitter | <kdheepak> It is coerced to the type of the seq? |
23:12:06 | FromGitter | <kdheepak> Example here: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5baeb5461c100a4f2901ed85] |
23:12:39 | FromGitter | <kdheepak> I want to print `TeacherRef` when the sequence is printed, but it always prints PersonRef. |
23:12:57 | FromGitter | <kdheepak> I don't think I'm able to find a way to do this |
23:13:15 | FromGitter | <kdheepak> Changing the ```proc`$```` also does not work |
23:13:26 | FromGitter | <kdheepak> help? |
23:13:28 | FromGitter | <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:32 | FromGitter | <kaushalmodi> @kdheepak I believe there are few issues like this related to typetraits already open. |
23:13:51 | FromGitter | <kaushalmodi> Search for typetraits in issues. |
23:13:55 | FromGitter | <kdheepak> Okay, thanks. |
23:14:16 | FromGitter | <kdheepak> I did look through them. I didn't see a answer one way or the other. |
23:14:29 | FromGitter | <kdheepak> Any way to do this using macros / templates? |
23:14:52 | FromGitter | <rayman22201> This isn't really a typetraits thing, it's more like a standard inheritance thing... |
23:15:27 | FromGitter | <bung87> it does not know which type you want representation. |
23:15:44 | FromGitter | <kaushalmodi> @rayman22201 hmm ok |
23:15:55 | FromGitter | <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:26 | FromGitter | <bung87> imagenation A inherit from B ,C inherit from B , which one you want representation? |
23:17:57 | FromGitter | <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:23 | FromGitter | <rayman22201> I'm sorry, it's "of", not instanceof |
23:18:36 | * | scorcoran20 joined #nim |
23:18:56 | FromGitter | <bung87> it’s js keyword ha. |
23:19:29 | FromGitter | <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:52 | FromGitter | <kdheepak> I added `age` for `TeacherRef` ⏎ ⏎ ``` TeacherRef = ref object of PersonRef ⏎ age: int``` [https://gitter.im/nim-lang/Nim?at=5baeb718c7bf7c36628960ac] |
23:20:04 | FromGitter | <rayman22201> what compile error do you get? |
23:20:34 | FromGitter | <kdheepak> ```code paste, see link``` |
23:20:58 | FromGitter | <rayman22201> oh! You have to cast it first |
23:20:59 | FromGitter | <kdheepak> In that proc, nim thinks `p` is `PersonRef` and not `TeacherRef`. |
23:21:39 | FromGitter | <rayman22201> the "of" operator tells you that it is a TeacherRef, but it won't convert it to a TeacherRef for you |
23:21:43 | FromGitter | <kdheepak> How do I cast? |
23:21:53 | FromGitter | <rayman22201> pulling up the docs for it. hold on. |
23:22:07 | FromGitter | <bung87> castX (Y) |
23:22:16 | FromGitter | <bung87> `castX (Y)` |
23:22:33 | FromGitter | <kdheepak> ``` var p = cast[TeacherRef](p)``` |
23:22:36 | FromGitter | <kdheepak> So that worked. |
23:22:40 | FromGitter | <rayman22201> https://nim-lang.org/docs/manual.html#statements-and-expressions-type-casts |
23:22:43 | FromGitter | <rayman22201> oh, yeah |
23:22:45 | FromGitter | <rayman22201> there you go |
23:22:47 | FromGitter | <rayman22201> lol |
23:22:53 | * | scorcoran20 quit (Remote host closed the connection) |
23:23:09 | FromGitter | <kdheepak> But what happens if I pass in a PersonRef to it, and it tries to cast it to TeacherRef? |
23:23:19 | FromGitter | <bung87> keep in mind , you’re programing in static type language.. |
23:23:19 | FromGitter | <rayman22201> I have too many languages in my head, so I always have to look synta up first to make sure |
23:24:15 | FromGitter | <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:59 | FromGitter | <rayman22201> You need to put the cast inside the if |
23:25:30 | FromGitter | <rayman22201> you are casting `p` before checking what `p` even is |
23:25:52 | FromGitter | <rayman22201> Nim is nice to you here. In C/C++ that would segv |
23:25:54 | FromGitter | <rayman22201> :-P |
23:25:54 | FromGitter | <kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5baeb8825331811c2e1f7a67] |
23:26:26 | FromGitter | <rayman22201> yeah, The Nim compiler was even smart enough to warn you that you were doing something silly :-P nice |
23:26:51 | FromGitter | <bung87> you do the things like castbool (1) == true. |
23:26:52 | FromGitter | <kdheepak> This seems to work though ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5baeb8bcef4afc4f28eea25d] |
23:27:11 | FromGitter | <bung87> you do the things like `castbool (1) == true` |
23:27:31 | FromGitter | <kdheepak> Great! I think I got what I needed! |
23:27:43 | FromGitter | <kdheepak> Thanks everyone! You are all super helpful! |
23:28:13 | FromGitter | <rayman22201> np! Glad to have more Nim programmers :-) |
23:30:09 | FromGitter | <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") |