<< 25-11-2022 >>

00:00:41FromDiscord<Yepoleb> what frustrates you about database servers?
00:01:58FromDiscord<albassort> I've never been able to set one up
00:02:01FromDiscord<albassort> i haven't tried
00:02:14FromDiscord<albassort> I'll have like a 20 page manufesto in 10 minutes when i get dbeaver working
00:04:13FromDiscord<Yepoleb> are you sure you need a database server and sqlite or json files is not enough?
00:04:46FromDiscord<albassort> No what im doing its best to have a database
00:04:50FromDiscord<albassort> sqlite is probably enough
00:04:55FromDiscord<albassort> but i wanna try portgres
00:04:59FromDiscord<Yepoleb> mariadb and postgres are pretty similar to set up
00:06:01FromDiscord<Yepoleb> In reply to @albassort "but i wanna try": postgres is the best choice when you need a database server
00:07:09FromDiscord<albassort> the last time i tried to setup maraidb i literally broke down crying
00:07:14FromDiscord<albassort> but i was like 15
00:08:00FromDiscord<Yepoleb> are you using linux?
00:08:09FromDiscord<albassort> yea
00:08:17FromDiscord<albassort> i was using the old termianl
00:08:23FromDiscord<albassort> (edit) "termianl" => "terminal mariadb"
00:08:57FromDiscord<albassort> ah so i got it working
00:09:04FromDiscord<ShalokShalom> Postgres is great
00:09:40FromDiscord<Yepoleb> there's a lot of bad information about mariadb setup out there
00:10:05FromDiscord<ShalokShalom> Postgres can do graphs as well
00:10:09FromDiscord<ShalokShalom> Its pretty flexible.
00:10:13FromDiscord<albassort> so far on the nim page
00:10:19FromDiscord<albassort> it looks just like sql
00:10:20FromDiscord<albassort> :think:
00:10:45FromDiscord<ShalokShalom> What looks like SQL?
00:10:56FromDiscord<ShalokShalom> Postgres is using SQL as query language
00:11:00FromDiscord<ShalokShalom> If you mean that
00:11:31FromDiscord<albassort> yea
00:29:05*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
00:30:04FromDiscord<jos> https://media.discordapp.net/attachments/371759389889003532/1045496559556644874/image.png
00:30:16FromDiscord<jos> why does the second method have that warning but the first one doesn't?
00:30:24FromDiscord<jos> i don't really understand even after googling
00:39:00FromDiscord<Elegantbeef> Lock levels you can just ignore
00:39:38FromDiscord<jos> i can't find any docs on them except this
00:39:41FromDiscord<jos> http://web.mit.edu/nim-lang_v0.16.0/.nim-0.16.0.amd64_ubuntu1404/doc/manual/locking.txt
00:39:46FromDiscord<jos> is there something better to read
01:04:37*neceve_ joined #nim
01:06:15*neceve quit (Ping timeout: 268 seconds)
01:07:37FromDiscord<albassort> is there a hispter sexy database language
01:07:40FromDiscord<albassort> like nim
01:17:19FromDiscord<Rika> Graph database languages
01:18:02FromDiscord<albassort> nosql
01:18:40FromDiscord<Rika> Those are not very hipster
01:19:31FromDiscord<albassort> I think nosql was the database I was told to use at work?
01:19:39FromDiscord<albassort> :think:
01:19:43FromDiscord<albassort> (edit) ":think:" => "<:sad_think:899608203736780821>"
01:25:47FromDiscord<exelotl> isn't nosql the whole category of databases that don't use SQL? 🤔
01:33:18FromDiscord<.tochka> yessql
01:34:31FromDiscord<albassort> https://github.com/sebastienros/yessql
01:35:31FromDiscord<.tochka> ...maybesql?
01:39:19FromDiscord<voidwalker> I need to store a sequence of strings, with no duplicates allowed, so that I can assign each unique string to an int, for fast lookups. I am using seq[string], with the index being the int to refference it. (like a dictionary). Is there anything else better suited for this ?
01:42:42FromDiscord<Yepoleb> In reply to @albassort "is there a hispter": There are libraries to generate sql from code
01:42:59FromDiscord<albassort> ngl i kinda hate sql
01:43:05FromDiscord<albassort> but idk if thats because i haven't practiced it enough
01:43:17FromDiscord<albassort> i don't really wanna write sql in my nim code
01:43:37FromDiscord<.tochka> In reply to @voidwalker "I need to store": should be good enough, tho be wary that you cant change that sequence or otherwise index references will be invalid
01:44:20FromDiscord<voidwalker> no need to change it, just needs to be a dictionary.
01:44:44FromDiscord<exelotl> tbh my takeaway after years of avoiding SQL is that you just gotta bite the bullet and write the SQL
01:45:16FromDiscord<voidwalker> I was thinking maybe some structure that has an .add that returns the index where the position of the added element, or if it exists, that position
01:45:43FromDiscord<.tochka> you can add it over seq
01:46:00FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4gNf
01:46:03FromDiscord<voidwalker> basically anything to reduce the number of lines of this code : D
01:46:34FromDiscord<voidwalker> (edit) "https://play.nim-lang.org/#ix=4gNf" => "https://play.nim-lang.org/#ix=4gNg"
01:47:34FromDiscord<voidwalker> so I could have `let pathId = t.filePaths.add("whatever")`
01:47:44FromDiscord<Yepoleb> Is that the next step after reducing the number of letters in variable names? 😛
01:48:13FromDiscord<voidwalker> haha, d and l actually come from the bencode lib I am using, and I was glad, cause the previous one had dictVal, listVal.. ugh
01:48:21FromDiscord<.tochka> sent a code paste, see https://play.nim-lang.org/#ix=4gNh
01:48:24FromDiscord<.tochka> fuck
01:49:08FromDiscord<voidwalker> yeah I guess I could implement it, I thought maybe this was common enough that it exists in some data structure
01:49:15FromDiscord<.tochka> sent a code paste, see https://play.nim-lang.org/#ix=4gNi
01:49:23FromDiscord<voidwalker> I'd still have one extra line to define the func headers though :\
01:50:13FromDiscord<.tochka> In reply to @voidwalker "yeah I guess I": not that common i would say
01:50:22FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4gNj
01:50:41FromDiscord<.tochka> i can only assume python background from that
01:51:04FromDiscord<voidwalker> haha no, pascal background.. too many lines, too much verbosity
01:51:24FromDiscord<voidwalker> I am taking my revenge now
01:51:47FromDiscord<Yepoleb> Hashsets are the most efficient data structure for deduplication
01:52:23FromDiscord<.tochka> searching will certainly be faster with hashset
01:52:30FromDiscord<.tochka> indexing is faster this way doe
01:53:36FromDiscord<voidwalker> well I need a fast (free) lookup I guess. To avoid storing duplicate string in memory
01:54:43FromDiscord<.tochka> are you adding things constantly or only once
01:54:51FromDiscord<voidwalker> just once
01:55:19FromDiscord<.tochka> your way is fine then, unless data set is really big
01:55:26FromDiscord<voidwalker> trying to store the filepaths/filename/filezie of a .torrent file contents
01:55:30FromDiscord<.tochka> could also store hash along side string data for faster search
01:56:32FromDiscord<albassort> does postrgres optimize duplicate strings in databases?
01:56:57FromDiscord<voidwalker> ah, now that I think of it, I think the filepath info in torrents is stored in lexicographic order, that would mean there is no search needed, just lookup last element.
02:03:23FromDiscord<Yepoleb> if you want few lines, add the strings to a hashset and convert it to a seq with toSeq later
02:04:38FromDiscord<.tochka> smart
02:05:29FromDiscord<Yepoleb> or use sequtils deduplicate if it's already in a seq
02:06:11FromDiscord<voidwalker> so the string will be the key to the hashset ?
02:06:58FromDiscord<Yepoleb> it's a hashset, not a hashtable, so it does not expose the keys
02:08:00FromDiscord<voidwalker> ah, never used that one, let me see
02:08:57FromDiscord<voidwalker> ` A generic hash set.` great docs : D
02:10:13FromDiscord<voidwalker> Guess I missed that class in CS
02:11:32FromDiscord<Yepoleb> apparently you can get the string value back from a hashset using a key, but it does not seem documented what the key type should be
02:12:07FromDiscord<Yepoleb> a set is a collection of items where you can not have duplicates
02:12:41FromDiscord<Yepoleb> internally it's a hashtable with the key being the hash of the value
02:13:23FromDiscord<voidwalker> so I'd need to use that key instead of the uint index I am using now, to store the "pointer" to the value ?
02:13:33FromDiscord<voidwalker> how big is that hash ?
02:13:41FromDiscord<.tochka> string itself would be the key
02:13:43FromDiscord<Yepoleb> 64 bits most likely
02:15:15FromDiscord<Yepoleb> `type Hash = int`
02:16:28FromDiscord<Yepoleb> oh sorry for the confusion, apparently the hashset value pairs are hcode: key
02:17:00FromDiscord<Yepoleb> so the key is the value and hcode is the key 🤔
02:17:36FromDiscord<Elegantbeef> Yea you hash check if it's in the table and `myVal == myHashTableVal`
02:18:00FromDiscord<Yepoleb> anyway, don't worry about that
02:18:19FromDiscord<Yepoleb> just create a hashset, incl all your values and then convert it to a seq with toSeq
02:18:37FromDiscord<Yepoleb> or use toHashSet if your values are already in an array
02:21:46FromDiscord<albassort> how do i instantiate a type in postgress to then insert it into a table
02:21:54FromDiscord<albassort> in postgres
02:22:25FromDiscord<albassort> for example, by table as an array of a custom type as a parameter
02:22:27FromDiscord<Yepoleb> using the postgres cli?
02:22:32FromDiscord<albassort> no in nim
02:24:18FromDiscord<Yepoleb> you can't use custom types in postgres
02:24:56FromDiscord<Yepoleb> you need to break the type down into base types
02:25:11FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4gNq
02:25:38FromDiscord<Yepoleb> oh, i did not know that was possible
02:25:47FromDiscord<albassort> this compiles and is fine
02:25:58FromDiscord<albassort> but, i dont know how i'd make the first one
02:26:03FromDiscord<albassort> to then put it in the second one
02:26:56FromDiscord<Yepoleb> https://til.hashrocket.com/posts/3693c7fc13-creating-custom-types-in-postgresql
02:27:35FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4gNs
02:29:04FromDiscord<albassort> thats hideous and makes me anxious
02:29:07FromDiscord<albassort> hate the lack of saftey
02:29:16FromDiscord<albassort> mom pick me up im scare
02:30:19FromDiscord<Yepoleb> you don't have to use composite types if they don't vibe with you
02:30:37FromDiscord<Yepoleb> you can use foreign keys instead
02:30:44FromDiscord<albassort> what da hell is that
02:30:58FromDiscord<albassort> i mean i can obviously just throw a json in there and be free but eh
02:31:21FromDiscord<Rika> PostgreSQL has indexable JSON
02:31:26FromDiscord<albassort> yes
02:31:37FromDiscord<albassort> but isn't that kinda like cheating
02:31:50FromDiscord<Yepoleb> a foreign key just references a key in another table
02:32:09FromDiscord<albassort> i guess i could also do that
02:32:29FromDiscord<albassort> actually thats pretty much what im doing already
02:32:33FromDiscord<albassort> that makes more sense tbh
02:32:45FromDiscord<albassort> I'll just make it an array of keys then
02:33:13FromDiscord<albassort> is there a type for id
02:33:28FromDiscord<albassort> actually I'll just do that in my code
02:33:54FromDiscord<Yepoleb> back when databases didn't have arrays we just created another table with the array values and a column with the id of the object they belong to
02:34:38FromDiscord<albassort> is it bad practice to make a key with rand(0 .. max(uint64))
02:34:43FromDiscord<Rika> In reply to @albassort "but isn't that kinda": If it were then they wouldn’t have it implemented no
02:34:47FromDiscord<Rika> There’s a use for it
02:34:52FromDiscord<Rika> If it fits it fits
02:35:27FromDiscord<Rika> In reply to @albassort "is it bad practice": No, people make primary keys with UUIDs all the time and it has a similar idea
02:35:35FromDiscord<Rika> I’d recommend the UUID instead though
02:35:47FromDiscord<albassort> yea but isn't that slower
02:35:53FromDiscord<albassort> because i gotta insert it then get the key
02:36:13FromDiscord<Rika> ?
02:36:18FromDiscord<albassort> hmm
02:36:20FromDiscord<Rika> Slower in what way
02:36:36FromDiscord<Rika> What do you think you’re doing lol
02:36:45FromDiscord<albassort> in one version I generate they as im inserting the data, in the other version in grabbing the uuid after i insert it
02:36:57FromDiscord<albassort> (edit) "they" => "the key"
02:37:24FromDiscord<Rika> You know you can also locally generate UUIDs
02:37:42FromDiscord<albassort> oh wait yea there is UUID Somewhere in the stdlib
02:38:03FromDiscord<ringabout> `std/oids` ^
02:38:09FromDiscord<Yepoleb> you probably don't need uuids for non distributed data and an auto increment primary key is good enough
02:38:10FromDiscord<.tochka> big hashes are good enough :D
02:38:41FromDiscord<albassort> In reply to @Yepoleb "you probably don't need": yea but who knows, stuff can go wrong
02:38:54FromDiscord<Yepoleb> 🤨
02:39:01FromDiscord<Rika> In reply to @Yepoleb "you probably don't need": Eh personally if I needed to expose that ID to the public, might as well already make it a UUID
02:39:10FromDiscord<Rika> In reply to @albassort "yea but who knows,": What?
02:39:20FromDiscord<Rika> Like what?
02:39:33FromDiscord<albassort> I'll figure a way ok
02:39:36FromDiscord<albassort> and oids is cooler
02:39:40FromDiscord<Rika> Okay…
02:39:49FromDiscord<Rika> Ultimately it’s your program
02:40:51FromDiscord<albassort> something I've learned when working with dbs is, if you can possibly mess something up while coding half asleep, do have some saftey measure against it because it can be annoying to undo
02:41:21FromDiscord<Yepoleb> In reply to @Rika "Eh personally if I": i've found out it's best practice to separate public ids and primary keys, so i would still add an integer primary key in addition
02:41:28FromDiscord<Rika> …like migrations, have migrations
02:41:56FromDiscord<Rika> In reply to @Yepoleb "i've found out it's": Yeah but it’s best practice, does it look like I follow good practices 😉
02:42:32FromDiscord<Yepoleb> but my database knowledge is pretty old at this point
02:43:10FromDiscord<Rika> You’re effectively halving your ID space by storing two of them!!! You lose out on one bit worth of IDs!!! That’s so wasteful
02:43:15FromDiscord<Rika> (I am joking)
02:43:27FromDiscord<Yepoleb> 🤔
02:43:35FromDiscord<ringabout> Why is vcc (~20s) much slower than mingw (~2s) on Windows in compilation time for a hello world program in Nim?
02:43:54FromDiscord<Rika> Sounds strange
02:44:02FromDiscord<Rika> Purge caches perhaps?
02:44:11FromDiscord<ringabout> (edit) "time" => "speed"
02:44:24FromDiscord<Yepoleb> the microsoft telemetry server is overloaded 😉
02:45:13FromDiscord<Rika> LOL
02:45:51FromDiscord<ringabout> 5s~10s regression from 1.4.8 to 1.6.6
02:47:17FromDiscord<Yepoleb> are you doing a simple `nim c helloworld.nim`?
02:48:10FromDiscord<ringabout> Yeah
02:49:18FromDiscord<Yepoleb> i'd try to narrow down which specific command is taking longer than expected with verbose logging
02:50:05rockcaveraringabout, the vcc compiler is slower by nature, but the da linker is even slower.
02:50:42rockcaveravcc has always been slower than gcc on windows
02:51:27FromDiscord<ringabout> I see, thanks
02:51:28FromDiscord<Yepoleb> but isn't 20 seconds a bit excessive?
02:52:05rockcaverayes
02:52:10FromDiscord<Yepoleb> it can't just be 10 times slower
02:52:36rockcaveragcc 12.2.0 here is a little slow too, especially the linker
02:53:43rockcavera27741 lines; 3.410s; 30.312MiB peakmem; simple echo "hello"
02:53:46rockcaverawith gcc
02:54:11rockcaverawith clang: 27741 lines; 4.772s; 30.312MiB peakmem;
02:55:11rockcaveravcc with devel I can't test it because it's broken
02:55:24FromDiscord<ringabout> In reply to @rockcavera "vcc with devel I": You can try refc
02:55:41rockcaveraI'll try
02:55:50rockcaveradebug or release?
02:55:55FromDiscord<ringabout> debug
02:56:43rockcaveranim c --mm:refc --cc:vcc -f test => 28980 lines; 8.120s; 30.289MiB peakmem;
02:57:14FromDiscord<ringabout> Yeah, It seems that a partial build uses 7.2s and a full build uses 20s.
02:57:17rockcaveranim c --mm:refc --cc:gcc -f test => 28980 lines; 6.155s; 30.293MiB peakmem;
02:57:48rockcaveranim c --mm:refc --cc:clang -f test => 28980 lines; 2.103s; 30.281MiB peakmem;
02:58:03rockcaveraclang did best here
02:58:15*Guest8331 joined #nim
02:58:20*Guest8331 quit (Client Quit)
03:00:09FromDiscord<ringabout> Why my full build compilation uses so much time `20.966s; 30.242MiB peakmem`? I'm using a 12700H Processor.
03:00:38rockcaveraI locked the processor frequency to not use turbo boost
03:01:25rockcaveraringabout, are you compiling a simple echo?
03:01:34FromDiscord<ringabout> Yes
03:01:36FromDiscord<ringabout> `` nim c --cc:vcc --mm:refc -f test5`
03:01:40FromDiscord<ringabout> (edit) "`` nim" => "`nim"
03:01:53FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4gNC
03:02:18rockcaverado you know which version of your vcc compiler? the cl.exe?
03:02:35FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4gND
03:02:49rockcaveraMicrosoft (R) C/C++ Optimizing Compiler Versão 19.33.31630 para x64
03:05:07FromDiscord<ringabout> Microsoft (R) C/C++ Optimizing Compiler Version 19.34.31933
03:06:37rockcaveraI will update microsoft compiler and test again
03:07:34FromDiscord<Yepoleb> Why not first figure out if everything is equally slow or it's just a single step
03:11:20FromDiscord<ringabout> Let me restart my computer.
03:13:40rockcaveraMicrosoft (R) C/C++ Optimizing Compiler Versão 19.34.31933 para x64
03:13:55rockcaveranow it's the same version
03:14:39FromDiscord<albassort> last question
03:14:40rockcaveranim c --mm:refc --cc:vcc -f test => 28980 lines; 7.084s; 30.289MiB peakmem;
03:14:56rockcaveraare the problem is not the version
03:15:00FromDiscord<albassort> how do i insert an array into a database
03:15:06FromDiscord<albassort> do i need to format it?
03:15:15FromDiscord<albassort> like { "abc", "xyz"}
03:17:34FromDiscord<albassort> (like how you'd do in normal sql)
03:17:37FromDiscord<ringabout> In reply to @rockcavera "are the problem is": Yeah, thank you! Not like i'm going to use vcc anyway. After fixing the vcc regression on the devel, I'm going to set up a vcc CI in case of regressions again.
03:17:46FromDiscord<ringabout> (edit) "In reply to @rockcavera "are the problem is": Yeah, thank you! Not like i'm going to use vcc anyway. After fixing the vcc regression on the devel, I'm going to set up a ... vcc" added "simple"
03:21:20*arkurious quit (Quit: Leaving)
03:22:05FromDiscord<demotomohiro> IIRC, when Nim calls cl.exe, Nim runs vccexe.exe and it finds the path to vcvarsall and call it to setup environment variable to run cl.exe.↵That happens everytime Nim compiles .c files.↵That can slow down compile time when `--cc:vcc`?
03:22:58FromDiscord<ringabout> Probably cl.exe is not in my envs.
03:24:34FromDiscord<Yepoleb> In reply to @albassort "how do i insert": You probably need to generate an sql statement with the right amount of placeholders in the array
03:25:10FromDiscord<albassort> thats my breaking point where i just use json
03:25:39rockcaverademotomohiro, probably. As the search process can be time-consuming
03:27:47rockcaveraringabout, just remembered. My microsoft compiler is on the ssd and my gcc and clang compiler are on the hd. So my comparison might not be fair.
03:28:55FromDiscord<sOkam!> Is there a way to exit a template (like a return) but not exit the function where the template is called?
03:29:31FromDiscord<Elegantbeef> put a block in
03:29:33FromDiscord<ringabout> In reply to @rockcavera "<@658563905425244160>, just remembered. My": I see.
03:29:51FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gNF
03:29:55FromDiscord<Rika> In reply to @Elegantbeef "put a block in": What he implies is basically wrap the whole template body in a block and break that
03:30:00FromDiscord<sOkam!> oh handy, ty
03:30:03FromDiscord<Rika> Use the break like return
03:30:17FromDiscord<sOkam!> can you use break without block?
03:31:18FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4gNG
03:32:00FromDiscord<huantian> No you need a block
03:36:02rockcaverai moved gcc to ssd and there was no difference in compile time
03:37:11NimEventerNew post on r/nim by AetopiaMC: Any form of wildcard string pattern matching?, see https://reddit.com/r/nim/comments/z42tlw/any_form_of_wildcard_string_pattern_matching/
04:37:07*jkl quit (Quit: Gone.)
04:43:01*jkl joined #nim
04:45:16*jkl quit (Client Quit)
04:46:10*jkl joined #nim
04:46:36FromDiscord<albassort> can i iterate over a hashet
04:46:38FromDiscord<albassort> (edit) "hashet" => "hashset"
04:47:34FromDiscord<ChocolettePalette> Technically you can
04:48:20FromDiscord<albassort> is it slow or something
04:48:33FromDiscord<albassort> i see it here in the docs
04:49:38FromDiscord<Elegantbeef> It's slower than not 😄
04:50:42FromDiscord<albassort> so, if i add a non-unique item to a set, it wont be added
04:50:49FromDiscord<albassort> and thats faster than checking, right
04:51:18FromDiscord<Elegantbeef> Well it's faster than iterating a specific sized array
04:51:35FromDiscord<albassort> yea
04:51:38FromDiscord<albassort> alright
04:51:52FromDiscord<Elegantbeef> Checking if a value is in a hashset is `O(1)` but `O(N)` can be faster if it's smaller
05:19:25FromDiscord<sOkam!> Can you guide me in understanding the difference, in practical terms, between using a method and a proc?↵I've read the documentation like ten mill times, and I still don't understand what they do↵Are they implied behavior, based on the previous {.base.} method, or what exactly do they do exactly?
05:19:45FromDiscord<sOkam!> (edit) removed "exactly"
05:19:56FromDiscord<Elegantbeef> What method to call is reasoned at runtime, what procedure to call is reasoned at compile time
05:20:31FromDiscord<Elegantbeef> A base method introduces the behaviour that can be overridden based off the type
05:20:44FromDiscord<Elegantbeef> Methods are just procedures which are dispatched at runtime
05:20:46FromDiscord<sOkam!> dinamic vs static dispatch, yeah. but... what does that do in the practical world of applying that idea?
05:21:03FromDiscord<Elegantbeef> Base tells the compiler which symbol is overloadable
05:21:13FromDiscord<Elegantbeef> Without methods it doesnt know which symbol is overloaded
05:21:18FromDiscord<Elegantbeef> without base i mean
05:21:25FromDiscord<sOkam!> what does that mean?
05:21:30FromDiscord<Elegantbeef> For all it knows you're introducing a new method
05:21:51FromDiscord<Elegantbeef> which symbol is overridden\
05:22:18FromDiscord<Elegantbeef> Base is pretty much just "Hey for a call to this method unroll it into runtime dispatch, thanks"
05:22:34FromDiscord<sOkam!> i still don't understand what that means in practical terms
05:22:41FromDiscord<voidwalker> speaking of hashsets.. is there really no library that deals with turning data into dictionaries (symbol compressing), in a generic way ? Like turning a seq[string] into a deduplicated seq[string], and storing the indices of the corresponding string ? Could this be achieved with a macro maybe, or a dedicated data type
05:22:46FromDiscord<Elegantbeef> What's your actual question?
05:23:33FromDiscord<Elegantbeef> There is no reason that a procedure or data type couldnt do that
05:23:46FromDiscord<Elegantbeef> I dont really know what you mean by "storing the indices of the corresponding string"
05:23:51FromDiscord<sOkam!> In reply to @Elegantbeef "What's your actual question?": understanding methods, without namedropping and assumptions of pre-existing knowledge, basically. aka ELI5 version of the explanation, because it seems that I have some big knowledge gaps on all of this
05:23:56FromDiscord<Elegantbeef> Do you mean deduplicating without copying?
05:24:24FromDiscord<Elegantbeef> Methods allow you to override behaviour of a procedure call based off type, this allows you to design systems that later are expanded
05:24:38FromDiscord<Elegantbeef> I personally use OOP + Methods for my GUI
05:24:45FromDiscord<sOkam!> whats different between doing that with a proc, then?
05:24:55FromDiscord<sOkam!> since procs can take the base type
05:25:00FromDiscord<Elegantbeef> Procedures are statically dispatched so you cannot override the behaviourr
05:25:20FromDiscord<Elegantbeef> You'd need to dispatch inside a base procedure to your type with a `if x of MySubType`
05:25:38FromDiscord<Elegantbeef> Methods convert to the subtype when needed and call the corresponding method
05:25:43FromDiscord<Elegantbeef> https://github.com/beef331/truss3d/tree/master/src/truss3D/guicomponents look at these components
05:25:53FromDiscord<Elegantbeef> I can add new ones without having to change anything before me
05:26:07FromDiscord<sOkam!> yeah, i have a methods example in the code im trying to understand too. that doesn't mean i understand it (which is why i asked)
05:26:10FromDiscord<voidwalker> @ElegantBeef I have some data that is potentially very repetitive. I want to store it as a dictionary based structure, so so instead of @["aaa", "bbb", "bbb", "bbb", "ccc"] I'd have just @[0,1,1,1,2] corresponding to @["aaa", "bbb", "ccc"]
05:26:15FromDiscord<Elegantbeef> I make a new component add a `update` and `draw` method and go to town
05:26:38FromDiscord<sOkam!> couldn't you just create a proc that takes the new object ttype instead?
05:26:40FromDiscord<sOkam!> why methods?
05:26:46FromDiscord<sOkam!> why not just overloading a proc?
05:26:57FromDiscord<Elegantbeef> Cause you want to change the logic based off runtime data and want to store different types inside the same container
05:27:23FromDiscord<Elegantbeef> OOP allows you to store heterogenous types together, which means you need some type of runtime information to call your specific type
05:27:28FromDiscord<Elegantbeef> Which is what methods do
05:27:35FromDiscord<sOkam!> but if the logic is defined by the type, is that not exacly like overloading a proc with the higher type?
05:27:46FromDiscord<Elegantbeef> They use runtime type information to convert to the correct type and call the corresponding procedure
05:27:57FromDiscord<Elegantbeef> No cause you cannot use proc dispatch on inheriting types like methods
05:28:19FromDiscord<sOkam!> i don't know what proc dispatch is
05:28:38FromDiscord<Elegantbeef> Shit
05:28:40FromDiscord<sOkam!> i understand the "compile time" vs "runtime"... but i don't understand what dispatch is even knowing that
05:28:41FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gNY
05:28:46FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gNZ
05:28:53FromDiscord<Elegantbeef> dispatch is literally just choosing a procedure
05:29:07FromDiscord<Elegantbeef> runtime dispatch is using information at runtime to chose the procedure
05:29:27FromDiscord<Elegantbeef> static dispatch is using static information to make a choice
05:29:37FromDiscord<Elegantbeef> Run the code i provided and you will see the reason you cannot use procs
05:30:01FromDiscord<Elegantbeef> Whoops `x.doThing()`
05:30:34FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gO0
05:30:43FromDiscord<Elegantbeef> This does what one expects
05:30:44FromDiscord<Elegantbeef> Which is what a method is for
05:30:55FromDiscord<Elegantbeef> Methods in Nim presently are not too far off the above,
05:35:06FromDiscord<sOkam!> so it thinks that the type is the base in all cases?
05:38:59FromDiscord<Elegantbeef> Well yea
05:39:01FromDiscord<sOkam!> well, this is handy. i sure was doing the type checking inside procs up till now↵tysm for the simplified example. now it makes sense↵I really thought that the first example would have done the correct thing 😔
05:39:03FromDiscord<Elegantbeef> Cause that's what type they are
05:39:20FromDiscord<Elegantbeef> You cannot have a collection of a type that isnt homogenous
05:39:35FromDiscord<sOkam!> how do you define a base method correctly?↵or rather, what exactly is a base method in this context?
05:39:40FromDiscord<Elegantbeef> So all of them get converted to A
05:39:56FromDiscord<sOkam!> In reply to @Elegantbeef "You cannot have a": i see
05:39:58FromDiscord<Elegantbeef> `method doThing(a: A) {.base.} = echo "Unimplemented"`
05:40:17FromDiscord<Elegantbeef> Or assert false or whatever as the body
05:40:26FromDiscord<Elegantbeef> If you want a default behaviour you could implement it there
05:40:36FromDiscord<sOkam!> can you use discard on the base?
05:40:58FromDiscord<sOkam!> the lsp seems to be complaining, and then the compiler is throwing warnings that baseless methods are deprecated
05:41:08FromDiscord<Elegantbeef> You can use discard
05:41:17FromDiscord<Elegantbeef> Yes there is a bug with methods and nimsuggest presently
05:41:37FromDiscord<Elegantbeef> Generally though you want some type of information that something is implemented ime
05:41:46FromDiscord<Elegantbeef> unimplemented rather
05:44:07FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4gO2
05:44:08FromDiscord<sOkam!> any clue why?
05:44:24FromDiscord<Elegantbeef> The compiler or nimsuggest?
05:44:29FromDiscord<sOkam!> compiler
05:44:50FromDiscord<Elegantbeef> Full code?
05:45:03FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4gO3
05:45:12FromDiscord<sOkam!> In reply to @Elegantbeef "Full code?": its from nico
05:45:19FromDiscord<sOkam!> nico's platformer example
05:45:22*vicecea quit (Remote host closed the connection)
05:45:26FromDiscord<Elegantbeef> is `Obj` the base type?
05:45:37FromDiscord<sOkam!> https://github.com/ftsf/nico/blob/main/examples/platformer.nim
05:45:46FromDiscord<sOkam!> yep, unless im misunderstanding
05:46:41FromDiscord<Elegantbeef> Seems to be a bug
05:47:22FromDiscord<Elegantbeef> Oh actually it's not
05:48:15FromDiscord<Elegantbeef> Methods only dispatch on the first parameter
05:48:16FromDiscord<Elegantbeef> so `a, b: Floater` is defining a new method
05:48:39FromDiscord<sOkam!> oh
05:49:01FromDiscord<Elegantbeef> Multi methods existed but are now deprecated and behind a flag
05:50:10FromDiscord<sOkam!> what should i do to fix it?
05:50:26FromDiscord<sOkam!> im not understanding how to deal with the issue, i believe
05:50:36FromDiscord<Elegantbeef> Change them to procs
05:50:53FromDiscord<sOkam!> but isn't that going to break the behavior, like you explained?
05:51:18FromDiscord<Elegantbeef> Well just leave them is all i can say
05:51:48FromDiscord<sOkam!> i mean, that's not an option. the idea is to fix the issues to be able to use the code, not get it deprected and eventually broken
05:51:49FromDiscord<Elegantbeef> The methods should not be called properly without multimethods enabled
05:53:01FromDiscord<Elegantbeef> Well you're not supposed to be able to have a `collide(Bullet, Crate)` and a `collide(Crate, Bullet)`
05:53:12FromDiscord<Elegantbeef> You should have a `collide(Bullet, Obj)`
05:53:53FromDiscord<sOkam!> but won't they all resolve to obj if i do it with procs?
05:54:11FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gO5
05:54:16FromDiscord<Elegantbeef> You can still use methods
05:54:21FromDiscord<Elegantbeef> But only for the first parameter
05:55:17FromDiscord<sOkam!> `floor.collide(player)` feels wrong 😔
05:55:41FromDiscord<Elegantbeef> I'd argue this code is written relatively odd
05:55:45FromDiscord<sOkam!> `player.collide(floor)` is what makes sense, imo
05:56:00FromDiscord<Elegantbeef> You can write it that way
05:56:06FromDiscord<sOkam!> In reply to @Elegantbeef "I'd argue this code": it is, agreed. im just trying to figure out how to un-odd it, basically
05:56:27FromDiscord<Elegantbeef> Well i'd give each entity a collider then just check the collision and with that collider store entity type
05:56:50FromDiscord<sOkam!> In reply to @Elegantbeef "You can write it": but if obj is the first type, then you cannot have a base like the second, because the second is always going to resolve to obj
05:57:20FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gO6
05:57:26FromDiscord<Elegantbeef> Yes but you can manually check what the second is
05:57:30FromDiscord<Elegantbeef> like i've shown
05:57:46FromDiscord<Elegantbeef> Impbox is using multi methods here afaict
05:57:47*mahlon quit (Remote host closed the connection)
05:57:47FromDiscord<sOkam!> i guess, yeah
05:58:18FromDiscord<Elegantbeef> Does this run properly without the multimethods flag?
05:58:31FromDiscord<Elegantbeef> I forsee falling through things or missing collisions
05:59:09FromDiscord<sOkam!> i don't think it does
05:59:35FromDiscord<sOkam!> some things look broken to me, behavior that should be there its not there. but i dont understand the example well, to be honest, so cannot really tell
05:59:36FromDiscord<Elegantbeef> Compile with `--multimethods:on` and see if it behaves the same
06:00:04FromDiscord<Elegantbeef> Cause this is very much multi methods given the example matches it to a tee https://nim-lang.org/docs/manual.html#methods-multiminusmethods
06:00:50FromDiscord<Elegantbeef> In Nim methods only the first parameter is used for dynamic dispatch, this makes the code much easier to reason
06:00:50FromDiscord<Elegantbeef> You do not need to reason all parameters to figure out what's going on
06:01:37FromDiscord<sOkam!> oh damn, it changed immensely
06:01:44FromDiscord<sOkam!> now there is even a gameover screen 🙈
06:02:47FromDiscord<Elegantbeef> Yep it relies on multimethods which have been deprecated
06:02:47FromDiscord<Elegantbeef> So to work properly it needs to be redesigned
06:05:16FromDiscord<sOkam!> is there a better way to check for collision types, that doesn't involve having a separate function just to find the type? 🤔
06:06:24FromDiscord<Elegantbeef> I gave you a few different methods
06:06:38FromDiscord<Elegantbeef> manually dispatch based off the second parameters type
06:06:57FromDiscord<Elegantbeef> Use colliders and store the type of the entity so it's type agnostic
06:07:07FromDiscord<Elegantbeef> leave multimethods on even though it's deprecated
06:07:24FromDiscord<sOkam!> why were they deprecated, btw?
06:07:32FromDiscord<Elegantbeef> They make code hard to reason
06:07:45FromDiscord<sOkam!> i see
06:07:53FromDiscord<ringabout> https://nitter.snopyta.org/elucian_moise
06:07:58FromDiscord<sOkam!> i'd agree with that, so will try a different approach
06:08:02FromDiscord<Elegantbeef> Like you have `collide(a, b)` but you go through like 30 different procedures
06:08:16FromDiscord<ringabout> (edit) "https://nitter.snopyta.org/elucian_moise" => "https://nitter.snopyta.org/elucian_moise/status/1595513051846959113#m"
06:09:22FromDiscord<Elegantbeef> > You can define constants using "const" or "let" keywords.
06:10:26FromDiscord<Elegantbeef> Someone with a twitter count should correct that 😄
06:11:21FromDiscord<ringabout> Yeah, I cannot access Twitter either.
06:11:38pbotfullertonIs there a reason why c2nim and nimterop don't run C header files through the compiler's preprocessor before reading them to simplify parsing? I think it's fair to assume that if you're interfacing with C you have a C compiler available
06:11:52FromDiscord<Elegantbeef> c2nim is simple
06:11:56FromDiscord<Elegantbeef> That's why
06:12:01FromDiscord<Elegantbeef> futhark does what you want
06:12:17FromDiscord<Elegantbeef> Personally i use `gcc -E` then run c2nim on that after removing the noise
06:12:38pbotfullertonYeah exactly that
06:12:53FromDiscord<haxscramper> because macros might need to be wrapped
06:13:05FromDiscord<haxscramper> because running preprocessor would require working compilation configuration
06:13:25FromDiscord<Elegantbeef> In many cases you can just use `gcc -E` though
06:13:40FromDiscord<haxscramper> because macros sometimes can generate huge amount of garbage boilerplate
06:14:02FromDiscord<Elegantbeef> The entire API also can be written in macros
06:14:05FromDiscord<haxscramper> In reply to @Elegantbeef "In many cases you": there might be missing `#include` files
06:14:58FromDiscord<haxscramper> and most importantly, running preprocessor results in a full translation unit instead of a single file
06:15:17FromDiscord<haxscramper> so you can have like 30 wrappers for `std::vector` because other headers included it
06:15:40FromDiscord<Elegantbeef> All 2 people using c2nim on C++ are really shaking in their boots 😄
06:15:46FromDiscord<Elegantbeef> Cmon hax you walked into that joke
06:16:18FromDiscord<haxscramper> c2nim does not have this problem
06:17:05FromDiscord<haxscramper> In reply to @Elegantbeef "*Cmon hax you walked": now I only need to understand what the joke is
06:17:24FromDiscord<Elegantbeef> Implying people would use C2nim with C++
06:18:31FromDiscord<haxscramper> https://forum.nim-lang.org/t/8020
06:19:12FromDiscord<haxscramper> btw, `gcc -E` is "That's a bad advice, better learn how c2nim actually works..."
06:19:32FromDiscord<haxscramper> so instead you just re-write all C defines in `#def` directives
06:19:45FromDiscord<haxscramper> oh, don't forget to edit your header definitions or search them for any replacements
06:19:51FromDiscord<haxscramper> (edit) "replacements" => "macro calls"
06:19:52FromDiscord<Elegantbeef> Yea i had a wasm runtime that wrote the entire api using macros so i dont know what to do that in that case
06:19:54FromDiscord<haxscramper> easy, right
06:20:48FromDiscord<Elegantbeef> https://github.com/wasmerio/wasmer/blob/master/lib/c-api/tests/wasm-c-api/include/wasm.h#L76-L90
06:21:52FromDiscord<Elegantbeef> https://github.com/wasmerio/wasmer/blob/master/lib/c-api/tests/wasm-c-api/include/wasm.h#L338-L365↵The shit is bonkers, i have no idea what the 'proper way' is for c2nim here
06:24:11FromDiscord<Elegantbeef> Unironically the best and my most favourable results have been `gcc -E` -\> `c2nim`
06:26:06FromDiscord<haxscramper> oh it's easy
06:26:16FromDiscord<haxscramper> and then get
06:26:17FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=4gOb
06:26:22FromDiscord<haxscramper> /tmp/a.cpp(15, 1) Error: ↵Exception: c2nim exited with 1↵[tty 3], line 1: c2nim a.cpp
06:26:30FromDiscord<haxscramper> what else can it possibly be?
06:26:37FromDiscord<haxscramper> just learn how c2nim actually works
06:26:41FromDiscord<haxscramper> it's easy
06:27:28FromDiscord<Elegantbeef> clearly you meant `a.h` and that'll solve it!
06:27:28FromDiscord<Elegantbeef> 😛
06:28:19FromDiscord<haxscramper> or build c2nim from source
06:28:27FromDiscord<haxscramper> and then it does not even crash!
06:28:37FromDiscord<haxscramper> you get this wonderful piece of high-quality wrapper
06:28:44FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=4gOc
06:30:25FromDiscord<Elegantbeef> Anyway this is enough commentary for me 😄
06:31:00FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=4gOd
06:31:19FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=4gOe
06:31:24FromDiscord<Elegantbeef> Hax save your sanity i gave up on that runtime for other reasons 😄
06:31:43FromDiscord<haxscramper> wtf is `own` I don't know, but you should be able to figure out, just "learn how c2nim works" it's easy right
06:32:31FromDiscord<Elegantbeef> Funnily iirc futhark also had issues with `own`
06:32:33FromDiscord<haxscramper> as in "admitting difficulty of writing truly automated C++ wrapper generator" -- pffft that's for idiots,
06:32:39FromDiscord<haxscramper> just learn how c2nim works
06:32:56FromDiscord<Elegantbeef> libclang actually also gives incorrect information with that macro
06:33:19FromDiscord<Elegantbeef> https://github.com/PMunch/futhark/issues/44
06:33:34FromDiscord<haxscramper> well that just proves that c2nim >= futhark
06:36:54FromDiscord<ieltan> I looked into how they wrap wasmer in other languages and tbh it looks like quite the gargantuan effort
06:37:10FromDiscord<Elegantbeef> It very much is
06:37:38FromDiscord<Elegantbeef> I much preferred wrapping wasm3, and it also had all the functionality i needed, wasmer didnt even let you query functions in a wasm module from the C-api
06:37:51FromDiscord<Elegantbeef> In wasmer's case i could probably have use nbindgen but no clue
06:37:53FromDiscord<haxscramper> https://forum.nim-lang.org/t/8451 can't get enough of this thread
06:38:05FromDiscord<haxscramper> "c2nim is conceptually the best" way my ass
06:38:07FromDiscord<ieltan> I think I saw an issue not long ago about wrapping wasmer in Nim
06:38:11FromDiscord<ieltan> Lemme fetch it
06:38:52FromDiscord<Elegantbeef> I mean i honestly prefer the c2nim result, but less human intervention would be ideal
06:38:57FromDiscord<ieltan> https://github.com/wasmerio/wasmer/issues/2120
06:38:57FromDiscord<Elegantbeef> I've said it multiple times the futhark files are way too noisey for me to like
06:39:24FromDiscord<Elegantbeef> Yea the recent post is now using my wasm3 bindings afaik
06:39:30FromDiscord<Elegantbeef> It's a 200 loc binding file, it's so simple
06:39:47FromDiscord<Elegantbeef> https://github.com/beef331/wasm3/blob/master/src/wasm3/wasm3c.nim
06:39:59FromDiscord<Elegantbeef> Like it's crazy simple compared to the wasmer code
06:40:10FromDiscord<ieltan> Ye I've seen it 😉
06:40:20FromDiscord<Elegantbeef> Ah
06:40:44FromDiscord<Elegantbeef> The wamer code was made by rust programmers who really just wanted it to be over, i dont blame them but ugh is it ever a thing
06:41:13FromDiscord<ieltan> They're are rebuilding the world, can't blame them lol
06:41:46FromDiscord<ieltan> Well, so the saying goes
06:43:30FromDiscord<Elegantbeef> Goes how
06:43:45*kenran joined #nim
06:44:31*kenran quit (Remote host closed the connection)
06:46:04FromDiscord<ieltan> It goes on how rustacians have a duty to do everything in rust to perfection
06:46:13FromDiscord<Elegantbeef> Ah
06:46:35FromDiscord<Elegantbeef> Is their JIT escape memory safe? 😛
06:47:25FromDiscord<ieltan> Surely not without 'some' amounts of `unsafe`
06:47:53FromDiscord<ieltan> But it's still safe to say that `unsafe` is safe
06:47:54FromDiscord<ieltan> 😅
06:48:22FromDiscord<Elegantbeef> Hey if JIT compiled code can escape the sandbox, but it's memory safe... it's fine right?
06:48:51FromDiscord<Elegantbeef> I'm not saying their sandbox can be escaped, i'm just implying that JIT makes it harder to sandbox well
06:49:51FromDiscord<ieltan> Hmm that's actually something I wonder too
06:51:35*neceve_ quit (Quit: ZNC - https://znc.in)
06:51:52FromDiscord<ieltan> My take is that any code escaping the sandbox could be considered arbitrary attack vectors, you can't guarantee 'memory safety' at this point.
06:53:27*neceve joined #nim
06:59:17FromDiscord<ChocolettePalette> a comment on SAFE doubly linked list realization in rust
06:59:32FromDiscord<ieltan> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1045592641858965534): My take is that any code escaping the sandbox could be considered attack vectors (exploited by malware) , you can't guarantee 'memory safety' at this point.
07:00:56FromDiscord<sOkam!> What happens if a base method is empty and you call it?↵https://github.com/ftsf/nico/blob/bdbe4f48ca8d2d58458e76897cf883a255479cf2/examples/platformer.nim#L352-L353↵What is this line remapping to instead?
07:01:25FromDiscord<sOkam!> _(btw, already noticing why they got deprecated, i cannot even untangle this because its so hard to reason about)_
07:01:31FromDiscord<Elegantbeef> Nothing happens if it doesnt call it
07:01:53FromDiscord<sOkam!> yeah, but that thing is just inverting the order
07:02:13FromDiscord<sOkam!> but there is no other reversed collision check, afaik (unless im misunderstanding)
07:06:50*neceve quit (Quit: ZNC - https://znc.in)
07:10:08*neceve joined #nim
07:30:23NimEventerNew thread by halloleo: How to create a mutable object prefrably without ref, see https://forum.nim-lang.org/t/9651
07:31:13*PMunch joined #nim
07:31:20*rockcavera quit (Remote host closed the connection)
07:57:48*dtomato4 quit (Ping timeout: 264 seconds)
08:13:45*dtomato4 joined #nim
08:41:55*wallabra_ joined #nim
08:44:03*wallabra quit (Ping timeout: 265 seconds)
08:44:07*wallabra_ is now known as wallabra
09:42:20FromDiscord<dlesnoff> In reply to @Elegantbeef "Personally it's Sentinel -\>": You go first for Sentinel, then Option and finally Exception but prefer Exception ?↵What is Sentinel ?
09:48:07PMunchLike returning `null` or some other special value indicating error
09:48:44PMunchFor example `find` returns the position of a substring in the string, or -1 if no match is found
09:48:52PMunch-1 there is a sentinel value
10:18:25FromDiscord<Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4gOS
10:18:37FromDiscord<Jessa> (edit) "https://play.nim-lang.org/#ix=4gOS" => "https://play.nim-lang.org/#ix=4gOT"
10:24:31PMunch`export module`
10:24:34PMunchIn file1
10:24:53PMunchAnd your small example wouldn't work because you don't export sayHello ;)
10:27:11*vicecea joined #nim
10:33:48*jmdaemon quit (Ping timeout: 264 seconds)
10:38:48FromDiscord<Jessa> ah i see
10:39:06FromDiscord<Jessa> > And your small example wouldn't work because you don't export sayHello ;)↵right, yeah, but you get the point x3
10:41:17FromDiscord<Jessa> thanks thoughhh
10:41:52*neceve quit (Quit: ZNC - https://znc.in)
10:45:45*dtomato4 quit (Quit: The Lounge - https://thelounge.chat)
10:46:18*dnh joined #nim
10:46:24*dtomato4 joined #nim
10:48:13*neceve joined #nim
10:52:03*neceve quit (Client Quit)
10:57:56*neceve joined #nim
11:01:30FromDiscord<haywireSSC> how do I do implicit type conversion?
11:17:08FromDiscord<ali> Is there a recommended linter for Nim (mostly interested in style)
11:31:11FromDiscord<Rika> There’s pretty much only one and an extended version of that single one
11:34:52PMunch@haywireSSC, write a `converter`
11:42:09FromDiscord<ChocolettePalette> Is it good or bad or not good and not bad?↵(@Rika)
11:42:46FromDiscord<Rika> I’d say they’re both pretty bad, the extended version is good that it extends but still relies on the pretty bad original so
11:43:03FromDiscord<ChocolettePalette> Ah!
12:10:27*jjido joined #nim
12:12:22*jjido quit (Client Quit)
12:15:44NimEventerNew thread by nimian: Best way for ipc between a rust app and Nim app?, see https://forum.nim-lang.org/t/9652
12:21:44NimEventerNew thread by sls1005: `cast` broken?, see https://forum.nim-lang.org/t/9653
12:37:21FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=4gPl
12:38:41FromDiscord<hmmm> error messages too confusing, truncate and simplify, assegnee: @ElegantBeef 🥳
12:46:00PMunchYou used a macro which expanded to that block, and you try to pass it to something which needs a string, but that block returns a seq[string]
12:52:34FromDiscord<hmmm> hmm I don't know about that, but creating a new var and moving the computation there fixed it apparently 🥤
12:54:30*jjido joined #nim
13:12:42FromDiscord<vestel> Why do all macro arguments turns into NimNode?
13:12:50FromDiscord<vestel> How can I pass object as macro argument?
13:16:00FromDiscord<ChocolettePalette> Macros operates on code at compile time
13:20:30FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4gPA
13:20:50FromDiscord<vestel> sent a code paste, see https://play.nim-lang.org/#ix=4gPB
13:26:23FromDiscord<Jessa> making a REPL interpreter for windows in nim https://media.discordapp.net/attachments/371759389889003532/1045691921965776916/nim_repl.mp4
13:26:47FromDiscord<ChocolettePalette> Why?
13:27:07FromDiscord<Jessa> because i couldn't find any module that did it while also being windows compatible
13:27:26FromDiscord<Jessa> termios' repl is linux only
13:28:17FromDiscord<yrashk> Is there a way to change compiler's `buildDll` setting for a project?
13:34:48*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
14:20:55*rockcavera joined #nim
14:32:30FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4gQ4
14:33:56FromDiscord<Rika> Not really
14:37:18FromDiscord<sOkam!> kk
14:41:31*kenran joined #nim
14:42:18*kenran quit (Remote host closed the connection)
14:43:07*arkurious joined #nim
14:53:15*PMunch quit (Quit: Leaving)
15:08:00*neceve quit (Quit: ZNC - https://znc.in)
15:09:55*neceve joined #nim
15:23:11FromDiscord<Mr_Miagi> Hey Guys
15:23:36FromDiscord<Mr_Miagi> sent a code paste, see https://play.nim-lang.org/#ix=4gQp
15:32:18*qwr quit (Quit: tuumauuendus...)
15:36:19FromDiscord<Mr_Miagi> 😢
15:38:07*qwr joined #nim
15:45:18FromDiscord<Phil> I mean, it should, but I'd honestly recommend using `std/strformat` for readability
15:45:50FromDiscord<Mr_Miagi> sent a code paste, see https://play.nim-lang.org/#ix=4gQw
15:45:55FromDiscord<Phil> Or rather, it would equaty to `http://user:password@hostName:httpPort/?query=somestuff
15:46:00FromDiscord<Phil> (edit) "`http://user:password@hostName:httpPort/?query=somestuff" => "`http://user:password@hostName:httpPort/?query=somestuff`"
15:46:41FromDiscord<Mr_Miagi> sent a code paste, see https://play.nim-lang.org/#ix=4gQx
15:46:42FromDiscord<Phil> (edit) "equaty" => "equate"
15:46:42FromDiscord<Mr_Miagi> it doesnt take user/password
15:46:47FromDiscord<Mr_Miagi> just uses hostname
15:47:11FromDiscord<Phil> I can't really tell you what db_clickhouse is
15:47:31FromDiscord<Phil> If that's somehow std/db_postgres or the like then your open method is missing a parameter
15:47:41FromDiscord<Mr_Miagi> so im modifying https://github.com/leonardoce/nim-clickhouse/blob/master/src/db_clickhouse.nim to take username/password
15:47:48FromDiscord<Mr_Miagi> yes its a db
15:48:00FromDiscord<Mr_Miagi> what param am i missing
15:49:03FromDiscord<enthus1ast> looks like uri could fit
15:50:07FromDiscord<Mr_Miagi> where
15:50:41FromDiscord<Phil> In reply to @Mr_Miagi "what param am i": That'd be the case if you were using db_sqlite, which I'm not entirely sure. But the open method there takes 4 string parameters (as does any std/db\_\ module)
15:50:55FromDiscord<Phil> (edit) "In reply to @Mr_Miagi "what param am i": That'd be the case if you were using db_sqlite, which I'm not entirely sure. But the open method there takes 4 string parameters (as does ... any" added "it in"
15:51:10FromDiscord<Phil> (edit) "db_sqlite," => "db_sqlite/postgres etc.,"
15:51:21FromDiscord<jos> is there a nice way to specify the type of a seq literal
15:51:22FromDiscord<jos> i.e.
15:51:30FromDiscord<enthus1ast> imho he wants to patch this https://github.com/leonardoce/nim-clickhouse/blob/21b67967617e885d51fbd8439365796847033e89/src/db_clickhouse.nim#L112↵to also take username and password @Phil
15:51:39FromDiscord<jos> @[1, 2, 3] but i want 1, 2, 3 to be interpreted as u8's
15:51:42FromDiscord<Mr_Miagi> In reply to @enthus1ast "imho he wants to": yes thats exactly what i need to do
15:51:53FromDiscord<Phil> Ahhh, that module brings its own open method
15:52:23FromDiscord<jos> or my actual case is more like
15:52:28FromDiscord<enthus1ast> so instead of manually generating the string, use a uri object fill it , and let it generate a string for oyu
15:52:30FromDiscord<enthus1ast> xou
15:52:31FromDiscord<enthus1ast> .,.
15:52:34FromDiscord<enthus1ast> you
15:52:39FromDiscord<jos> @[ExprCall(), ExprCall(), ExprCall()], but i want my seq to be of the subtype Expression
15:52:53FromDiscord<Phil> In reply to @jos "@[1, 2, 3] but": Best I can do you is `let x: seq[uint8] = @[1,2,3]`
15:53:01FromDiscord<Phil> assuming uint8 is actually a type, I didn't try
15:53:04FromDiscord<jos> what if it's a literal being passed in-place?
15:53:08FromDiscord<Phil> But you get the gist, define via type annotation
15:53:15FromDiscord<enthus1ast> 1'u8
15:53:17FromDiscord<Mr_Miagi> In reply to @enthus1ast "so instead of manually": hmm can you show me an example what you mean?
15:53:24FromDiscord<jos> https://media.discordapp.net/attachments/371759389889003532/1045728921452298260/image.png
15:53:30FromDiscord<enthus1ast> https://nim-lang.org/docs/uri.html
15:53:40FromDiscord<enthus1ast> https://nim-lang.org/docs/uri.html#Uri
15:53:43FromDiscord<jos> i can't figure out how to make it more concise than that
15:53:57FromDiscord<enthus1ast> set all the stuff (user password etc) then stringify it
15:54:32FromDiscord<Mr_Miagi> hmm
15:54:47FromDiscord<Phil> For conciseness I believe I'm the wrong person to ask for advice.↵I'd have pulled the expression you're casting into its own line
15:55:45FromDiscord<jos> ah
15:55:56FromDiscord<enthus1ast> since this is what you wanna do.↵When you add username to the old code, you must manually add "username\:password@host" etc, if you specify them
15:56:48FromDiscord<Mr_Miagi> In reply to @enthus1ast "since this is what": hmm so i did try that so would i add the uri to the old code or my script
15:58:38FromDiscord<enthus1ast> when you want to preserve the old behavior, add username and password as optional (or empty) parameters, in open, store them in the DbConn object then in "createQueryUrl" fill a uri object and stringify it
15:58:44FromDiscord<jos> what about any crates to generate a `==`operator that has deep value equality?
15:58:47FromDiscord<jos> libs 🙂
16:04:00FromDiscord<Mr_Miagi> In reply to @enthus1ast "when you want to": hmm still not certain how to do that
16:04:03FromDiscord<Mr_Miagi> sorry still new 😦
16:05:11FromDiscord<enthus1ast> `proc open(hostName: string, httpPort:int = 8123, username = "", password = ""): DbConn =`
16:06:34FromDiscord<Mr_Miagi> sent a code paste, see https://play.nim-lang.org/#ix=4gQB
16:06:55FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4gQC
16:08:19FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4gQD
16:08:57FromDiscord<enthus1ast> but if you do not care about backwards compatibility you can change the order of course
16:09:16FromDiscord<Mr_Miagi> sent a code paste, see https://play.nim-lang.org/#ix=4gQF
16:11:24FromDiscord<Mr_Miagi> is that correct @enthus1ast
16:11:39FromDiscord<enthus1ast> yes
16:11:56FromDiscord<enthus1ast> yes
16:11:57FromDiscord<enthus1ast> \:)
16:12:13FromDiscord<enthus1ast> its ugly and also wrong
16:12:24FromDiscord<Mr_Miagi> lol
16:12:40FromDiscord<Mr_Miagi> sent a code paste, see https://play.nim-lang.org/#ix=4gQG
16:12:51FromDiscord<enthus1ast> yeah
16:13:00FromDiscord<enthus1ast> the query is missing
16:13:53FromDiscord<Mr_Miagi> sent a code paste, see https://play.nim-lang.org/#ix=4gQH
16:14:06FromDiscord<enthus1ast> https://nim-lang.org/docs/uri.html#Uri
16:14:15FromDiscord<enthus1ast> its called port
16:16:40FromDiscord<Mr_Miagi> hmm i see let me play a bit
16:19:18FromDiscord<Mr_Miagi> thanks!!
16:24:04FromDiscord<enthus1ast> another thing to consider is, that the uri already have fields for all the data, maybe you could just create the uri object in open and just store this in DbConn
16:24:05FromDiscord<yrashk> I wonder if it is possible to write a macro with an emit pragma that can be used at a top level?
16:24:18FromDiscord<enthus1ast> but i guess then you must change some other code as well
16:24:29FromDiscord<enthus1ast> but when it works its good \:)
16:33:58*pro joined #nim
16:34:04*pro left #nim (#nim)
16:58:32*jjido joined #nim
17:11:14*attah quit (Read error: Connection reset by peer)
17:13:27NimEventerNew thread by RodSteward: Import C and Nim keyword collisions, see https://forum.nim-lang.org/t/9654
17:14:42*attah joined #nim
17:21:01*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
17:34:59*dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
18:19:58*dnh joined #nim
18:28:39FromDiscord<hmmm> guyz what's the easy way to insert scripting in a gui program? I want something like cligen that uses my procs and works automagically 😦
18:29:13FromDiscord<yrashk> I am still trying to figure out a local development strategy. Let's say I have a nimble package `a` in development (on the filesystem) and a package `b` in development as well. I want to always rebuild `b` against the very latest version (whatever's on disk). Currently I just `nimble uninstall pkgname -i` and `nimble install` in `a` every time I change `a`. But this is rather tedious. I couldn't figure out what `nimble develop` does. Any s
18:29:30FromDiscord<jan0809> hey guys, is there a nice libusb wrapper
18:29:48FromDiscord<hmmm> what's libusb
18:30:23FromDiscord<jan0809> this https://libusb.info/
18:31:17*junaid_ joined #nim
18:32:35FromDiscord<hmmm> yea it's useful, jan you make it
18:33:46FromDiscord<hmmm> there is something in the package list https://media.discordapp.net/attachments/371759389889003532/1045769278135222433/Screenshot_2022-11-25_193323.jpg
18:34:51Amun-Rayrashk: do you have your own git server?
18:35:02FromDiscord<yrashk> In reply to @Amun-Ra "<@145563987772309504>: do you have": no
18:35:33Amun-Rabc nimble supports require "url"
18:36:00Amun-Raalthough I don't have a clue whether it recheck it every time you build
18:36:23FromDiscord<jan0809> In reply to @hmmm "there is something in": i c, but which one is the thing to go with
18:37:45Amun-Rayrashk: I recommend setting up your own gitea, btw
18:37:49FromDiscord<yrashk> this is just such a common case. I am developing a library, and I want to test it in a separate project (how would it work for any other external package depending on it)
18:38:18FromDiscord<yrashk> This doesn't make sense. I don't want to commit every change in package `a` and setup a git server. It doesn't make any more sense than `nimble uninstall/install`
18:38:29FromDiscord<yrashk> same amount of ceremony
18:38:45Amun-Raso always nimble install package you depend on after changes
18:39:11FromDiscord<yrashk> that's what I do but it's tedious and just makes it much harder to iterate.
18:39:46FromDiscord<yrashk> In Rust, for example (or Node.js, or Ruby, or whatever else) you can override package's location (`path = ...` or something to that tune)
18:39:56FromDiscord<yrashk> is there really no alternative with Nim/Nimble?
18:40:00Amun-Rahmm
18:40:06Amun-Ralet's me check that
18:41:06*junaid_ quit (Quit: leaving)
18:41:31*junaid_ joined #nim
18:43:43Amun-Rasadly requires does not work with local path nor file:// uri
18:44:05FromDiscord<vindaar> \again
18:44:08FromDiscord<vindaar> sent a long message, see http://ix.io/4gRf
18:44:18FromDiscord<yrashk> I figured it out:↵↵nimble develop -a:PATH/TO/DEP
18:44:23Amun-Rarequires "file:///tmp/testlib" results with "Error: 'hg' not in PATH." hmm
18:44:37Amun-Rayrashk: ah, nice
18:44:46FromDiscord<yrashk> I am on v0.14 and the above command worked for me, now it's always in sync with the dependency
18:56:29FromDiscord<vindaar> but this has to be run from the package that depends on the one you are currently developing, no?
18:56:57FromDiscord<vindaar> so developing FOO, in BAR that uses FOO you call `nimble develop --path:X` ?
18:58:34*junaid_ quit (Remote host closed the connection)
18:59:25FromDiscord<yrashk> yes.
19:04:43FromDiscord<yrashk> Is std/httpclient known not to work from within NimScript? causes a segfault for me
19:13:50NimEventerNew thread by bet3lgeuse: Choosing Nim out of a crowded market for systems programming languages , see https://forum.nim-lang.org/t/9655
19:32:19FromDiscord<guttural666> web noob here, I want to get some information out of a website that doesn't offer an API or anything, was thinking about doing the equivalent of curl in nim, then regexing my way to the target data like a complete caveman, any advice on how to do this better maybe? 😄
19:37:06FromDiscord<hotdog> In reply to @guttural666 "web noob here, I": Parse the html and use something like https://github.com/GULPF/nimquery
19:37:15FromDiscord<hotdog> Depending on what the data is
19:38:11FromDiscord<guttural666> In reply to @hotdog "Parse the html and": thanks gonna bookmark this for further reference
19:38:32FromDiscord<guttural666> but there's not really any way around parsing et al right
19:39:08FromDiscord<hotdog> In reply to @guttural666 "but there's not really": Depends on the source really
19:39:30FromDiscord<hotdog> What is it you’re trying to get?
19:39:37FromDiscord<guttural666> https://www.metal-archives.com/bands/Werwolf/3540355723
19:39:52FromDiscord<guttural666> album names for a band for example
19:49:22FromDiscord<hotdog> In reply to @guttural666 "album names for a": Looks like on that site there is a separate endpoint that returns the album html: https://www.metal-archives.com/band/discography/id/3540355723/tab/all
19:49:55FromDiscord<hotdog> So yeah if it was me I would parse that and query with nimquery
19:50:20FromDiscord<hotdog> The html structure is pretty simple
19:50:38FromDiscord<Yepoleb> regex is fine for very simple stuff, but it quickly becomes unreliable if you try to parse more values
19:51:01FromDiscord<guttural666> In reply to @hotdog "Looks like on that": yep, that's what I found out as well, investigating rn
20:06:26FromDiscord<! Nilts> How would i compile a program on windows with an icon n the output exe
20:10:20FromDiscord<hotdog> In reply to @not logged in "How would i compile": Haven't used it myself, but maybe try this - https://nimble.directory/pkg/rcedit
20:31:26FromDiscord<guttural666> curl is available on Windows I suppose?
20:33:30FromDiscord<Kermithos> In reply to @guttural666 "curl is available on": yeah but you could also use std/httpclient which is written in nim
20:34:54FromDiscord<guttural666> In reply to @Kermithos "yeah but you could": yeeees, now we're talking, was lookig for something clean like this, not this utter hackery hahaha https://media.discordapp.net/attachments/371759389889003532/1045799762823217202/image.png
20:35:33FromDiscord<guttural666> a nim crown for you, thanks for the hint
20:35:56FromDiscord<Kermithos> yeah that looks really ugly 😄
20:36:07FromDiscord<guttural666> total crutch haha
20:36:14FromDiscord<Kermithos> if you really want to use curl there is also https://github.com/Araq/libcurl
20:36:38FromDiscord<Kermithos> but httpclient is way easier
20:37:37FromDiscord<guttural666> just want to dump the html, search for what I need and go on 🙂 looking into httpclient rn
20:53:47FromDiscord<guttural666> how do I manually compile src/Medl.nim to Medl
20:54:01FromDiscord<guttural666> have just used nimble build all the time until now
20:54:33FromDiscord<guttural666> tried this, but this compiles to the src dir↵nim c src/Medl.nim
20:57:10FromDiscord<Kermithos> --outdir:DIR↵set the path where the output file will be written
20:57:16FromDiscord<Kermithos> https://nim-lang.org/docs/nimc.html
20:57:20FromDiscord<guttural666> thank you!
20:58:08FromDiscord<guttural666> can I just specify the current dir from which I am running nim
20:58:45FromDiscord<guttural666> ($PWD) seems to work in fish
20:59:19FromDiscord<Kermithos> `nim c src/Medl.nim --outdir:./` ?
21:00:16FromDiscord<guttural666> hm
21:00:18FromDiscord<guttural666> https://media.discordapp.net/attachments/371759389889003532/1045806151931023450/image.png
21:01:21FromDiscord<Kermithos> oh yea, I think `--outdir:./` should be after `nim c` not at the end
21:01:46FromDiscord<guttural666> okay this works nim c --outdir:$PWD src/Medl.nim
21:02:16FromDiscord<guttural666> exactly options whould be after the command
21:02:24FromDiscord<guttural666> thanks!
21:03:39*leehbi joined #nim
21:03:43*leehbi quit (Remote host closed the connection)
21:10:55*Ziw joined #nim
21:12:15*Ziw quit (Quit: WeeChat 2.8)
21:12:38*Ziw joined #nim
21:14:40*leehbi joined #nim
21:15:25*leehbi quit (Remote host closed the connection)
21:18:42FromDiscord<yrashk> Is it possible to have a block in a `.nimble` file that would be evaluated when dependencies are available?
21:57:45FromDiscord<demotomohiro> The .nimble file is interpreted using NimScript. So I think you can import modules and call macros.
22:01:08*sagax joined #nim
22:02:20Ziwhi
22:03:54FromDiscord<@thatrandomperson5-6310e3b26da03> Is there any way to read each byte of a file as it is coming in? Like a file stream sort of
22:05:20*Jjp137 quit (Quit: Leaving)
22:08:54FromDiscord<Elegantbeef> What's wrong with file stream or the io file api?
22:09:40*Jjp137 joined #nim
22:09:49FromDiscord<@thatrandomperson5-6310e3b26da03> Nothing, i just have never heard of it. This is what im asking
22:10:11FromDiscord<@thatrandomperson5-6310e3b26da03> How do i use it?
22:10:39FromDiscord<Elegantbeef> Well there is the `io` module which is imported by default https://nim-lang.org/docs/io.html and the steams module which you need to import https://nim-lang.org/docs/streams.html
22:13:34FromDiscord<@thatrandomperson5-6310e3b26da03> Is there like an iterator to iterate throught the bytes?
22:13:35FromDiscord<Elegantbeef> You can easily make it
22:13:42FromDiscord<yrashk> In reply to @demotomohiro "The .nimble file is": I tried. Doesn't work.
22:14:07FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gS6
22:14:17FromDiscord<yrashk> Is it possible to tell what binary we're building in `config.nims` (there's more than one in the `.nimble` file)
22:14:32FromDiscord<@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4gS7
22:17:52FromDiscord<demotomohiro> @yrashk `projectPath` or `projectName` procs? https://nim-lang.org/docs/nimscript.html#projectPath
22:18:01*jmdaemon joined #nim
22:22:33FromDiscord<voidwalker> I was asking about this yesterday: https://en.wikipedia.org/wiki/Dictionary_coder - storing strings and other large symbols as indexes of a dictionary. Any library that handles something like this ?
22:34:01FromDiscord<yrashk> In reply to @demotomohiro "<@145563987772309504> `projectPath` or `projectName": It is _almost_ useful. It gives me the binary name but without the extension. I have @["lib.so","bin"] and it gives me `lib` for the first one.↵↵But it still builds lib.so, of course.
22:40:31FromDiscord<guttural666> anybody know whats going on? I'm using httpclient to get the content of a website (what I would do with curl), but the output (top right) does not contain all the data that I would expect (comparing it with the html data I get when saving the whole site with Firefox on the lower right) https://media.discordapp.net/attachments/371759389889003532/1045831375363768392/image.png
22:44:21*dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:45:04*jjido joined #nim
22:46:22FromDiscord<Elegantbeef> The actual request that gets the information is `https://www.metal-archives.com/search/ajax-band-search/?field=name&query=werwolf&sEcho=1&iColumns=3&sColumns=&iDisplayStart=0&iDisplayLength=200&mDataProp_0=0&mDataProp_1=1&mDataProp_2=2`
22:47:06FromDiscord<guttural666> did I miss something in the firefox inspection tool?
22:47:12FromDiscord<Elegantbeef> The search site uses the query information for a specific get
22:47:15FromDiscord<Elegantbeef> Yes
22:47:42FromDiscord<Elegantbeef> This is what that url you're using fetches
22:47:43FromDiscord<Elegantbeef> Which is exactly what you get
22:48:11FromDiscord<Elegantbeef> This is what that url i showed provides
22:48:34FromDiscord<Elegantbeef> Which i think is what you want?
22:49:22FromDiscord<Elegantbeef> `https://www.metal-archives.com/search/ajax-band-search/?field=name&query=werwolf` seems to also get what you want
22:49:42FromDiscord<guttural666> testing
22:49:44FromDiscord<Elegantbeef> something something be kind and dont bombard their site with spam
22:51:25FromDiscord<guttural666> yeah, this looks perfect https://media.discordapp.net/attachments/371759389889003532/1045834119386501211/image.png
22:51:58FromDiscord<guttural666> not sure how you found that out tho, I am lookig at the firefox website inspection thing
22:52:12FromDiscord<Elegantbeef> I was looking at it too
22:52:20FromDiscord<Elegantbeef> Send a request with the network tab open
22:52:37FromDiscord<Elegantbeef> You see multiple requests, click on them to view their body. Find the first one that works carry on
22:57:52FromDiscord<guttural666> where do you get those urls from? looking at the table id="search results" rn https://media.discordapp.net/attachments/371759389889003532/1045835742259187742/image.png
22:58:20FromDiscord<guttural666> network tab opkay
23:02:50FromDiscord<guttural666> omg, there it is, haha https://media.discordapp.net/attachments/371759389889003532/1045836993445249065/image.png
23:03:10FromDiscord<guttural666> learning so much every day, thanks so much!
23:23:23*pbsds7 joined #nim
23:24:03*pbsds quit (Ping timeout: 256 seconds)
23:24:03*pbsds7 is now known as pbsds
23:28:32FromDiscord<@thatrandomperson5-6310e3b26da03> My project’s toHex used to give this `42494D4730313061BA10BA10BA232323242424252525222222212121BA01020304050102030405EF` and now gives this `42494D4730313061EFBFBD10EFBFBD10EFBFBD232323242424252525222222212121EFBFBD0102030402030405EFBFBD`which breaks everything. How would i fix
23:32:36FromDiscord<voidwalker> if s.toHex == "badvalue": return "goodValue" else: return s.toHex ? : D
23:57:04*disso_peach quit (Read error: Connection reset by peer)