<< 10-08-2021 >>

00:12:42*madprops joined #nim
00:12:44FromDiscord<slymilano> Hey gang, I have my Nim project as #1 on hackernews' "Show HN"!
00:13:25FromDiscord<Elegantbeef> Congrats!
00:14:12madpropsseems I visited the torrentinim repo in mid 2020 huh
00:14:31madpropsi was wondering because the link had the "visited" tone
00:15:58FromDiscord<slymilano> yeah been plugging away at it every so often over the last year
01:04:23FromDiscord<undersquire> what gui libraries do you guys recommend? (preferably pure nim gui libraries, I have only found NiGui so far)
01:05:00*auxym joined #nim
01:06:10FromDiscord<undersquire> (edit) "(preferably" => "(trying to find"
01:22:51FromDiscord<codic> wow that is cool
01:25:08*Mister_Magister quit (Quit: bye)
01:25:20*Mister_Magister joined #nim
01:30:48FromDiscord<Elegantbeef> Nimx, Fidget, are probably the most developed pure Nim GUI libraries
01:35:31FromDiscord<womble73> I am playing with wxnim at the moment but only because I wanted WebKit as well as other native GUI things. It has been a small battle. Depends on how pure you want, it wraps header files but you need to install wxwidgets and it doesn't play nice with all the latest. But none of the other lib's matched my needs.
01:41:34federico3_I use gintro
01:51:29*auxym quit (Ping timeout: 248 seconds)
01:59:52*byanka_ quit (Ping timeout: 258 seconds)
02:01:42*flynn quit (Read error: Connection reset by peer)
02:02:49*flynn joined #nim
02:05:30*federico3_ is now known as federico3
02:30:57*arkurious quit (Quit: Leaving)
03:14:36*rockcavera quit (Remote host closed the connection)
03:26:41FromDiscord<undersquire> where can I learn macros in Nim more, the official docs don't really explain much
03:26:51FromDiscord<undersquire> (edit) "where can I learn ... macrosNim," added "more about" | "Nim more," => "Nim,"
03:28:48FromDiscord<Elegantbeef> I have this https://dev.to/beef331/demystification-of-macros-in-nim-13n8 but there are many macro explanations on the internet
03:29:47FromDiscord<Elegantbeef> https://peterme.net/metaprogramming-and-read-and-maintainability-in-nim.html
03:30:03FromDiscord<codic> wait that expandIf macro in your post might be useul
03:30:04FromDiscord<codic> (edit) "useul" => "useful"
03:30:53FromDiscord<Elegantbeef> Well it was inspired by someone asking how to make it
03:31:01FromDiscord<Elegantbeef> So someone atleast needed it
03:31:06FromDiscord<Elegantbeef> Rather wanted it
03:32:31FromDiscord<undersquire> thanks i will read those
03:32:44FromDiscord<Elegantbeef> If you have any more questions i can probably answer them
03:47:44FromDiscord<lamersc.com 🐧> I've never used SDL2 before, but am curious if the nim library is up to date?
03:47:52FromDiscord<lamersc.com 🐧> I'm planning on taking a shot at it
03:47:59FromDiscord<lamersc.com 🐧> and maybe making a simple platformer
03:49:03FromDiscord<Elegantbeef> Yea it's up to date afaik
03:49:25FromDiscord<Elegantbeef> Using it presently atleast
04:06:01*supakeen quit (Quit: WeeChat 3.2)
04:06:30*supakeen joined #nim
04:21:17FromDiscord<undersquire> In reply to @lamersc.com 🐧 "I've never used SDL2": use sdl2_nim library, not sdl2
04:21:34FromDiscord<undersquire> the official nim sdl2 bindings are not as up to date as sdl2_nim
04:57:01FromDiscord<lamersc.com 🐧> In reply to @undersquire "use sdl2_nim library, not": Thank you, I'll check it out
06:51:41*Vladar joined #nim
06:53:13FromDiscord<enthus1ast> i'm curious, is it still true that sdl2 cannot use shaders?
06:53:14FromDiscord<enthus1ast> (withouth additional opengl context i mean)
06:53:14FromDiscord<Elegantbeef> Yes it's
06:53:15FromDiscord<enthus1ast> for ours games (in c++) we have used SFML, if i recall correctly it only supported gles2 but that was good enough, and compatible for old devices.
06:53:15FromDiscord<Elegantbeef> Yea i mean opengl + sdl2 is relatively simple
06:57:39*max22- joined #nim
07:09:40*PMunch joined #nim
07:38:58*Pyautogui joined #nim
07:43:26PyautoguiNewbie question again, sorry: https://play.nim-lang.org/#ix=3vwI. It is giving a odd error, which does not really make sense to me.
07:46:07FromDiscord<Elegantbeef> You're using `VM` so accessing the type description
07:46:49PyautoguiOh, sorry. Stupid of me.
07:47:10PMunchDamn it, beat me to it
07:47:57PMunchFixing that you also use Code as the name of a field in the Chunk object, while in your code you refer to it as code
07:48:08supakeen(in multiple places)
07:48:29PMunchNim is only case-insensitive for all letters but the first
07:49:33PyautoguiSorry. Late at night for me.
07:51:51PMunchThis compiles, but I've made some assumptions that might not be right for you: https://play.nim-lang.org/#ix=3vwJ
07:52:10PyautoguiThanks. I have actually already fixed.
07:52:50FromDiscord<Elegantbeef> What's the point of saying `uint16(1)` on that enum
07:53:14FromDiscord<Elegantbeef> enums are best sized, and use whatever you tell them for all the numbers so you can just do `Op_ret = 1`
07:53:36PMunchYeah I don't think that would actually do much, if anything at all
07:54:04FromDiscord<Elegantbeef> It doesnt do anything afaik
07:54:33FromDiscord<Elegantbeef> yea the `ord` is a int
07:54:34PyautoguiI was trying to follow crafting interpreters. I am not very knowledgable about Nim's enums. Thank you, I will fix it.
07:55:53PMunchIf for some reason you really need it to be two bytes large for some reason there is a way to force it, but not sure if you can force the data-type to be uint at the same time
07:56:00PMunchYou probably don't need that though
07:56:22PyautoguiNo, thank you for the suggestion though.
07:56:27FromDiscord<Elegantbeef> There probably isnt much reason to give a first value to be fair
07:57:26FromDiscord<Elegantbeef> Since it's doubtful the value is really important
07:57:50PyautoguiNo, it is not. I have changed the code not to use the value.
07:58:02Pyautogui(and not define it)
07:58:37FromDiscord<Elegantbeef> is that constants supposed to be the size of TokenType?
07:58:59FromDiscord<Elegantbeef> If so you can do `array[TokenType, uin16]`
07:59:12FromDiscord<Elegantbeef> Then index it with the enum value
07:59:24PMunchOh, good idea
07:59:46FromDiscord<Elegantbeef> Thanks i'm allowed one of them every 2.5months
07:59:49FromDiscord<Elegantbeef> So see you again then
07:59:58PyautoguiNo need. Thanks for the suggestion
08:02:37PMunchWhat do you mean "no need"? If the constants are intended to be indexed by TokenType then setting it as an array with that as the index is a neat little trick
08:03:23PyautoguiI meant that that was not the purpose of TokenType
08:03:43PyautoguiSorry for the ambigous phrasing
08:04:21PMunchAh right, with the snippet you sent is was hard to tell as that's the only time you use it
08:13:13FromDiscord<tbrekalo> Hello, new to nim; I am coming from a cpp background. Interested is there something something like std::vector::reserve in nim sequence?
08:14:10FromDiscord<tbrekalo> (edit) "sequence?" => "sequence?↵↵Also, is there something with auto& like functionality?"
08:14:12FromDiscord<pointystick> newSeqOfCap, I think
08:14:25FromDiscord<tbrekalo> In reply to @pointystick "newSeqOfCap, I think": Thanks 👌
08:14:43FromDiscord<enthus1ast> https://nim-lang.org/docs/system.html#newSeq%2Cseq%5BT%5D%2CNatural
08:14:52*Pyautogui quit (Quit: Connection closed)
08:15:00FromDiscord<Elegantbeef> There are a multitude of newSeq procs which may help you
08:15:04FromDiscord<Elegantbeef> no clue what auto& does
08:15:27FromDiscord<enthus1ast> there is an auto type in nim
08:15:45FromDiscord<enthus1ast> i think it should behave similar
08:15:56FromDiscord<Elegantbeef> It does
08:16:04FromDiscord<Elegantbeef> But the `auto&` is what a auto reference?
08:17:14FromDiscord<tbrekalo> In reply to @Elegantbeef "But the `auto&` is": Yes
08:18:21FromDiscord<tbrekalo> Takes a reference to an object.. Let's say I want to access a last element in a sequence repeatedly and instead of typing `s[^1]`, I would like to access it via reference.. something like `auto& curr_elem = s[^1]`. That way I can modify the `s[^1]` through `curr_elem`
08:19:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3vwR
08:19:42FromDiscord<tbrekalo> In reply to @Elegantbeef "Ah there is `byaddr`": Thanks 👍🏿
08:19:45PMunchAssuming that the type in the sequence is not already a reference type of course
08:20:07PMunchThen you will just get the reference and can modify it as a reference directly
08:20:28FromDiscord<tbrekalo> Thanks guys 🙂
08:20:33FromDiscord<Elegantbeef> No problem
08:21:09PMunchIn this case you could of course also create a template
08:21:28PMunchIf you just want to save yourself having to type [^1] which can be awkward on some layouts
08:21:44PMunch`template curr_elem = s[^1]`
08:22:13FromDiscord<Elegantbeef> Nope pmunch you left out the return type
08:22:18FromDiscord<Elegantbeef> That's an error!
08:23:10FromDiscord<Elegantbeef> `template currElem: auto = s[^1]` for this hypothetical collectio
08:23:10FromDiscord<Elegantbeef> `template currElem: auto = s[^1]` for this hypothetical collection
08:23:30FromDiscord<tbrekalo> What I am actually trying is to compress https://en.wikipedia.org/wiki/FASTA_format so that each DNA base is encoded as two bits and nim's bit operations are kinda.. Uhhh
08:24:07FromDiscord<Elegantbeef> Nim's bit ops are awesome \:P
08:24:48PMunchOh shit, you're right Elegant
08:24:57FromDiscord<enthus1ast> https://nim-lang.org/docs/bitops.html
08:25:54FromDiscord<tbrekalo> In reply to @enthus1ast "https://nim-lang.org/docs/bitops.html": Yes, using that and I find it clunky 😦
08:26:21PMunchHuh, how have I not seen the bitops module until now?
08:26:29PMunchI always do my bit operations by hand..
08:26:42FromDiscord<Elegantbeef> peasant
08:27:04PMunchIt's not much, but it's honest work :P
08:27:05*Pyautogui joined #nim
08:27:06FromDiscord<Elegantbeef> Why do you even need bit ops?
08:27:15FromDiscord<tbrekalo> In reply to @Elegantbeef "Why do you even": Asking me?
08:27:19FromDiscord<Elegantbeef> Yea
08:27:29FromDiscord<tbrekalo> In reply to @Elegantbeef "Yea": give me a moment
08:29:12FromDiscord<tbrekalo> In reply to @Elegantbeef "Why do you even": To achieve this: https://github.com/rvaser/biosoup/blob/62b942c921c5a42f92020b283884a3f6afeb7e9d/include/biosoup/nucleic_acid.hpp#L61
08:29:56FromDiscord<Elegantbeef> So each letter is turned into how many bits in your desired output?
08:31:26FromDiscord<tbrekalo> 2 bits
08:31:40FromDiscord<enthus1ast> @tbrekalo\: we also have a nim science channel by the way
08:31:58FromDiscord<tbrekalo> In reply to @enthus1ast "<@783283008567640125>\: we also have": Should I go there or this is the place?
08:32:19FromDiscord<enthus1ast> no just mentioning, in case you don't know \:)
08:36:42FromDiscord<proud linux user> why balck imjoi
08:37:57PMunchProbably more people here, so for general Nim help this would be the place to be
08:38:09PMunch@proud linux user, why not?
08:39:02FromDiscord<Rika> What did he say?
08:40:06FromDiscord<enthus1ast> @tbrekalo\: maybe something like this could help\: https://github.com/sealmove/bitstreams
08:40:08nrds<prestigebot99> itHub: 7"Interface for reading per bits"
08:40:23FromDiscord<enthus1ast> then you can just write out the bits for each basepair
08:40:51FromDiscord<Elegantbeef> I'm pretty dumb cause there is way more than 4 choices \:D
08:41:38FromDiscord<tbrekalo> Thanks; will look into that. I am also struggling with generics a bit.. `decltype(vec_obj)::value_type` Looking for that sort of functionality in nim
08:42:27FromDiscord<Rika> For a sequence or an array
08:42:43FromDiscord<tbrekalo> why not both? 😆 ↵sequence in this case
08:43:13FromDiscord<Elegantbeef> Well i had fun compressing it without using any manual bitops got \~37 if my logic isnt wrong https://play.nim-lang.org/#ix=3vx5
08:43:46FromDiscord<Rika> theSeq.T should work?
08:44:04FromDiscord<Elegantbeef> `theSeq.type.T` maybe
08:44:19FromDiscord<Rika> Better to use typeof
08:44:30FromDiscord<Elegantbeef> You're not my real mom!
08:44:42FromDiscord<tbrekalo> Thanks guys; I have a lot of to digest now
08:44:44FromDiscord<Rika> Call me mommy
08:44:46PMunchSo basically you want to compress stuff like GATTACA to a sequence of bits, two per letter?
08:45:02PMunchBecause there are only four options two bits can hold them just fine
08:45:13FromDiscord<tbrekalo> Yes
08:45:24PMunchInteresting
08:45:25FromDiscord<Elegantbeef> And a slight modification of my code will give that
08:46:14FromDiscord<tbrekalo> Thanks; I'll probably request a code review later today or tomorrow
08:46:35FromDiscord<Elegantbeef> I'm actually pretty surprised that my compression worked so simply
08:47:00FromDiscord<Elegantbeef> I expected it to have to do some coercing the savings to appear
08:47:26FromDiscord<Rika> You’re missing a “for”
08:47:34FromDiscord<enthus1ast> i think the reason it is to not compress fasta is to search it faster (but what do i know, not a biochemist ;) )
08:48:18FromDiscord<tbrekalo> Actually to compress it because datasets loaded into memory take up few tens of GB
08:48:24FromDiscord<Elegantbeef> Oh nvm it didnt compress it
08:48:34FromDiscord<Elegantbeef> This data has symbols mine doesny
08:48:40FromDiscord<Elegantbeef> Whew i'm not crazy
08:54:51*Pyautogui quit (Quit: Connection closed)
09:05:08PMunch@tbrekalo, did this for fun: http://ix.io/3vxg/nim
09:05:32FromDiscord<tbrekalo> thanks!
09:05:57FromDiscord<Elegantbeef> Wow look at this dude actually compress stuff
09:06:02FromDiscord<Elegantbeef> Big brain over here
09:06:19PMunchYou could obviously replace that loop over the string with something like a streaming read from a file
09:09:23FromDiscord<tbrekalo> Umm, my 2nd day of nim 😆 still struggling with some rng stuff. I'll send you min impl by noon
09:09:56FromDiscord<Elegantbeef> Ah noon so you've given yourself 9 hours
09:10:01PMunchRNG in DNA, sounds like a recipe for cancer :P
09:10:19FromDiscord<Elegantbeef> Well within an acceptable amount of course pmunch
09:15:37FromDiscord<dimspith> How can i watch a file for changes asynchronously in nim? i'd like to have a variable storing the last modified time of a file and update it's contents dynamically.
09:15:50FromDiscord<Elegantbeef> also pmunch using `genome.len - 1` instead of `genomone.high`... 😀
09:19:11PMunchhttp://ix.io/3vxj/nim
09:19:45PMunchJust a bit more fun, now it has it's own type, and an accessor so you can easily get out the different nucleobases from the binary data or iterato over it :)
09:19:52PMunch@tbrekalo ^
09:19:59FromDiscord<Elegantbeef> still using `.len - 1`
09:20:13PMunchYes, because logically that's what I'm doing
09:20:33FromDiscord<Elegantbeef> but that's what `genome.high` is?
09:20:40PMunchI'm not trying to get the highest index, I'm subtracting one from the length so I get the proper rounding effect
09:20:43FromDiscord<Rika> Yes but that isn’t the intention
09:20:48PMunchI like to differentiate the two cases :P
09:20:59PMunchThe result would be exactly the same
09:21:12FromDiscord<Elegantbeef> Of course but i'm just joking around
09:21:31PMunchIt's an interesting question though
09:22:25PMunchI mean they are functionally equivalent, but I feel this one is more "correct" with the intent I have there as opposed to using .high. Makes it a bit more clear what I'm trying to do
09:22:52FromDiscord<Elegantbeef> \Can i atleast joke about using `+= 1` instead of `inc`?!
09:24:20PMunchHaha, you can joke about anything :) It just reminded me of an interesting stylistic discussion
09:25:41PMunchSince most languages don't have these systems it's one I haven't seen much before. But with Nim and these handy operations for these common tasks I think it's an interesting discussion
09:25:47PMunchSame with `reset`
09:26:16PMunchI like using reset instead of ` = 0` or whatever the default value is
09:26:56FromDiscord<Elegantbeef> I didnt even know reset existed
09:27:05PMunchBecause reset explains what I'm actually trying to do. I don't care what the value actually is, I just want to reset it back to what it would be if I hadn't assigned anything to it
09:27:18PMunchIt's pretty neat, can be helpful in generic code as well
09:28:00FromDiscord<Elegantbeef> Yea i mean it's just short hand of `a = default(typeof(a))`
10:16:27FromDiscord<KnorrFG> if i have an enum in c, and i wanna cycle through it, id do something like this `state = (state + 1) % 3` (if the enum has 3 values) what is the nim-equivalent for this?
10:23:10*Vladar quit (Quit: Leaving)
10:27:06*Vladar joined #nim
10:31:47FromDiscord<hotdog> In reply to @dimspith "How can i watch": @dimspith there’s a few bindings for libfswatch you could use - https://nimble.directory/search?query=fswatch+
10:36:16PMunchKnorrFG, you can use inc to increase the value of an enum
10:36:20PMunchBut that doesn't wrap
10:42:23FromDiscord<KnorrFG> Yep, that's what I found out too. I'll just go with an extra if I guess
10:43:43PMunchCould wrap it as a `next` proc or template
10:44:37FromDiscord<System64 ~ Flandre Scarlet> Hello, does the Nim bindings of SDL2 allow to do that kind of things? https://media.discordapp.net/attachments/371759389889003532/874604134173638696/unknown.png
10:45:13PMunch@System64, sure why wouldn't they?
10:47:03FromDiscord<System64 ~ Flandre Scarlet> 'cause C doesn't allow it
10:48:14FromDiscord<jtiai> In reply to @System64 "'cause C doesn't allow": I recommend to use Vladr4 sdl2_nim. It's better than "official" bindings.
10:48:22FromDiscord<dom96> In reply to @dimspith "How can i watch": if you want a fun project you can port https://github.com/nim-lang/graveyard/blob/master/fsmonitor/src/fsmonitor.nim to async/await
10:48:46FromDiscord<haxscramper> In reply to @System64 "'cause C doesn't allow": C does not have lambdas, nim does
10:49:07FromDiscord<System64 ~ Flandre Scarlet> In reply to @jtiai "I recommend to use": What does it add?
10:49:09FromDiscord<haxscramper> The part you outlined assigns lambda to a field in constructor
10:49:38FromDiscord<haxscramper> So naturally C would not allow for that, but it is not really related to SDL I think
10:49:52FromDiscord<Rika> Couldn’t you technically do that by passing the address of a function
10:49:55FromDiscord<System64 ~ Flandre Scarlet> ah alright
10:50:53FromDiscord<jtiai> In reply to @System64 "What does it add?": Bindings are done more nim-style than plain C-bindings to nim which official ones are.
10:51:24FromDiscord<System64 ~ Flandre Scarlet> ah alright, let me check that
10:52:10FromDiscord<jtiai> And technically, sdl2_nim was created before official one. 😄
10:53:03FromDiscord<jtiai> It's mainly how sdl2_nim handles types etc. They're better. And good set of examples and docs. But they're not that different. Both enables the same stuff.
10:55:17FromDiscord<tbrekalo> In reply to @PMunch "Just a bit more": http://ix.io/3vxC/nim
10:56:23PMunchYou don't need that {size} pragma, enums are automatically the smallest possible size
10:56:57FromDiscord<tbrekalo> In reply to @PMunch "You don't need that": thanks
10:57:42FromDiscord<tbrekalo> How does enum encoding work under the hub? How can I benchmark is lookup table faster than default enum decoding in nim?
10:58:14PMunchUhm, that `pos shr 5` is not going to work as soon as you go over 5 bits in size..
10:58:31PMunchThere are a lot of odd choices in this code..
10:58:44PMunch32 + 0.999 for example
10:58:56PMunchAnd what is the baseEncoder for?
10:59:01FromDiscord<tbrekalo> In reply to @PMunch "Uhm, that `pos shr": wym?
10:59:26FromDiscord<tbrekalo> In reply to @PMunch "And what is the": It's a lookup table for encoding chars to base values used for bit mapping
11:00:18PMunchOh wait, that shr thing might actually work
11:00:30PMunchBut why?
11:01:41PMunchEh, I guess it might be slightly faster depending on the CPU, hard to tell without a benchmark
11:02:08PMunchSpeaking of how to benchmark, just generate a bunch of valid data (or run on a data-set) and test both approaches against each other
11:03:17*neurocyte joined #nim
11:04:05PMunchBy the way here you don't need to declare the type: var buffer: seq[Base] = newSeqOfCap[Base](fasta.size)
11:04:15FromDiscord<tbrekalo> Because one block encodes 32 bases which is 2^5. You can write each `pos` as `x|y` in bits. (here I use `|` as concatenation operator with bit strings) `y` is 5 bits long because it represents number in range (0-31) which are always discarded in whole division with 32
11:04:32PMunchSame for your strings at the end
11:05:09PMunchYeah I realised that it would work as I tried to type out why it wouldn't :P
11:06:02FromDiscord<tbrekalo> In reply to @PMunch "By the way here": Thanks 🙂 I have a bad habit of redundant typedefs xD
11:07:28PMunchAnd the lookup table might be faster than the parseEnum route, but I doubt it'd be much faster than a case statement
11:08:28*auxym joined #nim
11:10:14FromDiscord<tbrekalo> got one quesiton regarding code
11:11:06FromDiscord<tbrekalo> `result.data = newSeq[uint64]((data.len() / 32 + 0.999).toInt()` Can I deduce the type argument for `newSeq` from `result.data`. I asked that earlier but failed to translate answers to code
11:11:34PMunchWhat do you mean?
11:11:52PMunchInstead of having to type newSeq[uint64] use the type from result.data?
11:13:05FromDiscord<tbrekalo> I would like to be able to write something like: `result.data = newSeq[typeof(result.data[0])] ....`
11:13:06FromDiscord<Rika> Put “typeof(result.data)” instead of the uint part
11:13:08FromDiscord<Rika> ?
11:13:23*Pyautogui joined #nim
11:13:23FromDiscord<Rika> Oh that’s what you mean
11:13:34FromDiscord<Rika> (edit) "“typeof(result.data)”" => "“typeof(result.data).T”"
11:13:38FromDiscord<Rika> I forgot the T part
11:14:21FromDiscord<proud linux user> bruh
11:14:31FromDiscord<tbrekalo> In reply to @Rika "Put “typeof(result.data).T” instead of": but I get `Error: undeclared field: 'T' `
11:14:41FromDiscord<Rika> Outside of the typeof?
11:14:53FromDiscord<tbrekalo> yes
11:15:03FromDiscord<tbrekalo> brb few mins
11:15:52FromDiscord<proud linux user> min
11:16:16*Pyautogui quit (Client Quit)
11:16:33FromDiscord<Rika> Then import typetraits and typeof(result.data).genericParams().get(0)
11:17:02PMunchRika, I have never seen that .T thing, where did you get that from?
11:17:25FromDiscord<Rika> I was pretty sure it was valid for generics
11:17:42FromDiscord<Rika> I do not remember
11:18:23*arkurious joined #nim
11:18:37FromDiscord<Rika> Actually I guess elementType from typetraits also works
11:20:14*max22- quit (Ping timeout: 256 seconds)
11:20:40*rockcavera joined #nim
11:20:40*rockcavera quit (Changing host)
11:20:40*rockcavera joined #nim
11:23:29FromDiscord<tbrekalo> Thanks @Rika !↵It works 🙂
11:25:11FromDiscord<Rika> The second one I sent (elementType) should be cleaner
11:26:42FromDiscord<System64 ~ Flandre Scarlet> does someone know how can I make a lambda there please? https://media.discordapp.net/attachments/371759389889003532/874614732525559818/unknown.png
11:27:16FromDiscord<Rika> Making lambdas should be in the manual
11:29:05FromDiscord<dimspith> In reply to @dom96 "if you want a": Sounds like a good chance to learn more about async/await and contribute. Thanks!
11:38:22FromDiscord<System64 ~ Flandre Scarlet> nice, first try https://media.discordapp.net/attachments/371759389889003532/874617665346502706/unknown.png
11:40:42FromDiscord<Rika> Cursed indentation ngl
11:43:23FromDiscord<System64 ~ Flandre Scarlet> why is it cursed?
11:45:52FromDiscord<Rika> I would put the proc signature on the next line
11:46:03FromDiscord<Rika> That way I don’t add 1515724852 levels of indentation for the proc body
11:46:16PMunchDitto
11:46:48PMunchAnd what's up with 4 spaces indent?
11:47:54supakeenit's not following the fibonacci rule :(
11:48:12*laintree joined #nim
11:48:30PMunchFibonacci indentation?
11:48:46*mahlon_ joined #nim
11:49:01FromDiscord<proud linux user> is that system64
11:49:03FromDiscord<proud linux user> ohgod
11:49:03*auxym quit (Ping timeout: 258 seconds)
11:51:53*xet7 quit (*.net *.split)
11:51:53*lucerne quit (*.net *.split)
11:51:53*jkl quit (*.net *.split)
11:51:53*happycorsair[m] quit (*.net *.split)
11:51:53*lain quit (*.net *.split)
11:51:54*mahlon quit (*.net *.split)
11:51:54*mjsir911 quit (*.net *.split)
11:51:54*icebattle quit (*.net *.split)
11:51:54*blackbeard420 quit (*.net *.split)
11:51:54*Amun-Ra quit (*.net *.split)
11:51:54*nixfreak_nim[m] quit (*.net *.split)
11:51:54*Helios quit (*.net *.split)
11:51:54*Ekho quit (*.net *.split)
11:51:54*greyrat quit (*.net *.split)
11:51:54*robertmeta quit (*.net *.split)
11:51:55*oz quit (*.net *.split)
11:51:55*asd quit (*.net *.split)
11:51:55*ecs quit (*.net *.split)
11:53:12*xet7 joined #nim
11:53:12*lucerne joined #nim
11:53:12*jkl joined #nim
11:57:09*ecs joined #nim
11:57:09*asd joined #nim
11:57:48*happycorsair[m] joined #nim
11:57:52*nixfreak_nim[m] joined #nim
11:57:53*Helios joined #nim
11:57:53*Ekho joined #nim
11:57:53*greyrat joined #nim
11:57:53*robertmeta joined #nim
11:57:53*oz joined #nim
11:58:00*mjsir911 joined #nim
11:58:00*icebattle joined #nim
11:58:00*blackbeard420 joined #nim
11:58:00*Amun-Ra joined #nim
12:00:44*nixfreak_nim[m] quit (Ping timeout: 252 seconds)
12:00:44*Helios quit (Ping timeout: 252 seconds)
12:00:54supakeenPMunch: 1 for the first indentation, 1 for the second, 2, 3, 5, etc.
12:00:59supakeenGood way to have less levels ;)
12:01:02*happycorsair[m] quit (Ping timeout: 256 seconds)
12:01:11PMunchHaha, sounds, interesting.. :P
12:06:01*supakeen quit (Quit: WeeChat 3.2)
12:06:54*supakeen joined #nim
12:23:59FromDiscord<bolino> Hi!↵I have a sequence of tables, each of those tables represent a row to be written in a MySQL database with `db_mysql` module.↵Do you know how I can build the query with the values from those tables as parameters of a prepared SQL statement like `db.exec(sql("INSERT INTO table (fieldA, fieldB, fieldC) VALUES (?, ?, ?);"), "row1valueA", "row1valueB", "row1valueC")`?
12:25:18FromDiscord<bolino> (edit) ""row1valueC")`?" => ""row1valueC", "row2valueA", "row2valueB", "row2valueC")`, (but with many an undefined number of rows/tables of course)?"
12:35:18*laintree is now known as lain
12:46:41*max22- joined #nim
13:04:52*rockcavera quit (Remote host closed the connection)
13:05:15*rockcavera joined #nim
13:05:15*rockcavera quit (Changing host)
13:05:15*rockcavera joined #nim
13:20:29*happycorsair[m] joined #nim
13:24:04*xet7 quit (Remote host closed the connection)
13:31:23*nixfreak_nim[m] joined #nim
13:33:21*Helios joined #nim
13:37:43*PMunch quit (Quit: Leaving)
13:44:58*Vladar quit (Quit: Leaving)
13:51:24*rockcavera quit (Remote host closed the connection)
13:59:21FromDiscord<planetis> @bracketmaster\: try this https://github.com/planetis-m/cowstrings
13:59:24nrds<prestigebot99> itHub: 7"Copy-On-Write string implementation according to nim-lang/RFCs#221"
13:59:34*rockcavera joined #nim
14:03:08FromDiscord<Rika> moo
14:08:52*neurocyte left #nim (The Lounge - https://thelounge.chat)
14:12:42FromDiscord<proud linux user> did you moo todaY?
14:14:10FromDiscord<enthus1ast> whom's bot is @proud linux user btw? \:)
14:14:35FromDiscord<proud linux user> its me
14:14:45FromDiscord<proud linux user> i am a disgorg user
14:30:27FromDiscord<TurtleP> is there a way to statically link on macOS? I keep getting an error about `ld: -lcrt0.o library not found` on macOS 10.15.
14:47:35FromDiscord<proud linux user> ohyes. i have ad this mulitple times
14:47:41FromDiscord<proud linux user> but i forgor sorry
15:27:50*mahlon_ is now known as mahlon
15:54:39FromDiscord<leorize> `--passL:'-Wl,-Bstatic -llibs -lto_be -llinked_statically -Wl,-Bdynamic'`↵(@TurtleP)
15:55:01FromDiscord<leorize> on mac you can't statically link the libc for the most part (nor should you)
16:02:01FromDiscord<TurtleP> Ah I mainly wanted to because I do it for Windows and Linux
16:02:15*auxym joined #nim
16:04:00*stkrdknmibalz quit (Ping timeout: 268 seconds)
16:06:57*auxym quit (Ping timeout: 248 seconds)
16:13:32FromDiscord<Jakraes> Is there a way to make certain procs from a file unusable when imported
16:13:50FromDiscord<Rika> dont export it
16:14:03FromDiscord<Jakraes> Gotcha, thank you!
16:14:07FromDiscord<Rika> can you be more specific
16:15:12FromDiscord<Jakraes> I want to make a library, so far only for myself and there are certain functions that are not supposed to be imported, they're only used inside the library
16:15:28FromDiscord<Rika> yeah then dont export it
16:15:43FromDiscord<Rika> aka no after the name of the function (procedure)
16:16:04FromDiscord<Jakraes> Gotcha, thank you for the help!
16:27:22*cyraxjoe quit (Ping timeout: 240 seconds)
16:39:24*ozzz joined #nim
16:43:00*auxym joined #nim
17:06:08FromDiscord<dankrad> if you create a nimble package you can place those also in "private" folder inside the src/projectname/ folder, I guess.
17:08:25*fputs joined #nim
17:11:26*auxym quit (Ping timeout: 258 seconds)
17:16:35*rockcavera quit (Read error: Connection reset by peer)
17:17:26*rockcavera joined #nim
17:17:26*rockcavera quit (Changing host)
17:17:26*rockcavera joined #nim
17:27:35FromDiscord<gerwy> guys guys guys
17:27:44FromDiscord<gerwy> NimScript is interpreted right?
17:27:54*notchris quit (Ping timeout: 240 seconds)
17:28:38FromDiscord<haxscramper> yes
17:28:47FromDiscord<haxscramper> well, compiled to register VM which then executes it
17:29:28FromDiscord<gerwy> how can i get the size of it's interpreter? i do a little comparison between scripting langs
17:30:10FromDiscord<haxscramper> https://github.com/nim-lang/Nim/blob/devel/compiler/vm.nim
17:30:28FromDiscord<haxscramper> for vm
17:30:30FromDiscord<haxscramper> https://github.com/nim-lang/Nim/blob/devel/compiler/vmgen.nim for codegen
17:30:38FromDiscord<haxscramper> \~4k
17:31:07FromDiscord<haxscramper> But if you compare other scripting langs you get into tricky situation, since you also need to include parser/lexer/typecheck etc. ... which is basically most of the compiler
17:31:26FromDiscord<gerwy> 4k lines of code, i mean more like a binary
17:31:52FromDiscord<haxscramper> wait a second, I have a test script, so I can tell you approximate size
17:32:00FromDiscord<gerwy> yeah i should include also libraries that are built in some of them like in Python or Lua but thats get hard, i can't find the size of any Ruby interpreter
17:32:40FromDiscord<gerwy> In reply to @haxscramper "wait a second, I": oooh, that would be cool if you would get the size of it, also if you would compress it with upx that would be cool too
17:35:33*notchris joined #nim
17:36:26FromDiscord<System64 ~ Flandre Scarlet> For callbacks, are callbacks faster with lambdas or predefined functions? https://media.discordapp.net/attachments/371759389889003532/874707778533470218/unknown.png
17:36:48FromDiscord<Rika> please benchmark
17:37:00FromDiscord<Rika> that isnt something that's obvious i assume and imagine
17:37:36FromDiscord<System64 ~ Flandre Scarlet> Humm how can I benchmark it?
17:37:48FromDiscord<haxscramper> https://github.com/treeform/benchy
17:37:50nrds<prestigebot99> itHub: 7"Benchmarking."
17:38:55FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3vzD
17:39:08FromDiscord<haxscramper> `nim c -r -d:release test1.nim` gives `3.4M`
17:40:05FromDiscord<haxscramper> `nim c -r -d:release --stacktrace:off --opt:size test1.nim` is down to `2.5M`
17:40:32FromDiscord<gerwy> Hmm still quiet big to be honest
17:40:35FromDiscord<haxscramper> `strip` cuts out another `0.5M`
17:40:52FromDiscord<gerwy> And upx --lzma maybe?
17:41:11*clemens3 joined #nim
17:41:29FromDiscord<haxscramper> `528k`
17:41:55FromDiscord<gerwy> (edit) "upx --lzma" => "`upx --lzma`"
17:42:53FromDiscord<gerwy> Okay thats quiet nice, thank you <33
17:43:10FromDiscord<gerwy> Now i need to say the same thing in Ruby server lol
17:43:22FromDiscord<haxscramper> You can try this yourself, `nimble install compiler` and check for different flags
17:46:17FromDiscord<gerwy> Okay, but its just rough comparison
18:02:31ozzzHi all! what is second argument for truncate() from posix?
18:02:39ozzzcan't find it in man
18:02:40*auxym joined #nim
18:02:40FromDiscord<Jakraes> I need some help, for some reason the program doesn't output "test", instead it outputs an error, even if it's inside a try except, what's going on? https://media.discordapp.net/attachments/371759389889003532/874714377746518036/Screenshot_5.png
18:04:12nrds<Prestige99> @ozzz should be length - where are you looking?
18:05:24ozzznrds: thanks, for some reason I can't find anythin on nim-lang.org
18:05:37ozzzPrestige ^
18:05:56FromDiscord<Rika> wrong index is a defect
18:05:58FromDiscord<Rika> cannot be caught
18:06:48FromDiscord<Rika> please test size; we do not follow "try, dont check" here
18:08:33FromDiscord<Rika> In reply to @Rika "cannot be caught": well afaik they are by default, `--panics:off` probably disables the behavior
18:09:05FromDiscord<Rika> ah, incorrect array indexes are never exceptions and are checked on compile time
18:09:40FromDiscord<Rika> change it to a seq and itll work (while --panics:off is set or is default)
18:09:53FromDiscord<undersquire> what about with sequences?
18:10:00FromDiscord<Rika> In reply to @Rika "change it to a": i just said
18:10:00FromDiscord<undersquire> are index checks at runtime then?
18:10:05FromDiscord<Rika> yes
18:10:07FromDiscord<undersquire> ah ok
18:10:18FromDiscord<undersquire> would that be handled via try except then?
18:10:33FromDiscord<Rika> i said as well "while panics:off is either set or still default"
18:10:45FromDiscord<Rika> otherwise they cannot be caught and will crash your program
18:10:49FromDiscord<undersquire> ah ok
18:14:02FromDiscord<dain> nim has a repl but it's called `secret` so i guess it's experimental
18:14:16FromDiscord<dain> is it unstable or something?
18:14:33FromDiscord<konsumlamm> yes
18:15:02FromDiscord<konsumlamm> it's called that because noone is supposed to use it for serious stuff
18:18:43FromDiscord<dain> oh :(
18:37:08*max22- quit (Ping timeout: 256 seconds)
18:58:04*notchris_ joined #nim
18:58:31*notchris quit (Ping timeout: 268 seconds)
19:16:08*auxym quit (Quit: Konversation terminated!)
19:16:20*auxym joined #nim
19:18:57*auxym quit (Read error: Connection reset by peer)
19:46:14FromDiscord<lamersc.com 🐧> I’m genuinely curious, are there plans for a native LLVM backend in the future? https://media.discordapp.net/attachments/371759389889003532/874740444997759047/image0.png
19:46:25FromDiscord<lamersc.com 🐧> I know there’s nlvm, but just noticed this in the docs
19:51:47*max22- joined #nim
19:52:54FromDiscord<konsumlamm> apart from nlvm, not that i know of
19:59:00FromDiscord<tsoj> Is there some kind of (unofficial) convention how to name library functions that shouldn't be used directly by the user, but need to be public?
19:59:54FromDiscord<haxscramper> `xxxImpl`, `xxxAux`
20:00:18FromDiscord<haxscramper> You can also move things to `private/`
20:17:00FromDiscord<tsoj> sent a code paste, see https://play.nim-lang.org/#ix=3vAn
20:24:49ozzzanother question, is there any sleep() which may handle ms?
20:26:05FromDiscord<tsoj> doesn't `sleep()` from os use milliseconds?
20:26:41ozzzproc sleep(milsecs: int)
20:26:48ozzzcorrect, sorry
21:22:30FromDiscord<Jakraes> Is there an expression to transform any number into an int? Just like there's $ to transform anything into a string
21:26:00FromDiscord<Elegantbeef> If it's within the range of an int you can just do `int(yourNumber)`
21:27:20FromDiscord<Jakraes> Unfortunately that doesn't work
21:28:03FromDiscord<Jakraes> Even if I do int(3.0) it doesn't work
21:29:34FromDiscord<Elegantbeef> !eval echo int(3.0)
21:29:35NimBot3
21:30:37FromDiscord<undersquire> !eval echo "Hello"
21:30:39NimBotHello
21:30:41FromDiscord<undersquire> 😭
21:30:44FromDiscord<undersquire> oh
21:31:05FromDiscord<Jakraes> https://media.discordapp.net/attachments/371759389889003532/874766828650524712/Screenshot_8.png
21:31:33FromDiscord<Jakraes> It doesn't work like this for example
21:31:35FromDiscord<Elegantbeef> You're assigning int to test which is a float
21:31:45FromDiscord<Jakraes> Ooooh
21:31:46FromDiscord<Jakraes> So that's why
21:31:49FromDiscord<Jakraes> Thank you!
21:31:50FromDiscord<Elegantbeef> Nim isnt dynamically typed
21:32:04FromDiscord<Jakraes> Yeah I completely forgot about that
21:32:08FromDiscord<Jakraes> Thank you
21:33:26FromDiscord<Elegantbeef> Error messages are your friend
21:39:18FromDiscord<Jakraes> I was reading them but I wasn't getting there lmao, I was thinking "Yeah that's what I want to happen" but yeah, completely forgot nim wasn't dynamically typed
22:02:26madpropsWhat's the proper way to add a public method to an object?
22:02:29madpropsI'm doing: method getInt*(a:NapArg, fallback=0, exit_on_fail=true): int {.base.} =
22:02:37madpropsbut I get: Error: attempting to call undeclared routine: 'getInt'
22:02:58madpropsNapArg is a ref object
22:04:05FromDiscord<Elegantbeef> that is the proper way, is the `NapArg` type exported?
22:04:13madpropstype NapArg* = ref object
22:04:20madpropsI import the file
22:04:49madpropsshould I import the type manually?
22:04:55FromDiscord<Elegantbeef> Nah
22:06:18FromDiscord<Elegantbeef> Also what's the point of the method if it's non inheritable type?
22:07:01madpropsthe aim is just to offer an obj.getIt() method
22:07:03madpropswhat's the proper way?
22:07:08madpropsgetInt*
22:07:16FromDiscord<Elegantbeef> if you dont need to override you just make a proc
22:07:43FromDiscord<Elegantbeef> So it becomes `proc getInt(a:NapArg, fallback=0, exit_on_fail=true): int`
22:08:24FromDiscord<Elegantbeef> But it's still weird the `getInt` wasnt accessible
22:09:47FromDiscord<Elegantbeef> Yea i can only reason you tried to call `getInt` on a non `NapArg` object
22:10:07madpropsi'll check, thanks
22:14:18madpropsso the issue is that to make it work in the integration file, I need to not just import "appname" but also the "types" file
22:14:31madpropssince it's a library I don't want users to have to do more than just import appname
22:14:49madpropsso I'll have to move the procs to the main file I guess
22:15:13FromDiscord<lamersc.com 🐧> Is there a Nim roadmap?
22:15:16FromDiscord<Elegantbeef> you can always export the types in the `appname`
22:15:19FromDiscord<lamersc.com 🐧> And if so, where can I find it?
22:15:28FromDiscord<Elegantbeef> Or the procedure in this case
22:17:29madpropshow could I export it?
22:17:53madpropsit's already exported from 'types', and imported in 'appname' file
22:18:19FromDiscord<Elegantbeef> `export NapArg` to selectively export the type or `export types` for the module
22:19:07madprops'export types' works, ty
23:13:30madpropsseems that updating a library dependency won't trigger a recompilation on next launch
23:26:39*max22- quit (Remote host closed the connection)