00:00:01 | * | junland quit (Quit: %ZNC Disconnected%) |
00:00:43 | * | junland joined #nim |
00:02:05 | * | a_chou quit (Ping timeout: 240 seconds) |
00:27:51 | * | Mortir quit (Quit: leaving) |
00:38:12 | * | NimBot joined #nim |
00:47:16 | FromDiscord | <iWonderAboutTuatara> pretty sure $ can cast a char to a str |
00:47:30 | FromDiscord | <iWonderAboutTuatara> oh wait nevermind, I misread |
01:04:22 | Prestige | What's the point of initDoublyLinkedList when you can just use DoublyLinkedList[T]()? The proc is empty |
01:04:28 | Prestige | https://github.com/nim-lang/Nim/blob/version-1-2/lib/pure/collections/lists.nim#L145 |
01:04:38 | disruptek | it might have a role in the future. |
01:04:45 | Prestige | ah good point |
01:07:56 | Prestige | Reason I'm asking is because of this example: https://play.nim-lang.org/#ix=2zEv |
01:08:28 | Prestige | I was attempting to create the list as a var and assign result.bar = ref myList, but it is incorrect |
01:10:12 | Prestige | Something like this: https://play.nim-lang.org/#ix=2zEx not sure what I'm missing |
01:10:16 | * | a_chou joined #nim |
01:14:19 | * | vicfred joined #nim |
01:45:25 | * | apahl quit (Ping timeout: 240 seconds) |
01:46:27 | * | apahl joined #nim |
01:46:38 | FromDiscord | <exelotl> when I make a set[range[0..2047]], it produces an array of 256 u8 under the hood |
01:46:59 | FromDiscord | <exelotl> is there a way to make it produce an array of 128 u16s instead ? |
01:50:18 | FromDiscord | <exelotl> I tried applying {.size:2.} to the set itself, this results in the set becoming a single u16 which is no good x) |
01:56:11 | FromDiscord | <Rika> I do not think so, and I do not see the benefit to doing so |
02:05:08 | * | lritter joined #nim |
02:06:15 | FromDiscord | <exelotl> admittedly I haven't looked at the asm so it might make no difference, but basically I'm working with a region of memory that prefers 16-bit access (8 bit access is no faster or slower, but I guess more likely to require extra shifts/masking) |
02:08:00 | FromDiscord | <exelotl> Probably the more important one would be when working with memory that prefers 32 bit access. Since the GBA has a 32 bit CPU, if I could have a set backed by an array of u32s, that would be way preferable because the values wouldn't require any shifting/masking at all. |
02:42:11 | * | user0 joined #nim |
02:44:32 | * | user0 quit (Client Quit) |
02:53:25 | * | muffindrake quit (Ping timeout: 240 seconds) |
02:55:50 | * | muffindrake joined #nim |
03:18:42 | FromDiscord | <shashlick> does travis-ci allow testing on alpine? without docker? |
03:24:39 | FromDiscord | <Avatarfighter> Whats the best way of turning a seq of bytes to a string? |
03:25:41 | FromDiscord | <Elegant Beef> Should be able to cast to string |
03:26:16 | FromDiscord | <Avatarfighter> ok that's what I thought lmao |
03:26:38 | FromDiscord | <Avatarfighter> i definitely didn't iterate through the string and do `result = result & chr(b)` |
03:26:54 | FromDiscord | <Avatarfighter> through the seq of bytes I mean |
03:28:36 | FromDiscord | <Avatarfighter> goddamn sometimes i write the ugliest looking code |
03:31:16 | FromDiscord | <shashlick> why not just cast to cstring and use $ |
03:32:53 | FromDiscord | <Avatarfighter> well one reason is because I didn't think of that |
03:33:44 | FromDiscord | <Elegant Beef> !eval let a = @['h'.byte,'e'.byte, 'l'.byte, 'l'.byte, 'o'.byte]; echo cast[string](a) |
03:33:48 | NimBot | hello |
03:34:03 | FromDiscord | <Avatarfighter> well uhm |
03:34:14 | FromDiscord | <Avatarfighter> i guess i can push my homemade crypto to github now 🙂 |
03:34:22 | FromDiscord | <PizzaFox> isnt the `.byte` for the 1-4th items unnecessary @Elegant Beef |
03:34:32 | FromDiscord | <Elegant Beef> Nope no implict conversion from char to byte |
03:34:40 | FromDiscord | <PizzaFox> sad |
03:34:52 | FromDiscord | <Elegant Beef> I mean it takes 2 seconds to implement but i didnt want to |
03:35:25 | FromDiscord | <PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2zES |
03:35:26 | FromDiscord | <Elegant Beef> https://play.nim-lang.org/#ix=2zER |
03:35:29 | FromDiscord | <Elegant Beef> Implementation 😛 |
03:35:59 | FromDiscord | <PizzaFox> (edit) 'https://play.nim-lang.org/#ix=2zES' => 'https://play.nim-lang.org/#ix=2zET' |
03:36:15 | FromDiscord | <Elegant Beef> I dont know anything about Peg, but i think NPeg is pretty nice from my ears listening here 😄 |
03:36:27 | FromDiscord | <PizzaFox> (edit) 'https://play.nim-lang.org/#ix=2zET' => 'https://play.nim-lang.org/#ix=2zEU' |
03:36:39 | FromDiscord | <PizzaFox> its nicer than figuring out the nim regex implementations lol |
03:36:55 | FromDiscord | <Elegant Beef> Nim's regex is just PCRE |
03:36:55 | FromDiscord | <PizzaFox> although my peg code doesnt work and the regex code kinda worked so |
03:37:05 | FromDiscord | <PizzaFox> yeah but nre vs re |
03:37:24 | FromDiscord | <PizzaFox> if i were a nim developer i would simply create a single regex lib |
03:37:25 | FromDiscord | <Elegant Beef> I briefly looked at npeg, and went "yep i understand some things" |
03:38:27 | leorize | @PizzaFox have you heard of nim-regex? :P |
03:38:27 | * | muffindrake quit (Ping timeout: 240 seconds) |
03:38:30 | leorize | !repo regex |
03:38:31 | disbot | https://github.com/nitely/nim-regex -- 9nim-regex: 11Pure Nim regex engine. Guarantees linear time matching 15 96⭐ 13🍴 7& 9 more... |
03:38:45 | FromDiscord | <PizzaFox> listen dude |
03:38:51 | FromDiscord | <PizzaFox> i just want to make my peg snippet work |
03:39:53 | leorize | so you wanna match everything but whitespace? |
03:40:07 | leorize | actually I'm not that well versed in regex lol |
03:40:23 | FromDiscord | <PizzaFox> `\w` in both nim builtin PEGs and regex is `[0-9A-Z_a-z]` |
03:40:33 | leorize | is this dash (-) or whitespace? |
03:40:34 | FromDiscord | <PizzaFox> i want to match that + the hypen `-` |
03:40:38 | leorize | ah ok |
03:40:51 | FromDiscord | <PizzaFox> peg is mad because i cant put a `\w` in the `[]` |
03:41:17 | FromDiscord | <PizzaFox> surely there is a solution |
03:41:34 | leorize | just use an ordered choice? |
03:41:41 | FromDiscord | <PizzaFox> wat |
03:41:49 | leorize | so `'-' / \w`? |
03:41:58 | FromDiscord | <PizzaFox> > Apply expressions A, ..., Z, in this order, to the text ahead, until one of them succeeds and possibly consumes some text. |
03:42:08 | FromDiscord | <PizzaFox> this would work i think?? |
03:42:39 | FromDiscord | <PizzaFox> ```nim↵peg"(\w / \-)"↵[\-0-9A-Z_a-z] == type Peg↵``` |
03:42:49 | FromDiscord | <PizzaFox> seems legit |
03:43:33 | FromDiscord | <PizzaFox> it is in fact legit |
03:43:42 | FromDiscord | <PizzaFox> thanks |
03:44:03 | FromDiscord | <Avatarfighter> leorize: remember that cryptography you helped me convert a month or 6 back ? |
03:44:12 | leorize | yes? |
03:44:44 | FromDiscord | <Avatarfighter> Do you know if its wise to put it on gitub? |
03:44:48 | FromDiscord | <Avatarfighter> github* |
03:45:01 | FromDiscord | <Elegant Beef> Why wouldnt it be? 😄 |
03:45:03 | leorize | why not? lol |
03:45:10 | FromDiscord | <Avatarfighter> ok |
03:45:35 | FromDiscord | <Avatarfighter> oo this is going to be fun i get to write disclaimers in the readme lmao |
03:45:54 | FromDiscord | <Avatarfighter> "written by a high schooler that barely passed algebra" "not for production" |
03:46:58 | FromDiscord | <Elegant Beef> I mean if you're using a cryptography library, i'd wager you'd want to audit it 😄 |
03:47:04 | FromDiscord | <Avatarfighter> pshhh |
03:47:05 | FromDiscord | <Avatarfighter> auditing |
03:47:17 | FromDiscord | <Elegant Beef> MIT removes liabaility |
03:47:26 | FromDiscord | <Avatarfighter> smart |
03:47:30 | FromDiscord | <Avatarfighter> MIT license it is |
03:50:11 | leorize | every oss license does that tbh |
03:50:32 | FromDiscord | <Avatarfighter> honestly ill just live on the edge and not put a license |
03:51:12 | leorize | remember to keep the copyright of the people who wrote the original |
03:51:31 | FromDiscord | <Avatarfighter> oh god |
03:51:43 | FromDiscord | <Avatarfighter> do i do the copyright of the js library or the library the js library was based off of? |
03:51:57 | leorize | of the part you translated |
03:52:10 | FromDiscord | <Avatarfighter> ok |
03:52:10 | FromDiscord | <Avatarfighter> hm |
03:52:28 | FromDiscord | <Avatarfighter> well i kind of started with the js library and then you helped me fix the c library i continuedd with |
03:52:50 | leorize | the js is made from the c |
03:52:58 | FromDiscord | <Avatarfighter> oh |
03:52:59 | FromDiscord | <Avatarfighter> ok |
03:53:01 | leorize | so the js should have all the copyrights you need |
03:53:02 | FromDiscord | <Avatarfighter> C lib it is lmao |
03:53:09 | FromDiscord | <Avatarfighter> honestly I'll cross that bridge when I get there |
03:54:54 | FromDiscord | <Avatarfighter> gn everyone enjoy |
03:57:48 | * | a_chou quit (Quit: a_chou) |
03:58:37 | FromDiscord | <shashlick> do people usually stick with busybox on alpine or install tools like findutils |
04:03:22 | * | Jesin quit (Ping timeout: 258 seconds) |
04:06:01 | * | supakeen quit (Quit: WeeChat 2.9) |
04:06:37 | * | supakeen joined #nim |
04:07:08 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
04:29:42 | * | stever quit (Read error: Connection reset by peer) |
04:29:52 | * | stever joined #nim |
04:30:15 | * | ormiret quit (Read error: Connection reset by peer) |
04:30:26 | * | ormiret joined #nim |
04:30:55 | * | thomasross quit (Ping timeout: 240 seconds) |
04:45:48 | * | hoek quit (Ping timeout: 256 seconds) |
04:48:00 | * | hoek joined #nim |
04:51:41 | FromDiscord | <PizzaFox> npeg making my brain turn into soup |
04:52:36 | FromDiscord | <PizzaFox> i have the regex↵```↵\/(.+)\/?$↵``` |
04:52:50 | FromDiscord | <PizzaFox> for matching urls (ex. `/path/`) |
04:52:55 | FromDiscord | <PizzaFox> (edit) 'urls' => 'url segments' |
04:53:32 | FromDiscord | <PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2zFh |
04:54:44 | FromDiscord | <PizzaFox> however, npeg is being annoying and so i need to specify the `+1` (1 or more of any char) as being 1 or more of not `/` |
05:23:51 | * | solitudesf joined #nim |
05:24:31 | FromDiscord | <PizzaFox> it turns out i dont even need to use regex for any of this i can just split on `/` i am an idiot |
05:24:41 | FromDiscord | <PizzaFox> i have spent easily 4+ hours writing this parsing code |
05:33:55 | * | wowi42 quit (Quit: Kowa Bunga!!!) |
05:36:01 | * | wowi42 joined #nim |
05:40:25 | * | leorize quit (Quit: WeeChat 2.9) |
05:51:59 | * | narimiran joined #nim |
06:02:00 | * | Jesin joined #nim |
06:06:55 | * | vqrs quit (Ping timeout: 272 seconds) |
06:08:12 | * | vqrs joined #nim |
06:31:16 | FromDiscord | <iWonderAboutTuatara> Hey, is there any way to compile to C and view the C code in a .c file? |
06:31:21 | FromDiscord | <iWonderAboutTuatara> or cpp, doesn't matter |
06:31:26 | FromDiscord | <iWonderAboutTuatara> stdin breaks when I compile to js |
06:31:31 | FromDiscord | <iWonderAboutTuatara> and I need to submit to codeforces |
06:36:09 | FromDiscord | <iWonderAboutTuatara> nothing on the internet is giving me a good cout |
06:46:11 | * | apahl quit (Ping timeout: 272 seconds) |
06:46:40 | * | apahl joined #nim |
06:51:22 | FromDiscord | <Elegant Beef> Nim does output the C into a temp directory located in `~/.cache/nim` but i believe can also tell the compiler to export C to a specific path iirc |
06:53:33 | FromDiscord | <iWonderAboutTuatara> how? |
06:54:39 | FromDiscord | <Elegant Beef> `--nimcache:` although it creates a lot of mess so be cautious 😄 |
06:54:45 | FromDiscord | <Elegant Beef> Put it in a folder 😄 |
06:56:26 | * | Vladar joined #nim |
07:00:11 | FromDiscord | <iWonderAboutTuatara> I found it in ~.cache/nim! |
07:00:19 | FromDiscord | <iWonderAboutTuatara> Completely unreadable, but nbd |
07:02:16 | FromDiscord | <iWonderAboutTuatara> wow this is not readable |
07:02:18 | FromDiscord | <iWonderAboutTuatara> like at all |
07:02:27 | FromDiscord | <iWonderAboutTuatara> not a huge deal, but like |
07:02:39 | FromDiscord | <iWonderAboutTuatara> Is this size more size efficient than "normal" c? |
07:03:00 | FromDiscord | <iWonderAboutTuatara> like haxe output is not readable, but this is another level |
07:03:06 | * | opal quit (Remote host closed the connection) |
07:03:41 | Prestige | I don't think that's the intent :P |
07:05:17 | FromDiscord | <iWonderAboutTuatara> true |
07:05:26 | FromDiscord | <iWonderAboutTuatara> ah codeforces says compile error |
07:05:36 | FromDiscord | <iWonderAboutTuatara> no idea what to do about that |
07:05:42 | FromDiscord | <iWonderAboutTuatara> seems like some deps are missing? not sure |
07:05:55 | FromDiscord | <iWonderAboutTuatara> ```Can't compile file:↵program.c:11:21: fatal error: nimbase.h: No such file or directory↵compilation terminated.``` |
07:09:19 | FromDiscord | <iWonderAboutTuatara> wait what is this? |
07:09:34 | FromDiscord | <iWonderAboutTuatara> ```nim↵var↵ x : int``` |
07:09:42 | FromDiscord | <iWonderAboutTuatara> throws me an error saying tabs are not allowed? |
07:11:57 | FromDiscord | <iWonderAboutTuatara> yet if i copy paste from another file it works... |
07:15:28 | supakeen | Set your editor to visually show you tabs/spaces, it'd be easier to see. |
07:15:30 | FromDiscord | <iWonderAboutTuatara> ok, i rmed it and cped to make it again, and it works completely fine now |
07:15:37 | FromDiscord | <iWonderAboutTuatara> how do I set this? |
07:15:44 | FromDiscord | <iWonderAboutTuatara> It was defaulting to that after entering var |
07:21:28 | * | nature joined #nim |
07:21:45 | supakeen | I don't know every editor. |
07:21:56 | supakeen | But most can do so, in vim it's `:set list`. |
07:23:45 | FromDiscord | <Elegant Beef> @iWonderAboutTuatara what editor? |
07:33:07 | Zevv | PizzaFox: zup, npeg troubles? |
07:33:35 | Zevv | it turned my brain into soup |
07:34:09 | FromDiscord | <Elegant Beef> Glad it's not abnormal |
07:41:42 | FromDiscord | <iWonderAboutTuatara> vsc |
07:41:57 | FromDiscord | <iWonderAboutTuatara> it was a one off bug, never had an issue with this before |
07:42:18 | FromDiscord | <Elegant Beef> Yea you can force it to use spaces if so needed |
07:46:10 | FromDiscord | <iWonderAboutTuatara> I prefer tabs |
07:46:28 | FromDiscord | <iWonderAboutTuatara> I've always used tabs |
07:48:49 | FromDiscord | <Elegant Beef> I also prefer tabs, but to support lack of unanimous editor support for customizing the size of tabs we get spaces 😄 |
07:49:21 | FromDiscord | <Elegant Beef> you *can* use source code filters to replace tabs with spaces though |
07:53:05 | * | vicfred quit (Quit: Leaving) |
08:01:58 | supakeen | Can I mark a testcase as expected to fail? |
08:06:00 | * | letto quit (Read error: Connection reset by peer) |
08:06:44 | * | letto joined #nim |
08:11:30 | * | opal joined #nim |
08:20:24 | ForumUpdaterBot | New thread by Mantielero: Nimqml's abstractitemmodel example is unclear to me, see https://forum.nim-lang.org/t/6888 |
09:08:39 | * | ldlework quit (Read error: Connection reset by peer) |
09:09:48 | * | ldlework joined #nim |
09:13:01 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
09:20:05 | * | rusua_ joined #nim |
09:21:31 | * | rusua_ is now known as rusua |
09:27:37 | * | arecacea1 quit (Ping timeout: 240 seconds) |
09:28:27 | * | narimiran quit (Ping timeout: 240 seconds) |
09:28:53 | * | natrys joined #nim |
09:28:59 | * | narimiran joined #nim |
09:30:39 | * | arecacea1 joined #nim |
09:33:00 | FromDiscord | <whisperdev> ughh i found out my nim code is 5 - 6 times slower than a powershell commandlet |
09:33:00 | * | d10n-work quit (Ping timeout: 240 seconds) |
09:34:12 | * | d10n-work joined #nim |
09:34:59 | * | ForumUpdaterBot quit (Remote host closed the connection) |
09:35:06 | * | ForumUpdaterBot joined #nim |
09:37:45 | FromDiscord | <Vindaar> then you're probably doing something really inefficient (and compile in debug mode I assume?) |
09:41:03 | FromDiscord | <whisperdev> or microsoft can write optimized commandlets 😄 |
09:42:04 | FromDiscord | <Vindaar> what are you using it for? |
09:43:01 | * | lritter quit (Quit: Leaving) |
09:44:20 | FromDiscord | <whisperdev> Vindaar: This http://www.codersource.net/2010/02/16/enumservicesstatus-enumerate-nt-services/ |
09:44:27 | FromDiscord | <whisperdev> And the Nim code looks pretty much the same |
09:49:41 | FromDiscord | <Vindaar> wow, perfect example why braces are inferior. What's so hard about indenting stuff, so that it's actually readable? ↵Can you share your Nim code? Not that I'd be any help though, given that Windows and it's API for this sort of stuff is completely out of my area of expertise. I wouldn't be surprised if the bottleneck here is just Windows providing the results here. But again, I'm clueless in this |
09:54:47 | * | apahl quit (Ping timeout: 240 seconds) |
09:55:23 | * | narimiran quit (Ping timeout: 265 seconds) |
09:55:55 | * | apahl joined #nim |
10:04:54 | * | gangstacat_ joined #nim |
10:08:15 | * | gangstacat quit (Ping timeout: 240 seconds) |
10:08:15 | * | letto quit (Ping timeout: 240 seconds) |
10:08:15 | * | letto joined #nim |
10:11:35 | * | muffindrake joined #nim |
10:33:16 | * | JustASlacker joined #nim |
10:39:18 | FromDiscord | <iWonderAboutTuatara> I cannot look at that code holy crap |
10:39:27 | FromDiscord | <iWonderAboutTuatara> Worse than latex |
10:39:44 | FromDiscord | <iWonderAboutTuatara> This is why curly braces bad |
10:40:13 | FromDiscord | <iWonderAboutTuatara> Like sure, you might be more used to it, but this is too much |
10:57:44 | * | JustASlacker quit (Ping timeout: 272 seconds) |
10:59:33 | FromDiscord | <lqdev> hm, i wonder if box2d can be wrapped trivially using c2nim |
11:03:37 | * | sagax joined #nim |
11:07:21 | supakeen | dom96: If we're going to debate names it's probably better to do it here? I suggest 'parseHeaderField' since it returns both field-name and field-value :) |
11:11:18 | Zevv | ping leorize[m]1 |
11:13:19 | federico3 | can somebody clean up issues phrased like https://github.com/nim-lang/needed-libraries/issues/91 please? |
11:13:19 | disbot | ➥ Are we Rested? |
11:17:09 | FromDiscord | <Yardanico> lol |
11:17:24 | FromDiscord | <Yardanico> are we oxidised yet? |
11:17:35 | FromDiscord | <Yardanico> are we biblified yet? |
11:17:37 | Zevv | how does this make sense? http://ix.io/2zGz |
11:17:44 | Zevv | Why does my `==` get passed 3 arguments? |
11:18:15 | Zevv | ooh wait daang |
11:19:12 | Zevv | ignore zevv plz |
11:19:53 | FromDiscord | <Rika> ok |
11:20:16 | supakeen | ok |
11:21:26 | * | waleee-cl joined #nim |
11:22:28 | FromDiscord | <Yardanico> okno |
11:22:34 | FromDiscord | <Rika> ok go |
11:22:38 | FromDiscord | <Yardanico> Means window in Russian |
11:22:40 | FromDiscord | <Yardanico> окно |
11:22:45 | FromDiscord | <ache of head> in polish too |
11:23:01 | FromDiscord | <Yardanico> dobre |
11:23:04 | FromDiscord | <ache of head> haha |
11:25:22 | supakeen | это не проблема |
11:25:31 | FromDiscord | <Yardanico> mundainai |
11:25:40 | FromDiscord | <Yardanico> Means what you said in Russian, but in Japanese |
11:25:52 | FromDiscord | <Yardanico> Sorry mondai nai* |
11:26:01 | supakeen | I don't know, the letters don't look very Japanese to me. |
11:26:07 | FromDiscord | <Yardanico> romanji |
11:26:42 | FromDiscord | <Yardanico> everyone is relaxing on this fine sunday? |
11:26:46 | FromDiscord | <Yardanico> almost no activity :) |
11:26:57 | supakeen | Working on some PRs but otherwise a nice rainy day in. |
11:27:22 | supakeen | How's stuff there? |
11:27:37 | FromDiscord | <Yardanico> it's sunny outside, but 11 celcius |
11:27:58 | FromDiscord | <Yardanico> normal temperature for this time of the year in my region |
11:28:18 | supakeen | At least something is normal in 2020. |
11:28:31 | FromDiscord | <Yardanico> haha |
11:29:02 | supakeen | We've got a storm picking up: https://i.imgur.com/JoKEBJI.png |
11:47:49 | FromDiscord | <Yardanico> Randomly (I swear) stumbled upon this |
11:47:51 | FromDiscord | <Yardanico> https://forum.dlang.org/post/[email protected] |
12:02:35 | FromDiscord | <Recruit_main707> i dont get Araq's latest rfc, whats the difference between `cast(noSideEffect)` and `noSideEffect`? |
12:03:45 | Yardanico | newer syntax is easier to search for in files |
12:03:47 | Yardanico | and easier to understand |
12:04:04 | Yardanico | you see, right now {.noSideEffect.} can be used both as an annotation for the proc and as an annotation for a code block |
12:04:38 | Yardanico | and if in the first case it means "proc has no side effects", in the second one it means "compiler, I say to you that this code block has NO side effects, and you must obey!" |
12:04:49 | supakeen | Poor compiler. |
12:05:01 | Yardanico | so there are two exactly opposite meanings depending on the location of the pragma |
12:05:08 | Yardanico | same goes for others like gcsafe |
12:05:16 | FromDiscord | <Recruit_main707> i see |
12:05:21 | FromDiscord | <Recruit_main707> makes sense now |
12:05:24 | FromDiscord | <Recruit_main707> thank you |
12:06:02 | * | supakeen quit (Quit: WeeChat 2.9) |
12:06:34 | * | supakeen joined #nim |
12:06:36 | FromDiscord | <lqdev> how can i wrap virtual procs from c++? |
12:07:14 | FromDiscord | <lqdev> iirc there was an article about this somewhere |
12:08:06 | Yardanico | yes |
12:08:13 | Yardanico | 10 secs |
12:08:45 | Yardanico | or a bit more |
12:08:58 | Yardanico | https://github.com/nim-lang/Nim/wiki/Playing-with-CPP--VTABLE-from-Nim |
12:09:18 | Yardanico | basically you just make an array of proc pointers in Nim |
12:10:07 | FromDiscord | <Recruit_main707> this could be worth it when we get default values |
12:15:40 | supakeen | Mrm, is there a way to make a type generic? |
12:15:44 | Yardanico | yes |
12:15:47 | * | jjido joined #nim |
12:15:52 | Yardanico | type MyType[T] = object myfield: T |
12:15:59 | supakeen | Perfect. |
12:16:20 | Yardanico | you don't even have to use T in your object fields, but then you'll have to specify T explicitly any time you instantiate the type |
12:17:31 | supakeen | No this is perfect, I'm implementing a bunch of LCGs and some are uint64 others are int32, etc. |
12:22:36 | supakeen | https://github.com/supakeen/simba/blob/master/src/simba/lcg.nim seems to work fine :) |
12:24:31 | FromDiscord | <Recruit_main707> do you need to add all the 'u32 even when specifying the type before? |
12:25:22 | FromDiscord | <Recruit_main707> yep, apparently you need to |
12:51:31 | Yardanico | where exactly? |
13:00:23 | FromDiscord | <flywind> ```nim↵const useWinVersion = defined(Windows) or defined(nimdoc)↵``` |
13:00:33 | Yardanico | defined(windows) :) |
13:00:44 | FromDiscord | <flywind> This line makes it hard to build docs in `linux`. |
13:00:46 | * | natrys quit (Quit: natrys) |
13:00:50 | Yardanico | does it? |
13:01:20 | Yardanico | it's here because docs should look the same for linux and windows and other platforms |
13:01:22 | FromDiscord | <Rika> i dont see why the nimdoc portion should be there |
13:01:29 | Yardanico | because docs are the same anyway |
13:01:36 | Yardanico | so you don't have to replicate docs for each proc for different OS |
13:01:39 | FromDiscord | <flywind> For external library, it exports windows version SocketHandle |
13:01:49 | Yardanico | so usually the windows proc has documentation, and for linux or others it doesn't |
13:02:23 | FromDiscord | <flywind> sent a code paste, see https://paste.rs/V9J |
13:02:23 | FromDiscord | <flywind> So I got |
13:03:09 | FromDiscord | <flywind> wrong msg |
13:03:16 | FromDiscord | <flywind> sent a code paste, see https://play.nim-lang.org/#ix=2zH3 |
13:03:38 | Yardanico | well, this means that you import both winlean and posix |
13:03:45 | Yardanico | and need to specify explicitly |
13:03:59 | FromDiscord | <flywind> This is causes by `defined(nimdoc)` in stdlib. |
13:04:05 | Yardanico | but it's for documentation |
13:04:36 | FromDiscord | <flywind> Yea, users may want to build docs in linux |
13:04:43 | FromDiscord | <flywind> Yea, I mean docs |
13:05:25 | FromDiscord | <flywind> stdlib use `export SocketHandle` to export wrong SocketHandle in nimdoc |
13:05:39 | Yardanico | yes, and your module should be cross-platform :P |
13:05:40 | Yardanico | https://github.com/nim-lang/Nim/issues/8989 |
13:05:42 | disbot | ➥ `defined(nimdoc)` special case causes `nim doc` failures, eg with jester: Error: undeclared identifier: 'EWOULDBLOCK' ; snippet at 12https://play.nim-lang.org/#ix=2zH4 |
13:08:00 | FromDiscord | <flywind> I can avoid this by hand, namely `import nativesockets except SocketHandle`. Are there better ways? |
13:11:32 | FromDiscord | <flywind> Or `runnableExamples` should not be advised to use with `stdlib`. |
13:12:31 | Yardanico | well, if you have runnableExamples, the code should then run on any platform you want to build docs on |
13:27:28 | FromDiscord | <flywind> Ok, I find a work around. The docs servers should download docs files from latest release zip files in github. |
13:39:40 | * | narimiran joined #nim |
13:53:37 | * | federico3_ joined #nim |
13:54:52 | * | federico3_ quit (Client Quit) |
13:55:11 | * | federico3_ joined #nim |
13:57:11 | * | federico3_ quit (Client Quit) |
14:04:09 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
14:04:58 | * | jjido joined #nim |
14:12:30 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
14:18:43 | * | jjido joined #nim |
14:22:13 | * | arecacea1 quit (Remote host closed the connection) |
14:22:37 | * | arecacea1 joined #nim |
15:12:35 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:14:39 | * | jjido joined #nim |
15:32:51 | disruptek | yer killin' me jc |
15:34:52 | supakeen | привет комраде руптеком |
15:46:20 | leorize[m]1 | Zevv: o/ |
15:48:13 | * | Trustable joined #nim |
16:04:39 | Zevv | oi! |
16:04:54 | Zevv | My NimStart sometimes says "Press enter to continue" |
16:05:15 | Zevv | is that me or is that you |
16:07:08 | FromDiscord | <Rika> just you |
16:07:59 | disruptek | rika: how many chickens do you own? |
16:08:19 | FromDiscord | <Rika> a few |
16:08:20 | FromDiscord | <Rika> why |
16:08:30 | disruptek | HOW MANY |
16:08:37 | disruptek | don't lie. |
16:08:56 | FromDiscord | <Rika> uh |
16:08:58 | FromDiscord | <Rika> a few |
16:09:41 | FromDiscord | <juan_carlos> https://esolangs.org/wiki/Chicken#Hello.2C_world.21 |
16:10:06 | FromDiscord | <shashlick> Anyone has a Nim file search tool that's cross platform |
16:10:12 | FromDiscord | <Rika> wdym |
16:10:27 | FromDiscord | <shashlick> find -regex etc |
16:10:33 | ForumUpdaterBot | New thread by Mrhdias: Wrapping synchronous code into asynchronous call, see https://forum.nim-lang.org/t/6889 |
16:10:37 | FromDiscord | <Rika> ah you mean filenames? |
16:10:39 | FromDiscord | <Rika> not grep? |
16:10:42 | FromDiscord | <shashlick> Yes |
16:11:12 | FromDiscord | <shashlick> I'd use nimgrep but 1.0.x doesn't support the --follow flag |
16:11:45 | FromDiscord | <shashlick> Busybox find doesn't support egrep regex |
16:12:09 | disruptek | isn't this like 10 lines of nim? |
16:12:26 | FromDiscord | <shashlick> I have to search at compile time so using walkDir + nim-regex is too slow |
16:12:46 | disruptek | so compile the tool first. |
16:13:02 | FromDiscord | <shashlick> Can't you tell I'm trying to be lazy? |
16:13:04 | disruptek | isn't that how nimgrep and find work? |
16:13:17 | disruptek | i think it'd be easier to write your own, honestly. |
16:13:35 | FromDiscord | <shashlick> Plus getting this working across all os is a pain |
16:13:48 | disruptek | should be easy under nim. |
16:14:27 | disruptek | i would look at fzf first, if you really, really hate writing nim. |
16:17:19 | FromDiscord | <shashlick> I'd rather ask busybox users to install a proper wget and find |
16:17:32 | disruptek | yeah, fuck those kids. |
16:34:40 | * | vicfred joined #nim |
16:37:55 | leorize[m]1 | Zevv: pretty sure that's just your setup |
16:38:23 | Zevv | ok, thanks! |
16:42:10 | * | a_chou joined #nim |
16:42:50 | FromDiscord | <haxscramper> Is it possible to force expansion of the `match` macro in last proc without using `expandMacros:` explicitly? https://play.nim-lang.org/#ix=2zI9 |
16:44:21 | * | a_chou quit (Remote host closed the connection) |
16:45:34 | FromDiscord | <juan_carlos> `--expandmacros:FOO` from terminal. |
16:46:20 | FromDiscord | <whisperdev> @Vindaar https://play.nim-lang.org/#ix=2zIc |
16:46:51 | FromDiscord | <whisperdev> I think it's because of the additional call to EnumServiceStatus. I guess the "Get-Service" commandlet is much smarter and needs just a single call |
16:48:11 | FromDiscord | <haxscramper> Bad wording. I want to get rid of error, not expand macro. `expandMacros` is just one possible workaround, but I'm interested if there is anything for actually fixing the issue itself. `macro expand*(body: typed): untyped = body` works too, but then I need to write `expand case ():` |
16:48:38 | ForumUpdaterBot | New thread by Blmvxer: Nim Honeypot Project, see https://forum.nim-lang.org/t/6890 |
16:58:48 | * | m4r35n357 joined #nim |
16:59:21 | FromDiscord | <lqdev> the more modules from box2d i wrap the more i feel like my compilation speeds are going to plummet |
17:03:32 | FromDiscord | <lqdev> anyone knows of any pure C 2D physics libraries? |
17:03:50 | FromDiscord | <enthus1ast> chipmunks maybe |
17:04:07 | FromDiscord | <enthus1ast> cannot remember if box2d or chipmunks was c only |
17:04:37 | FromDiscord | <enthus1ast> ^ @lqdev |
17:04:45 | FromDiscord | <lqdev> box2d is C++ |
17:04:51 | FromDiscord | <lqdev> and it's a pita to wrap because of that |
17:05:02 | FromDiscord | <lqdev> because c2nim can't handle C++ very well |
17:05:34 | FromDiscord | <lqdev> chipmunk seems promising, lemme see |
17:05:39 | FromDiscord | <enthus1ast> https://github.com/slembcke/Chipmunk2D |
17:05:43 | FromDiscord | <enthus1ast> C99 |
17:06:59 | FromDiscord | <lqdev> yeah found it already |
17:07:53 | FromDiscord | <lqdev> nice, MIT licensed |
17:08:01 | FromDiscord | <enthus1ast> are you building an engine lqdev? |
17:11:38 | * | sschwarzer joined #nim |
17:13:08 | sschwarzer | I'm trying to use a generic proc type declaration as in https://play.nim-lang.org/#ix=2zIn , but the compiler gives me "/usercode/in.nim(5, 23) Error: invalid indentation". The declaration works without the type parameter `S` and the `state` parameter. |
17:13:50 | sschwarzer | Any idea what I need to modify to use the generic type `S` here? |
17:14:38 | * | m4r35n357 quit (Quit: Ex-Chat) |
17:15:43 | FromDiscord | <lqdev> you can't create generic procs like that |
17:15:58 | FromDiscord | <lqdev> you have to move the [S] param to the type definition |
17:16:11 | FromDiscord | <lqdev> https://play.nim-lang.org/#ix=2zIq |
17:16:42 | sschwarzer | lqdev: ah, that looks better, thanks! :-) |
17:17:19 | FromDiscord | <lqdev> np |
17:17:50 | sschwarzer | The error message previously is a bit confusing though. |
17:18:05 | sschwarzer | i. e. for my original code |
17:20:29 | FromDiscord | <Avatarfighter> What is upppp everyone |
17:21:05 | * | def- quit (Quit: -) |
17:22:05 | FromDiscord | <Zachary Carter> drinking coffee and working on terrain painting |
17:22:20 | FromDiscord | <Avatarfighter> That's exciting |
17:22:24 | FromDiscord | <Zachary Carter> trying to get this example working on d3d11 and metal, but not sure where the problem is |
17:22:39 | FromDiscord | <Avatarfighter> what type of coffee? |
17:22:47 | FromDiscord | <Zachary Carter> Petes I think |
17:22:49 | FromDiscord | <Avatarfighter> also got an example of what you mean by terrain painting 😛 |
17:23:09 | FromDiscord | <Zachary Carter> https://imgur.com/bbj0fts |
17:23:17 | * | def- joined #nim |
17:23:32 | FromDiscord | <Avatarfighter> wow that is not what i thought you meant |
17:23:42 | FromDiscord | <Zachary Carter> You thought I meant like I was bob rossing it up? |
17:23:46 | FromDiscord | <Avatarfighter> I was expecting you to go full on bob ross |
17:23:47 | FromDiscord | <Avatarfighter> yeah |
17:23:55 | FromDiscord | <Zachary Carter> nah I'm not that talented |
17:24:09 | FromDiscord | <Avatarfighter> that is super cool though |
17:24:44 | FromDiscord | <Zachary Carter> the coolest part is the vertices and indices for the mesh are all calculated on the GPU |
17:24:54 | FromDiscord | <Zachary Carter> using tessellation in a compute shader |
17:25:08 | FromDiscord | <Avatarfighter> THATS SO COOL |
17:25:18 | FromDiscord | <Zachary Carter> via this algo -0 https://onrendering.com/data/papers/cbt/ConcurrentBinaryTrees.pdf |
17:25:24 | FromDiscord | <Zachary Carter> (edit) '-0' => '-' |
17:25:49 | FromDiscord | <Zachary Carter> so now the RTS game will have a map editor |
17:25:57 | FromDiscord | <Zachary Carter> the RTS game I've been promising 4raq for years now |
17:26:00 | FromDiscord | <Avatarfighter> ahah |
17:26:07 | FromDiscord | <Avatarfighter> What is the idea behind your game? |
17:29:03 | FromDiscord | <Zachary Carter> I don't really have much yet - my goal is to create a sandbox where I can play around with different ideas easily |
17:29:15 | FromDiscord | <Zachary Carter> but at the moment I know it's going to be a RTS and it's going to be science fiction themed |
17:29:41 | FromDiscord | <Avatarfighter> I'm excited for you this seems like it would be a lot of fun to play around with and make |
17:30:14 | FromDiscord | <Zachary Carter> I think the map editor is going to be the most enjoyable part haha |
17:34:07 | FromDiscord | <Zachary Carter> the cool thing is now I can deform the terrain at runtime if I want - so making craters etc from explosions should be possible |
17:34:27 | FromDiscord | <Avatarfighter> you don't even know how cool this is to me |
17:34:43 | FromDiscord | <Avatarfighter> im really excited for you |
17:35:01 | FromDiscord | <Zachary Carter> well it will be cooler when it's not just a stupid example and is actually playable - but that's a ways off |
17:35:21 | FromDiscord | <Zachary Carter> I was almost at this point last year - but couldn't quite get the terrain painting working |
17:35:58 | FromDiscord | <Zachary Carter> now that I have that I've kind of unblocked myself from progressing further than I was last year - so next up is to getting some animated units moving around the map |
17:36:12 | * | supakeen suggests: a tank |
17:36:55 | FromDiscord | <Zachary Carter> not a bad idea |
17:37:01 | FromDiscord | <Avatarfighter> a plane could be fun |
17:37:22 | FromDiscord | <Avatarfighter> mattering on if you have a fog of war feature for your RTS you could have little planes flying around lol |
17:37:24 | FromDiscord | <Zachary Carter> I need a 3d artist |
17:38:58 | * | hnOsmium0001 joined #nim |
17:41:06 | FromDiscord | <Avatarfighter> i mean |
17:41:16 | FromDiscord | <Avatarfighter> a rectangle looks like a vehicle |
17:41:22 | FromDiscord | <Avatarfighter> or a triangle |
17:41:43 | FromDiscord | <Zachary Carter> yeah - I just mean long term |
17:41:52 | FromDiscord | <Zachary Carter> I can prototype with primitives for sure |
17:42:21 | FromDiscord | <Avatarfighter> psh |
17:42:26 | FromDiscord | <Avatarfighter> make the game a geometry rts |
17:42:42 | FromDiscord | <Avatarfighter> no need for fancy animations when the rectangles shoot smaller rectangles at each other 😛 |
17:42:53 | FromDiscord | <Avatarfighter> ahah |
17:43:03 | supakeen | A tank is just 3 rectangles |
17:48:44 | * | oculux joined #nim |
17:49:00 | * | oculuxe quit (Ping timeout: 256 seconds) |
17:56:51 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
17:57:31 | Oddmonger | could be the beginning of a folk song |
17:59:59 | FromDiscord | <ache of head> "A tank is just 3 rectangles"? |
18:01:21 | FromDiscord | <Vindaar> yeah, didn't you know? an aircraft carrier is about ~100 rectangles and a couple of cylinders though. Please keep that in mind, gonna be on the test |
18:01:22 | FromDiscord | <Rika> you can represent a tank with 3 rectangles |
18:01:52 | FromDiscord | <Rika> (i assume they actually mean boxes though) |
18:02:13 | FromDiscord | <vmcrash> I'm new to Nim. It looks very promising, but the most thing which restrains me from becoming productive is a good IDE with code completion, debugger and refactoring. Did I miss an essential tool? After >17 years of experience with IntelliJ IDEA I don't want to go back into stone age of development without (graphic) debugger or refactoring. |
18:02:14 | FromDiscord | <iWonderAboutTuatara> is there a way to import the entire stdlib? |
18:02:31 | FromDiscord | <iWonderAboutTuatara> the whole thing |
18:03:06 | FromDiscord | <Rika> code completion is here, nimsuggest + plugin |
18:03:17 | FromDiscord | <Rika> debugger, you can prolly just use gdb |
18:03:25 | FromDiscord | <Rika> (other than that i do not know) |
18:03:32 | FromDiscord | <Vindaar> @iWonderAboutTuatara why would you ever want that? |
18:03:33 | FromDiscord | <Rika> refactoring is nonexistent from what i know |
18:04:20 | FromDiscord | <Rika> refactoring is really complex, most new languages do not have good refactoring support, please keep that in mind |
18:04:49 | FromDiscord | <Rika> afaik yardanico made something with regards to graphic debugging |
18:05:13 | FromDiscord | <NickSeagull> Is there a way to compile a Nim library to a DLL and then dynamic link from a Nim executable? |
18:05:30 | disruptek | sure. |
18:05:33 | FromDiscord | <haxscramper> @vmcrash this one is kind of new, but you might want to try this out - https://plugins.jetbrains.com/plugin/15128-nim , also support in vscode is really good. Or you can try qt creator - it comes with nim plugin built-in. |
18:05:53 | disruptek | !repo nim.nvim |
18:05:54 | disbot | https://github.com/alaviss/nim.nvim -- 9nim.nvim: 11Nim plugin for NeoVim 15 100⭐ 13🍴 7& 3 more... |
18:06:32 | FromDiscord | <NickSeagull> disruptek: Not sure if that 'sure' was for me, in that case, can I get a link or something? |
18:06:40 | FromDiscord | <NickSeagull> (Please 🙂 ) |
18:06:59 | disruptek | nim --fullhelp and note --app:lib |
18:07:26 | FromDiscord | <haxscramper> https://nim-lang.org/docs/nimc.html#dll-generation |
18:07:41 | disruptek | ~dll is https://nim-lang.org/docs/nimc.html#dll-generation |
18:07:42 | disbot | dll: 11https://nim-lang.org/docs/nimc.html#dll-generation |
18:07:58 | disruptek | haxscramper: ty |
18:08:03 | FromDiscord | <Recruit_main707> only disruptek knows the commands :P |
18:08:10 | FromDiscord | <Recruit_main707> ~help ? |
18:08:26 | disruptek | there's no way for the bot to send you help on discord because yard is too lazy. |
18:09:23 | disruptek | ~help |
18:13:13 | FromDiscord | <NickSeagull> Thanks a lot disruptek, those pointers are indeed very useful 🙂 |
18:13:19 | FromDiscord | <NickSeagull> And @haxscramper |
18:14:01 | FromDiscord | <haxscramper> Also if you need to load nim dll in nim you might want to look at https://github.com/genotrance/plugins o |
18:14:14 | FromDiscord | <haxscramper> Or HCR |
18:14:31 | disruptek | stay away from hcr, imo; it's ripe for reimpl or breakage. |
18:14:55 | FromDiscord | <haxscramper> Okay, no for HCR |
18:16:15 | FromDiscord | <Avatarfighter> the plugin lib is a bit iffy with arc |
18:16:58 | Zevv | my daily shit: http://zevv.nl/div/2020-10-04%2020-13-55.mp4 |
18:17:01 | Zevv | boy did I miss nim |
18:17:23 | FromDiscord | <Avatarfighter> i thought that was a video of you shitting |
18:17:30 | FromDiscord | <Avatarfighter> i wasn't happy for a second there |
18:18:32 | Zevv | not on #nim, not on #nim! |
18:18:58 | Zevv | I can now do >1M events and still responsive at 30fps |
18:19:38 | disruptek | starting to look like a good base for flamegraph. |
18:19:56 | Zevv | it's similar. Flamegraphs just consolidate the X axis |
18:19:58 | FromGitter | <deech> Is there a way of overriding C++ methods using multimethods with the cpp backend? They seem pretty close in concept. |
18:20:03 | FromDiscord | <haxscramper> To compile some code only on after some nim version I should do `NimMajor > 1 and NimMinor > 2 and NimMinor > 6` or there is a more elegant way for this chec? |
18:20:29 | disruptek | (NimMajor, NimMinor) > (1, 2) |
18:20:49 | FromDiscord | <haxscramper> deech: no, there isn't any. TO override C++ method you need to create derived class, which nim doesn't do for C++ backend AFAIK |
18:21:15 | FromDiscord | <iWonderAboutTuatara> @Vindaar Want to try doing competitive programming |
18:21:22 | FromDiscord | <iWonderAboutTuatara> importing is kind of a pain |
18:21:52 | FromDiscord | <iWonderAboutTuatara> also, another weird issue with a macro |
18:22:05 | FromDiscord | <iWonderAboutTuatara> I'm trying to take values from a seq and assign them to a bunch of vars |
18:22:34 | FromDiscord | <iWonderAboutTuatara> end syntax should be `(x, z) ..= @[1, 2]` |
18:22:45 | FromDiscord | <iWonderAboutTuatara> and it should work for seqs declared as vars/not explicitly written out |
18:22:53 | FromDiscord | <iWonderAboutTuatara> sent a code paste, see https://play.nim-lang.org/#ix=2zJj |
18:23:05 | FromDiscord | <iWonderAboutTuatara> is what I currently have, but it doesn't seem to be interpreting the s properly |
18:23:23 | FromDiscord | <iWonderAboutTuatara> getting an error about not being able to get a child of a sym node |
18:24:41 | FromDiscord | <Rika> you're iterating LHS, so 2 elements |
18:24:45 | FromDiscord | <Rika> RHS (a) only has 1 |
18:24:50 | FromDiscord | <haxscramper> `a` is `(Ident "s")` |
18:24:55 | FromDiscord | <Rika> aka what does a[1] mean? |
18:26:10 | FromDiscord | <haxscramper> you ned `nnkBracketExpr.newTree(a, newLit(i))` to get element at index from `a` |
18:26:47 | FromDiscord | <iWonderAboutTuatara> wait if a is an ident |
18:26:53 | FromDiscord | <iWonderAboutTuatara> sorry if s is an ident |
18:27:05 | FromDiscord | <iWonderAboutTuatara> how do I make it pick a seq |
18:29:04 | FromDiscord | <Zachary Carter> The reason IntelliJ has all these nice tools is because of the JVM - not IntelliJ |
18:29:18 | FromDiscord | <Zachary Carter> and if you want to keep using InteliJ - then just keep using the JVM |
18:29:24 | FromDiscord | <Zachary Carter> (edit) 'InteliJ' => 'IntelliJ' |
18:29:50 | FromDiscord | <Zachary Carter> it's like going to a C/C++ community and complaining about C/C++ debugging |
18:30:00 | * | nixfreak joined #nim |
18:30:31 | nixfreak | for some reason I can't remember how to put a space in a concatenation with two strings |
18:30:34 | FromDiscord | <haxscramper> > how do I make it pick a seq↵@iWonderAboutTuatara There is no "sequence" in macro - e.g. when `s` is passed it is just `(Ident "s")` that is /assumed/ to be related to sequence. |
18:30:53 | FromDiscord | <iWonderAboutTuatara> how do I work with it as a seq? |
18:30:57 | FromDiscord | <haxscramper> The best you can do is `s: seq`, but you will still get `NimNode`. |
18:31:10 | FromDiscord | <iWonderAboutTuatara> how would I get the items as an seq? |
18:31:14 | FromDiscord | <haxscramper> Generate code like `s[0]`, `s[1]` etc. |
18:31:19 | FromDiscord | <haxscramper> Using `nnkBracketExpr.newTree(a, newLit(i))` |
18:31:27 | Prestige | nixfreak: let foo = a & " " & b ? |
18:31:31 | FromDiscord | <iWonderAboutTuatara> what is a in this situation? |
18:32:11 | nixfreak | duh , thans |
18:32:14 | nixfreak | duh , thanks |
18:32:35 | FromDiscord | <Rika> the ident (`s`) |
18:32:41 | FromDiscord | <haxscramper> > what is a in this situation?↵@iWonderAboutTuatara Parameter in the macro. You have `(Ident "s")` in code and `a` variable in the macro parameters |
18:32:59 | Prestige | @iWonderAboutTuatara check out https://dev.to/beef331/demystification-of-macros-in-nim-13n8 |
18:33:05 | FromDiscord | <iWonderAboutTuatara> oh I see |
18:33:06 | FromDiscord | <haxscramper> And variable represents NimNode that you have in code (identifier `s`) |
18:33:17 | FromDiscord | <iWonderAboutTuatara> PRestige: I've already read most of that |
18:33:19 | FromDiscord | <Recruit_main707> someone reminds me the difference between idents and syms? |
18:33:29 | FromDiscord | <haxscramper> Sym is a type-resolved identifier? |
18:34:09 | FromDiscord | <iWonderAboutTuatara> wait how would I go about generating code like that? |
18:34:24 | FromDiscord | <iWonderAboutTuatara> I'd need the input to be the induvidual values and not the seq? |
18:34:52 | FromDiscord | <Recruit_main707> @iWonderAboutTuatara can you show me an example of what your macro should do? |
18:35:08 | FromDiscord | <haxscramper> https://play.nim-lang.org/#ix=2zJr |
18:35:55 | sschwarzer | Zachary: I think it's fine to ask for better tool support with Nim. Your answer re C/C++ sounds like, "Nim doesn't have better/more IDE support; it's an axiom and don't ask!" ;-) |
18:35:58 | FromDiscord | <haxscramper> difference between untyped `echo 1,2,3` and typed one |
18:36:11 | FromDiscord | <iWonderAboutTuatara> @Recruit_main707 `(n, e) ..= s` |
18:36:17 | FromDiscord | <iWonderAboutTuatara> thanks hax! will look at that |
18:36:30 | FromDiscord | <iWonderAboutTuatara> wait nevermind |
18:36:35 | * | Vladar quit (Quit: Leaving) |
18:36:41 | FromDiscord | <iWonderAboutTuatara> n & e are declared variables |
18:36:46 | FromDiscord | <iWonderAboutTuatara> s is a seq |
18:37:00 | FromDiscord | <Recruit_main707> and what gets assigned to what? |
18:37:14 | FromDiscord | <iWonderAboutTuatara> n = s[0], e = s[1], etc |
18:37:21 | FromDiscord | <Recruit_main707> i see |
18:38:24 | FromDiscord | <haxscramper> https://play.nim-lang.org/#ix=2zJs |
18:38:28 | FromDiscord | <haxscramper> @iWonderAboutTuatara ^ |
18:39:11 | FromDiscord | <haxscramper> When in doubt always do `dumpTree` on code you /want to generate/ and then write macro that transforms input into this |
18:39:53 | FromDiscord | <iWonderAboutTuatara> I did that, but I'm still confused on getting values from the seq |
18:40:24 | FromDiscord | <Recruit_main707> you dont really, you create code that accesses the desired indexes |
18:40:26 | FromDiscord | <Zachary Carter> sschwarzer: it's fine to ask, but again there's a reason why the only runtime with the refactoring tools that the JVM has, is the JVM |
18:40:34 | FromDiscord | <Zachary Carter> and I guess the CLR is catching up via resharper |
18:40:47 | FromDiscord | <Avatarfighter> i love jetbrains |
18:40:51 | FromDiscord | <Zachary Carter> if you don't want to debug C/C++ - maybe Nim isn't the right language for you |
18:40:56 | FromDiscord | <Vindaar> @iWonderAboutTuatara sorry was afk |
18:41:06 | FromDiscord | <Vindaar> this is what you want I assume: https://play.nim-lang.org/#ix=2zJt |
18:41:24 | FromDiscord | <Vindaar> doesn't perform any safety checks though 😛 |
18:41:26 | FromDiscord | <Recruit_main707> they already gave him an example |
18:41:28 | FromDiscord | <Rika> @Zachary Carter rather if you're not willing to accept that the ecosystem is still pretty young to have good tools or so |
18:41:44 | FromDiscord | <haxscramper> `` s/ s[`i`]/`s`[`i`] `` |
18:41:45 | FromDiscord | <iWonderAboutTuatara> oh you can do it with quote do? |
18:41:46 | FromDiscord | <Zachary Carter> we basically have what C/C++ devs have at their disposal |
18:42:00 | disruptek | jvm is a fundamentally different technology that affords different guarantees. |
18:42:06 | FromDiscord | <Zachary Carter> exactly |
18:42:09 | FromDiscord | <Vindaar> also regarding importing stuff: especially for competitive programming you wouldn't want to import the whole stdlib, that'd just slow down compilation |
18:42:10 | FromDiscord | <iWonderAboutTuatara> `quote do: s['i']` |
18:42:12 | FromDiscord | <iWonderAboutTuatara> except w/ backticks |
18:42:14 | FromDiscord | <Zachary Carter> we're dealing with C/C++ not Java |
18:42:30 | FromDiscord | <iWonderAboutTuatara> We do it in cpp, compile time is not a big worry |
18:42:37 | FromDiscord | <Vindaar> just define a helper module which imports the stdlib modules you might need and include that in your files |
18:42:38 | sschwarzer | Zachary: true, but because the situation is better for the JVM doesn't mean that it's unthinkable that Nim could have better tooling in future. :-) |
18:42:54 | FromDiscord | <Rika> keywords are "in the future" |
18:42:56 | FromDiscord | <iWonderAboutTuatara> I have a base file where I'm doing that |
18:42:59 | FromDiscord | <Zachary Carter> it's not unthinkable no - but my if C/C++ don't have them after n number of years of these languages existing |
18:43:12 | FromDiscord | <iWonderAboutTuatara> Oh it's not anything you'd use for normal code |
18:43:13 | FromDiscord | <iWonderAboutTuatara> like ever |
18:43:18 | FromDiscord | <Recruit_main707> its like syntactic sugar in this case, you are not getting the sequence values at compile time, you assign n and e to some information stored at some specific indexes of s (0 and 1 in this case) |
18:43:24 | sschwarzer | Rika: But for someone new to Nim and its ecosystem, the "future" may be now already ;-) |
18:43:40 | FromDiscord | <Rika> what do you mean |
18:43:51 | FromDiscord | <iWonderAboutTuatara> @Recruit_main707 so basically macro doesn't know or care what s is, it's just grabbing whatever is it index whenever it's called? |
18:45:07 | FromDiscord | <Recruit_main707> yesnt, you are the one that should care about that |
18:45:43 | FromDiscord | <Recruit_main707> it will error at compile time if the compiler sees something isnt right though |
18:45:43 | sschwarzer | Zachary: I like that Nim (to me) feels more high-level than C++, so IMHO it would totally make sense to have tooling "on the Nim level". "C-level" would only be needed when you're interfacing with C/C++ or are developing on the compiler and there's a problem with the code generation/execution. |
18:46:05 | FromDiscord | <haxscramper> You can do `` macro `..=`(lft : untyped, a : untyped) : untyped = `` to get type checking |
18:46:10 | FromDiscord | <Recruit_main707> but essentially, its what you said |
18:46:20 | FromDiscord | <haxscramper> `` macro `..=`(lft : untyped, a : seq) : untyped = `` |
18:46:25 | FromDiscord | <Zachary Carter> but we're compiling to C and C++ - so we're debugging C/C++ too at the end of the day |
18:46:50 | FromDiscord | <iWonderAboutTuatara> I see |
18:46:51 | FromDiscord | <iWonderAboutTuatara> thanks! |
18:46:53 | Araq | that's a problem, not a feature |
18:46:59 | FromDiscord | <haxscramper> Or to be more accurate `seq | tuple | object | ref object` if you want to unpack `(12, 3)` and objects with `` proc`[]` `` too |
18:47:05 | Araq | but at least we produce #line directives |
18:47:09 | sschwarzer | Rika: Someone new to the ecosytem can't necessarily know whether better tooling is in the future or if it already exists. |
18:47:14 | FromDiscord | <iWonderAboutTuatara> never heard of `[]` |
18:47:17 | disruptek | i don't see any reason why we cannot surpass c debugging. |
18:47:18 | FromDiscord | <iWonderAboutTuatara> as a proc |
18:47:28 | FromDiscord | <Rika> i dont either |
18:47:40 | FromDiscord | <haxscramper> > as a proc↵@iWonderAboutTuatara https://nim-lang.org/docs/macros.html#%5B%5D%2CNimNode%2Cint |
18:47:51 | FromDiscord | <Zachary Carter> someone just needs to write a debugger 🙂 |
18:47:52 | FromDiscord | <Rika> im just saying that expecting good refactoring for a language at this size/popularity is somewhat unreasonable |
18:47:58 | sschwarzer | Zachary: That's like saying the CPython VM is written in C, so debugging Python with gdb (including the VM) would be reasonable. |
18:47:58 | Araq | I use 'getStackTrace' extensively and it's not available in C |
18:48:02 | FromDiscord | <iWonderAboutTuatara> oh index access is a macro? |
18:48:02 | FromDiscord | <Rika> but thats my opinion |
18:48:08 | FromDiscord | <Recruit_main707> yeah, if someone eiteher write exportc everywhere or create a debugger that uses a c debbugger but can read nim stacktraces |
18:48:19 | FromDiscord | <Zachary Carter> there's a difference |
18:48:22 | FromDiscord | <Recruit_main707> i kinda had a stroke there |
18:48:47 | FromDiscord | <Zachary Carter> you're forgetting about the python interpreter |
18:48:56 | FromDiscord | <Zachary Carter> that's what's written in C |
18:49:06 | FromDiscord | <Recruit_main707> > oh index access is a macro?↵@iWonderAboutTuatara its a proc |
18:49:10 | FromDiscord | <haxscramper> > oh index access is a macro?↵@iWonderAboutTuatara No, just a aregular proc. You can overload operators https://nim-lang.org/docs/tut1.html#procedures-operators |
18:49:30 | FromDiscord | <Recruit_main707> when you do `echo(s[1])` |
18:49:38 | FromDiscord | <Recruit_main707> you are calling `[]` |
18:49:52 | Araq | just a minute ago I embedded getStackTrace in the produced C code as a comment to see where the produced C code comes from |
18:50:10 | FromDiscord | <iWonderAboutTuatara> @Recruit_main707 in your macro, what is `s`? |
18:50:13 | Araq | so in some cases we do surpass C++ already |
18:50:19 | FromDiscord | <iWonderAboutTuatara> side effect? |
18:50:30 | disruptek | you can run a lot of nim code in the vm if you simply rename the file from nim to nims. |
18:50:48 | Araq | btw, new record, 1:53 |
18:50:48 | disruptek | because araq likes to make us rename files. |
18:50:54 | sschwarzer | Zachary: I'm not sure I understand what you mean. What I meant is that Python programs (if executed with CPython) are processed by a C program, so you could (but IMHO shouldn't) debug your Python code by debugging the CPython interpreter and check what it's doing with your program. But of course you don't want to. |
18:50:55 | FromDiscord | <Recruit_main707> @iWonderAboutTuatara i didnt write any macro, i am talking about nim in general |
18:51:12 | FromDiscord | <iWonderAboutTuatara> no from earlier |
18:51:12 | sschwarzer | sorry, should go to Rika |
18:51:19 | FromDiscord | <iWonderAboutTuatara> https://play.nim-lang.org/#ix=2zJt |
18:51:20 | FromDiscord | <Vindaar> oh, did you mean me @iWonderAboutTuatara? That was a typo on my end haha |
18:51:24 | FromDiscord | <Zachary Carter> Nim is compiled to C though - Python programs aren't |
18:51:27 | FromDiscord | <Zachary Carter> they're compiled to bytecode |
18:51:28 | FromDiscord | <Vindaar> just turned out to work in this case |
18:51:29 | FromDiscord | <iWonderAboutTuatara> oh might have been you |
18:51:34 | sschwarzer | sorry, should indeed go to Zachary :-D |
18:51:39 | FromDiscord | <Vindaar> give me a sec |
18:51:41 | FromDiscord | <iWonderAboutTuatara> using a[`i`] gives illformed ast error |
18:51:41 | FromDiscord | <Rika> sschwarzer i think you misdirected |
18:51:44 | FromDiscord | <Recruit_main707> yep, it was him |
18:51:46 | FromDiscord | <Rika> yeah lol |
18:51:46 | Araq | Zachary Carter: true but not very interesting |
18:52:09 | FromDiscord | <Vindaar> @iWonderAboutTuatara https://play.nim-lang.org/#ix=2zJw |
18:52:10 | Araq | we used to have ENDB which added VM-like stuff to the produced C code |
18:52:14 | FromDiscord | <Recruit_main707> try with \`a` |
18:52:19 | FromDiscord | <Zachary Carter> I wasn't trying to be interesting - I was trying to explain why it's a different scenario |
18:52:27 | Araq | but I couldn't maintain it |
18:52:35 | Araq | and it was really slow too |
18:52:47 | FromDiscord | <Zachary Carter> you can already have visual debugging with nim and gdb / lldb using VSCode |
18:52:53 | FromDiscord | <Vindaar> ahh |
18:52:57 | FromDiscord | <Zachary Carter> or Qt's code editor |
18:53:15 | FromDiscord | <Vindaar> I keep messing up, because I'm too hasty. Ok, 1 min and I actually run the code I write. Sorry for the confusion |
18:53:33 | sschwarzer | Zachary: I know, but still I don't think it's unreasonable to think that somehow we could have debugging on the Nim level in the future. Nim has a certain semantics, so a debugger that looks at Nim on that level (independent of how the "semantics is executed") would make sense. |
18:53:57 | Araq | yes as I said, we had it, it was named ENDB |
18:54:09 | FromDiscord | <Vindaar> @iWonderAboutTuatara ok, here: https://play.nim-lang.org/#ix=2zJx |
18:54:11 | FromDiscord | <Recruit_main707> @iWonderAboutTuatara the \`XX` thing in macros and templates mean, dont write XX, but whatever XX is in your macro/template |
18:54:22 | sschwarzer | Araq: Sorry, I missed that. |
18:54:22 | Araq | am I muted to what... |
18:59:52 | sschwarzer | Araq: You said it was slow. What was the factor between "normal" Nim speed and execution under ENDB? |
19:03:43 | nixfreak | how do you just get yyyy-mm-dd for getTime()? |
19:06:04 | sschwarzer | nixfreak: Might make sense to use `now`, which you can format with `DateTime.format`. |
19:06:24 | sschwarzer | https://nim-lang.org/docs/times.html#parsing-and-formatting-dates |
19:06:31 | Araq | sschwarzer, factor of 10 but you pay roughly the same price with --stackTrace:on |
19:06:52 | Araq | ENDB extended our stack traces with info about local variables etc |
19:07:15 | sschwarzer | Araq: For me a factor 10 wouldn't be bad if it's for debugging only. |
19:07:41 | sschwarzer | Of course there _could_ be situations where it's too slow. |
19:07:42 | Araq | true it was acceptable |
19:07:46 | Araq | however |
19:08:38 | Araq | it wasn't clear how to make it support multi-threading and it's changes the stack contents so much that you likely cannot debug a random crash with it |
19:09:10 | Araq | "my program crashes, let me fire up ENDB, great now it crashes somewhere else or not at all" |
19:09:22 | sschwarzer | nixfreak: It looks like there's also `format` for `Time` objects |
19:09:41 | sschwarzer | Araq: I see |
19:10:41 | Araq | better patch the .elf debug sections for GDB |
19:11:02 | Araq | a much more fruitful approach |
19:11:08 | sschwarzer | What are the plans for the next Nim versions? I guess 1.4 will focus on arc/orc robustness? |
19:12:00 | Araq | yes, we also have "strict funcs" and view types though |
19:13:46 | sschwarzer | Araq: right, strict funcs are nice! :-) I've used them for a while, but had forgotten they're there. Probably because I had some time where I wasn't working with Nim. Also I had some problems, but if I remember correctly, these are all fixed now. |
19:14:00 | Araq | ugh, why am I so bad? 11th out 11 |
19:14:04 | Araq | *out of |
19:14:21 | sschwarzer | "11 out of 11"? What do you mean? |
19:14:34 | Araq | https://my.raceresult.com/144393/results?lang=de#4_D5BA5B |
19:15:51 | Prestige | lol I changed the language to English, but it's still in German |
19:16:09 | Araq | look at the section M35 |
19:17:06 | sschwarzer | Prestige: You can search for "Rumpf, Andreas" |
19:17:26 | Prestige | I found his name, I just don't know that the site is about |
19:17:35 | Araq | alternatively I'm 83th out of 108 |
19:17:42 | sschwarzer | Prestige: running |
19:17:49 | sschwarzer | (physically :) ) |
19:17:53 | Prestige | ah :P |
19:18:18 | FromDiscord | <Rika> as in marathon? |
19:18:20 | FromDiscord | <Rika> thats fine |
19:18:35 | Araq | half-marathon... |
19:18:54 | FromDiscord | <Rika> god damn half marathon??? i dont think i can do that |
19:18:55 | sschwarzer | What are you thinking about for Nim 1.6? |
19:19:05 | Araq | IC |
19:19:15 | sschwarzer | Rika: I never tried, and wouldn't. ;-) |
19:20:22 | nixfreak | DateTime.format.now()? |
19:20:43 | * | abm joined #nim |
19:20:46 | sschwarzer | Araq: What's "IC"? |
19:20:58 | Araq | incremental compilation |
19:21:25 | sschwarzer | nixfreak: `import times`, then `now().format("<your_format_string>")` |
19:22:01 | sschwarzer | Araq: ic (I see) :) |
19:22:12 | nixfreak | ok thanks |
19:22:55 | sschwarzer | It's in the `times` module documentation, https://nim-lang.org/docs/times.html |
19:28:55 | sschwarzer | @all: What other programming languages do you like developing with, and why? |
19:30:03 | * | NimBot joined #nim |
19:34:15 | Araq | how is that gonna produce an interesting result in #nim ? |
19:34:37 | Araq | and what does it matter, should we make Nim more like JS when many JS devs raise their hand? |
19:34:49 | Araq | anyhow, good night |
19:35:02 | FromDiscord | <Rika> i think theyre just asking a question |
19:37:36 | sschwarzer | Rika: exactly, I'm just curious |
19:37:58 | voidpi | sschwarzer: just nim & python for me |
19:38:38 | sschwarzer | Araq: I don't see why it should _not_ produce an interesting result. I guess most Nim devs are experienced devs and use more than one programming language. |
19:39:01 | * | thomasross joined #nim |
19:39:21 | sschwarzer | Araq: And for me, it's not about making Nim more similar to other languages (actually, I didn't even think of that). :) |
19:40:15 | nixfreak | if I'm subtracting dates I have to convert from string to int right |
19:40:58 | sschwarzer | voidpi: I'm using Python a lot (my "main" language since many years). I found Nim about a year ago and really like it. At the same time, I'm curious about other languages, especially for functional programming. But I'm kind of overwhelmed because there are so many options. *sigh* |
19:41:29 | sschwarzer | nixfreak: Did you look at the module documentation I mentioned? :) |
19:44:25 | sschwarzer | nxifreak: There doesn't seem to be a `Date` type, so I guess, you'd create two `DateTime` objects (maybe with the time set to 00:00 for clarity) and subtract them. |
19:45:50 | nixfreak | ok , yeah I looked over them , There is a lot to unpack in the documentation |
19:46:18 | sschwarzer | nixfreak: true, it has always happened to me that I just missed something which was actually there :) |
19:46:32 | sschwarzer | sorry, not "always", but "sometimes" :) |
19:47:14 | sschwarzer | (maybe I wanted to write "actually", idk) |
19:50:43 | sschwarzer | nixfreak: https://play.nim-lang.org/#ix=2zJO (don't try to execute this directly as Nim code though :-) ) |
19:51:07 | sschwarzer | So `parse` does the conversion (to `DateTime`) for you |
19:54:55 | * | sschwarzer quit (Quit: leaving) |
19:57:19 | nixfreak | oh ok , so you have to turn it into a DateTime object first then parse it |
19:57:52 | nixfreak | I tried doing this let bdate = initDateTime(04, mApr, 1980, 0, 0, 0) |
19:57:52 | nixfreak | let dateNow = getTime() |
19:57:52 | nixfreak | echo(dateNow) |
19:57:52 | nixfreak | echo(bdate) |
19:57:52 | nixfreak | echo("Your age in days is ", bdate - dateNow) |
20:16:48 | * | jjido joined #nim |
20:30:34 | * | aenesidemus joined #nim |
20:41:37 | * | narimiran quit (Ping timeout: 264 seconds) |
20:41:56 | nixfreak | can you just put any amount of years in a DateTime object |
20:42:00 | nixfreak | say 40 years |
20:49:03 | * | abm quit (Quit: Leaving) |
20:52:33 | FromDiscord | <ache of head> what's the check for macos in `defined()`? just `defined(macOS)`? |
20:52:39 | FromDiscord | <ache of head> or is the identifier different? |
20:53:00 | disruptek | macosx |
20:53:09 | FromDiscord | <ache of head> thanks! |
20:54:10 | disruptek | i guess there's a macos define, too, but most likely you're looking for macosx. |
21:03:50 | FromDiscord | <Rossiya> what the |
21:11:44 | FromDiscord | <Vindaar> ok, this might make me look a bit uninformed, but I always thought it was my fault I couldn't figure out a non hacky way to turn something synchronous into something async: https://forum.nim-lang.org/t/6889 ↵TIL I guess |
21:12:26 | * | solitudesf quit (Ping timeout: 256 seconds) |
21:12:55 | disruptek | you need something like cps. |
21:13:01 | FromDiscord | <Vindaar> I was always like "duh, if I have something that is implemened returning futures and stuff of course I can handle using async etc. But what to do when I _don't_". I guess then I don't do anything and keep using threads 🤣 |
21:13:21 | FromDiscord | <Vindaar> disruptek so _that's_ what cps would actually solve? |
21:13:30 | disruptek | that's one example, yes. |
21:13:40 | disruptek | cps gives you two ways to solve it: |
21:13:51 | disruptek | move the continuation to a thread and run blocking code in that thread, or |
21:13:52 | FromDiscord | <Vindaar> ok, now suddenly I can understand your cps hype, haha |
21:14:17 | disruptek | put the continuation into an event queue and use select() or similar to poll for completion. |
21:14:39 | FromDiscord | <Vindaar> that's pretty neat. I always did the former manually when required |
21:14:54 | * | abm joined #nim |
21:15:14 | FromDiscord | <Vindaar> guess with that knowledge I'm gonna take a look at that repo again. Thanks! |
21:15:25 | disruptek | yeah, what it does isn't all that exotic. |
21:16:00 | disruptek | it's just, y'know, it rewrites your simple procedural code to this slightly more sophisticated abstraction. |
21:17:45 | FromDiscord | <Vindaar> I love it when things all of a sudden click into place, heh |
21:17:59 | disruptek | you get it. 😉 |
21:18:09 | disruptek | it's a big fucking deal if we can make it smooth. |
21:19:22 | FromDiscord | <Elegant Beef> Then there is me using Async code so little, i just have the monkey with symbols in my head |
21:19:39 | disruptek | btw, i think 0.0.13 works but isn't all that slick. the typed branch doesn't work yet but gives a preview of how it could... |
21:20:06 | disruptek | monkey with symbols? |
21:20:14 | FromDiscord | <Vindaar> thanks, will keep that in mind! |
21:20:28 | FromDiscord | <Elegant Beef> https://media.discordapp.net/attachments/371759389889003532/762423914386292736/iu.png |
21:20:43 | FromDiscord | <Elegant Beef> Shit that's just the still frame https://media2.giphy.com/media/9jCK8MGZRBOSs/giphy.gif |
21:20:45 | * | Trustable quit (Remote host closed the connection) |
21:21:10 | FromDiscord | <Elegant Beef> Guess it's cymbal and i'm daft |
21:21:40 | disruptek | ah, cymbals. |
21:21:57 | disruptek | that makes way more sense. |
21:22:17 | FromDiscord | <Elegant Beef> Hey i'm not the dumbass that made homophones |
21:22:32 | FromDiscord | <Vindaar> ok, gonna be back later! |
21:22:49 | disruptek | #proudboy |
21:47:55 | FromDiscord | <iWonderAboutTuatara> is it idiom to use `s.map(x => parseInt x)` or to use `s.mapIt(parseInt it)`? |
21:50:05 | * | rockcavera joined #nim |
21:54:13 | * | nature quit (Ping timeout: 264 seconds) |
22:05:13 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:05:43 | * | Ikuyu joined #nim |
22:06:45 | FromDiscord | <Elegant Beef> I dont think either are wise since that assumes all strings are parsable |
22:08:02 | FromDiscord | <Elegant Beef> Good ol' runtime error https://play.nim-lang.org/#ix=2zKu |
22:09:09 | FromDiscord | <juan_carlos> parseSaturatedNatural |
22:10:06 | * | Ikuyu quit (Quit: Textual IRC Client: www.textualapp.com) |
22:16:02 | FromDiscord | <Elegant Beef> Would be nice if there was a `tryParse` which returned an optional of the type attempting to parse |
22:16:24 | disruptek | use a template. |
22:17:41 | FromDiscord | <Elegant Beef> no its "rtfm div operator" |
22:19:22 | * | casaca quit (Remote host closed the connection) |
22:25:18 | FromDiscord | <Elegant Beef> Wonders if i could squeeze this into the strutils stdlib 😄 https://play.nim-lang.org/#ix=2zKy |
22:26:14 | disruptek | obviously, it should be two procs. |
22:26:17 | disruptek | one overload. |
22:31:06 | FromDiscord | <Elegant Beef> You're saying it should be `tryParse[T: SomeInteger]` and `tryParse[T: SomeFloat]`, cause that apparently "leads to ambiguous calls" ? 😄 |
22:31:10 | * | aenesidemus quit (Quit: Leaving) |
22:31:11 | * | aenesidemus_ quit (Quit: Leaving) |
22:31:33 | disruptek | it's not ambiguous if you provide the type. |
22:32:33 | disruptek | i say that because it's cleaner. |
22:32:45 | FromDiscord | <Elegant Beef> I'm uncertain what you mea |
22:32:49 | FromDiscord | <Elegant Beef> (edit) 'mea' => 'mean' |
22:33:19 | disruptek | as you say, T: SomeInteger, T: SomeFloat, T: enum, T: bool, etc. |
22:33:33 | disruptek | multiple procs. |
22:33:58 | disruptek | this is another way to do it: |
22:34:01 | disruptek | !repo jsonconvert |
22:34:01 | disbot | https://github.com/disruptek/jsonconvert -- 9jsonconvert: 11lazy json node conversion 15 2⭐ 0🍴 |
22:45:38 | * | casaca joined #nim |
22:52:19 | FromDiscord | <Elegant Beef> I've looked at what you showed, and all i've grasped is i can do it better, final offer https://play.nim-lang.org/#ix=2zKE |
22:54:40 | * | arecacea1 quit (Remote host closed the connection) |
22:54:57 | disruptek | eh.. it's too hard to override with a typedesc. |
22:55:01 | disruptek | the generics method is easier. |
22:55:08 | * | arecacea1 joined #nim |
22:55:22 | disruptek | but, jsonconvert is bad style. that's why it says "don't use this" |
22:55:40 | FromDiscord | <Elegant Beef> Doesnt a generic remove the abillity to use ufcs? |
22:55:45 | disruptek | i still think it's best suited to a template. |
22:55:58 | disruptek | who cares about ufcs? |
22:56:06 | FromDiscord | <Elegant Beef> Moi |
22:56:06 | disruptek | syntax isn't as important as semantics. |
22:56:34 | disruptek | when some knucklehead comes along and wants to extend this, it's harder than it should be. |
22:58:13 | disruptek | i think you have 1-2 templates of 2-3 lines each and then the user can add new types with one line. |
23:02:57 | disruptek | i think if my name was flegma, i'd change it. |
23:08:50 | * | Jesin quit (Quit: Leaving) |
23:09:31 | * | ^Q-Master^ quit (Ping timeout: 246 seconds) |
23:21:41 | disruptek | no offense. |
23:22:14 | * | Jesin joined #nim |
23:38:35 | * | abm quit (Read error: Connection reset by peer) |